| Home | zeGraph lib | Lua lib | Custom lib | Tutorials | Notes | XML Script | C-Talk | Z-Script |
Graph
   axis
   blend
   color
   color bar
   fog
   freetype
   light
   line
   material
   node
   point
   plot
   polygon
   render
   scene
   stencil
   texcoord
   text
   texture
   vertex
Utility
   array
   bio
   hdf
   make
   math
   netcdf
Auxiliary
   curl
   expact
   sqlite
   window

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)

Opens a netCDF for reading.

:open(file, "w")

Opens a netCDF for writing.

:version()

Returns the version number as string.

:info()

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

:defdim(name, len)

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

:defvar(name, type, dim_id1[, dim_id2,...])

If the file is opened for writing, this function defines (create) a new named variable. If you are not sure which dimension ID corresponds 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)

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

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

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

:getvar(name, arr)

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

:getvar(name, spec, arr)

Reads a block of data of the named variable to the array arr. 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)

Writes data of in the array arr to the named 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)

Writes a block of data in the array arr to the name 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.