1.2

| home | graph lib | utility lib | custom lib | auxiliary lib | tutorials |

   Array
   BIO
   HDF
   Make
   Math
   netCDF

zeNetCDF

Use .new("cdf") to create the object. It reads data from and write data to a file in netCDF format. All netCDF variable and attributes types are supported for reading. Writing support all variable types but only text and double types for attribute. Functions include open, version, info, defdim, defvar, getatt, putatt, getvar, putvar.

:open(file, ["w"])

Opens a netCDF for reading if no option argument is used. Use "w" to specify writing.

:version()

Returns the version number as string.

:info()

Prints information of dimensions, variables, attributes of the opened file.

:defdim(name, len)

name - a string for the dimension name.
len - a number for the dimension length.

If the file is opened for writing, this function defines (create) a new dimension.

:defvar(name, type, dimid1[, dimid2,...])

name - a string for the variable name.
type - a string for the variable type.
dimid1 - a number for the dirst dimension ID.
dimid2 - a number for the second dimension ID.

If the file is opened for writing, this function defines (create) a new variable. If you are not sure which dimension ID corresponding to which dimension, use the info() function to find out. The type argument can be "char", "byte", "short", "int", "float", or "double".

:getatt(varname, attname)

varname - a string for variable name.
attname - a string for attribute name.

Reads values of the named attribute of the variable. Retruns a string or numbers depending on the attribute type.

:putatt(varname, attname, att1[, att2,...])

varname - a string for variable name.
attname - a string for attribute name.
att1 - attribute.
att2 - attribute.

Writes new values to the named attribute of the variable. If att1 is string write a string; otherwise try to write att1, att2, and others as numbers.

:getvar(name, arr)

name - a string for variable name.
arr - a zeArray object to hold data.

Reads all data of the variable. The type of the array object must match the data type of the variable. The function will resize arr. Use the info() function to get the variable type if necessary.

:getvar(name, spec, arr)

name - a string for variable name.
spec - a zeArray object to specify the block to read.
arr - a zeArray object to hold data.

Reads a block of data of the variable. The array type of spec must be unsigned integer of m rows by 2 columns with the first column specifies the start positon and the second the number of data to read for each dimension. The number of rows of spec must equal to the number of dimensions of the variable. The array type of arr must match the data type of the variable. Use the info() function to get the variable type and dimensions if necessary.

:putvar(name, arr)

name - a string for variable name.
arr - a zeArray object holding the data.

Writes data of arr to the variable. The type of the array and the number of data must match those of the variable. Use the info() function to get the variable type and dimensions if necessary.

:putvar(name, spec, arr)

name - a string for variable name.
spec - a zeArray object to specify the block to write.
arr - a zeArray object to holding the data.

Writes a block of data to the variable. The array type of spec must be unsigned integer of m rows by 2 columns with the first column specifies the start positon and the second the number of data to write for each dimension. The number of rows of spec must equal to the number of dimensions of the variable. The array type of arr must match the data type of the variable. Use the info() function to get the variable type and dimensions if necessary.