High-level functions
====================

nccreate
--------

 -- Function File: nccreate(FILENAME,VARNAME)
 -- Function File: nccreate(FILENAME,VARNAME,"property",VALUE,...)

     Create the variable VARNAME in the file FILENAME.

Properties
..........

The following properties can be used:

  * "Dimensions": a cell array with the dimension names followed by their length or Inf if the dimension is unlimited. If the property is omitted, a scalar variable is created.

  * "Datatype": a string with the Octave data type name (see ncinfo for the correspondence between Octave and NetCDF data types). The default data type is a "double".

  * "Format": This can be "netcdf4_classic" (default), "classic", "64bit" or "netcdf4".

  * "FillValue": the value used for undefined elements of the NetCDF variable.

  * "ChunkSize": the size of the data chunks. If omitted, the variable is not chunked.

  * "DeflateLevel": The deflate level for compression. It can be the string "disable" (default) for no compression or an integer between 0 (no compression) and 9 (maximum compression).

  * "Shuffle": true for enabling the shuffle filter or false (default) for disabling it.

Example
.......

      nccreate("test.nc","temp","Dimensions",{"lon",10,"lat",20},"Format","classic");
      ncdisp("test.nc");

ncwrite

ncdisp
------

 -- Function File: ncdisp (FILENAME)
     Display meta-data of the NetCDF file FILENAME

Example
.......

      ncdisp("test.nc");

ncinfo

ncinfo
------

 -- Function File: INFO = ncinfo (FILENAME)
 -- Function File: INFO = ncinfo (FILENAME, VARNAME)
 -- Function File: INFO = ncinfo (FILENAME, GROUPNAME)
     Return information about an entire NetCDF file FILENAME (i.e. the root group "/"), about the variable called VARNAME or the group called GROUPNAME.

     The structure INFO has always the following fields:

       * FILENAME: the name of the NetCDF file

       * FORMAT: one of the strings "CLASSIC", "64BIT", "NETCDF4" or "NETCDF4_CLASSIC"

     The structure INFO has additional fields depending on whether a group of variable is queried.

Groups
......

Groups are returned as an array structure with the following fields:

  * NAME: the group name. The root group is named "/".

  * DIMENSIONS: a array structure with the dimensions.

  * VARIABLES: a array structure with the variables.

  * ATTRIBUTES: a array structure with global attributes.

  * GROUPS: a array structure (one for each group) with the same fields as this structure.

Dimensions
..........

Dimensions are returned as an array structure with the following fields:

  * NAME: the name of the dimension

  * LENGTH: the length of the dimension

  * UNLIMITED: true of the dimension has no fixed limited, false

Variables
.........

Variables are returned as an array structure with the following fields:

  * NAME: the name of the dimension

  * DIMENSIONS: array structure of all dimensions of this variable with the same structure as above.

  * SIZE: array with the size of the variable

  * DATATYPE: string with the corresponding octave data-type (see below)

  * ATTRIBUTES: a array structure of attributes

  * FILLVALUE: the NetCDF fill value of the variable. If the fill value is not defined, then this attribute is an empty array ([]).

  * DEFLATELEVEL: the NetCDF deflate level between 0 (no compression) and 9 (maximum compression).

  * SHUFFLE: is true if the shuffle filter is activated to improve compression, otherwise false.

  * CHECKSUM: is set to "fletcher32", if check-sums are used, otherwise this field is not defined.

Attributes
..........

Attributes are returned as an array structure with the following fields:

  * NAME: the name of the attribute

  * VALUE: the value of the attribute (with the corresponding type)

  * UNLIMITED: true of the dimension has no fixed limited, false

Data-types
..........

The following the the correspondence between the Octave and NetCDF data-types:

Octave type   NetCDF type
int8      NC_BYTE
uint8     NC_UBYTE
int16     NC_SHORT
uint16    NC_USHORT
int32     NC_INT
uint32    NC_UINT
int64     NC_INT64
uint64    NC_UINT64
single    NC_FLOAT
double    NC_DOUBLE
char      NC_CHAR

The output of ncinfo can be used to create a NetCDF file with the same meta-data using ncwriteschema.

Note: If there are no attributes (or variable or groups), the corresponding field is an empty matrix and not an empty struct array for compatibility with matlab.

ncread,nccreate,ncwriteschema,ncdisp

ncread
------

 -- Function File: X = ncread (FILENAME, VARNAME)
 -- Function File: X = ncread (FILENAME, VARNAME,START,COUNT,STRIDE)

     Read the variable VARNAME from the NetCDF file FILENAME.

     If START,COUNT and STRIDE are present, a subset of the variable is loaded. The parameter START contains the starting indices (1-based), COUNT is the number of elements and STRIDE the increment between two successive elements. These parameters are vectors whose length is equal to the number of dimension of the variable. Elements of COUNT might be Inf which means that as many values as possible are loaded.

     If the variable has the _FillValue attribute, then the corresponding values are replaced by NaN (except for characters). NetCDF attributes scale_factor (default 1) and add_offset (default 0) are use the transform the variable during the loading:

     x = scale_factor * x_in_file + add_offset

     The output data type matches the NetCDF datatype, except when the attributes _FillValue, add_offset or scale_factor are defined in which case the output is a array in double precision.

     Note that values equal to the attribute missing_value are not replaced by NaN (for compatibility).

Example
.......

Read the data from variable 'mydata' in the file test.nc.

      data  = ncread('test.nc','mydata');

ncwrite,ncinfo,ncdisp

ncreadatt
---------

 -- Function File: VAL = ncreadatt(FILENAME,VARNAME,ATTNAME)

     Return the attribute ATTNAME of the variable VARNAME in the file FILENAME.

     Global attributes can be accessed by using "/" or the group name as VARNAME. The type of attribute is mapped to the Octave data types. (see ncinfo).

Example
.......

Read global attribute 'creation_date'

      d = ncreadatt('test.nc','/','creation_date')

Read atribute 'myattr' assigned to variable mydata.

      d = ncreadattr('test.nc', 'mydata', 'myattr');

ncinfo,ncwriteatt

ncwrite
-------

 -- Function File: ncwrite (FILENAME, VARNAME, X)
 -- Function File: ncwrite (FILENAME, VARNAME, X, START, STRIDE)

     Write array X to the the variable VARNAME in the NetCDF file FILENAME.

     The variable with the name VARNAME and the appropriate dimension must already exist in the NetCDF file.

     If START and STRIDE are present, a subset of the variable is written. The parameter START contains the starting indices (1-based) and STRIDE the increment between two successive elements. These parameters are vectors whose length is equal to the number of dimension of the variable.

     If the variable has the _FillValue attribute, then the values equal to NaN are replaced by corresponding fill value NetCDF attributes scale_factor (default 1) and add_oddset (default 0) are use the transform the variable during writing:

     x_in_file = (x - add_offset)/scale_factor

Example
.......

Create a netcdf file with a variable of 'mydata' and then write data to that variable.

      nccreate('myfile.nc','mydata');
      ncwrite('myfile.nc','mydata', 101);

ncread,nccreate

ncwriteatt
----------

 -- Function File: ncwriteatt(FILENAME,VARNAME,ATTNAME,VAL)

     Defines the attribute ATTNAME of the variable VARNAME in the file FILENAME with the value VAL.

     Global attributes can be defined by using "/" or the group name as VARNAME. The type of value is mapped to the NetCDF data types. (see ncinfo).

Example
.......

Create a netcdf4 format file with a variable mydata and assign an attribute "units" to it.

      nccreate("myfile.nc", "mydata", "Format", "netcdf4");
      ncwriteatt("myfile.nc", "mydata", "Units", "K");

ncinfo

ncwriteschema
-------------

 -- Function File: ncwriteschema (FILENAME, SCHEMA)

     Create a NetCDF called FILENAME with the dimensions, attributes, variables and groups given by the structure SCHEMA.

     The variable SCHEMA has the same structure as the results of ncinfo. ncinfo and ncwriteschema can be used together to create a NetCDF using another file as a template:

Example
.......

      schema = ncinfo("template.nc");
      # the new file should be named "new_file.nc"
      ncwriteschema("new_file.nc",schema);

Unused field in SCHEMA such as CHUNKSIZE, SHUFFLE, DEFLATELEVEL, FILLVALUE, CHECKSUM can be left-out if the corresponding feature is not used.

Dimensions are considered as limited if the field UNLIMITED is missing, unless the dimension length is Inf.

ncinfo

Low-level functions (Deprecated)
================================

netcdf_abort
------------

 -- Loadable Function: netcdf_abort(NCID)
     Aborts all changes since the last time the dataset entered in define mode.

netcdf_reDef

netcdf_close
------------

 -- Loadable Function: netcdf_close(NCID)
     Close the NetCDF file with the id NCID.

netcdf_open

netcdf_copyAtt
--------------

 -- Loadable Function: netcdf_copyAtt (NCID,VARID,NAME,NCID_OUT,VARID_OUT)
     Copies the attribute named OLD_NAME of the variable VARID in the data set NCID to the variable VARID_OUT in the data set NCID_OUT. To copy a global attribute use netcdf_getConstant("global") for VARID or VARID_OUT. netcdf_getAtt,netcdf_getConstant

netcdf_create
-------------

 -- Loadable Function: NCID = netcdf_create(FILENAME,MODE)
     Creates the file named FILENAME in the mode MODE which can have the following values: "clobber" (overwrite existing files), "noclobber" (prevent to overwrite existing files) "64bit_offset" (use the 64bit-offset format), "netcdf4" (use the NetCDF4, i.e. HDF5 format) or "share" (concurrent reading of the dataset). MODE can also be the numeric value return by netcdf_getConstant. In the later-case it can be combined with a bitwise-or.

Example
.......

     mode =  bitor(netcdf.getConstant("classic_model"), ...
     netcdf.getConstant("netcdf4"));
     ncid = netcdf.create("test.nc",mode);

netcdf_close

netcdf_defDim
-------------

 -- Loadable Function: DIMID = netcdf_defDim(NCID,NAME,LEN)
     Define the dimension with the name NAME and the length LEN in the dataset NCID. The id of the dimension is returned.

netcdf_defVar

netcdf_defGrp
-------------

 -- Loadable Function: NEW_NCID = netcdf_defGrp(NCID,NAME)
     Define a group in a NetCDF file. netcdf_inqGrps

netcdf_defVar
-------------

 -- Loadable Function: VARID =  netcdf_defVar(NCID,NAME,XTYPE,DIMIDS)
     Defines a variable with the name NAME in the dataset NCID. XTYPE can be "byte", "ubyte", "short", "ushort", "int", "uint", "int64", "uint64", "float", "double", "char" or the corresponding number as returned by netcdf_getConstant. The parameter DIMIDS define the ids of the dimension. For scalar this parameter is the empty array ([]). The variable id is returned.

netcdf_open,netcdf_defDim

netcdf_defVarChunking
---------------------

 -- Loadable Function: netcdf_defVarChunking (NCID,VARID,STORAGE,CHUNKSIZES)
     Define the chunking settings of NetCDF variable VARID. If STORAGE is the string "chunked", the variable is stored by chunk of the size CHUNKSIZES. If STORAGE is the string "contiguous", the variable is stored in a contiguous way.

netcdf_inqVarChunking

netcdf_defVarDeflate
--------------------

 -- Loadable Function: netcdf_defVarDeflate (NCID,VARID,SHUFFLE,DEFLATE,DEFLATE_LEVEL)
     Define the compression settings NetCDF variable VARID. If DEFLATE is true, then the variable is compressed. The compression level DEFLATE_LEVEL is an integer between 0 (no compression) and 9 (maximum compression).

netcdf_inqVarDeflate

netcdf_defVarFill
-----------------

 -- Loadable Function: netcdf_defVarFill(NCID,VARID,NO_FILL,FILLVALUE)
     Define the fill-value settings of the NetCDF variable VARID. If NO_FILL is false, then the values between no-contiguous writes are filled with the value FILL_VALUE. This is disabled by setting NO_FILL to true.

netcdf_inqVarFill

netcdf_defVarFletcher32
-----------------------

 -- Loadable Function: netcdf_defVarFletcher32(NCID,VARID,CHECKSUM)
     Defines the checksum settings of the variable with the id VARID in the data set NCID. If CHECKSUM is the string "FLETCHER32", then fletcher32 checksums will be turned on for this variable. If CHECKSUM is "NOCHECKSUM", then checksums will be disabled.

netcdf_defVar,netcdf_inqVarFletcher32

netcdf_defVlen
--------------

 -- Loadable Function: VARID =  netcdf_defVlen(NCID,TYPENAME,BASETYPE)
     Defines a NC_VLEN variable length array type with the type name TYPENAME and a base datatype of BASETYPE in the dataset NCID. BASETYPE can be "byte", "ubyte", "short", "ushort", "int", "uint", "int64", "uint64", "float", "double", "char" or the corresponding number as returned by netcdf_getConstant. The new data type id is returned.

netcdf_open,netcdf_defVar, netcdf_inqVlen

netcdf_delAtt
-------------

 -- Loadable Function: netcdf_delAtt(NCID,VARID,NAME)
     Deletes the attribute named NAME of the variable VARID in the data set NCID. To delete a global attribute use netcdf_getConstant("global") for VARID. netcdf_defAtt,netcdf_getConstant

netcdf_endDef
-------------

 -- Loadable Function: netcdf_endDef (NCID)
     Leaves define-mode of NetCDF file NCID.

netcdf_reDef

netcdf_getAtt
-------------

 -- Loadable Function: DATA = netcdf_getAtt (NCID,VARID,NAME)
     Get the value of a NetCDF attribute. This function returns the value of the attribute called NAME of the variable VARID in the NetCDF file NCID. For global attributes VARID can be netcdf_getConstant("global"). netcdf_putAtt

netcdf_getChunkCache
--------------------

 -- Loadable Function: [SIZE, NELEMS, PREEMPTION] = netcdf_getChunkCache()
     Gets the default chunk cache settings in the HDF5 library.

netcdf_setChunkCache

netcdf_getConstant
------------------

 -- Loadable Function: VALUE = netcdf_getConstant(NAME)
     Returns the value of a NetCDF constant called NAME. netcdf_getConstantNames

netcdf_getConstantNames
-----------------------

 -- Loadable Function: VALUE = netcdf_getConstantNames()
     Returns a list of all constant names.

netcdf_getConstant

netcdf_getVar
-------------

 -- Loadable Function: DATA = netcdf_getVar (NCID,VARID)
 -- Loadable Function: DATA = netcdf_getVar (NCID,VARID,START)
 -- Loadable Function: DATA = netcdf_getVar (NCID,VARID,START,COUNT)
 -- Loadable Function: DATA = netcdf_getVar (NCID,VARID,START,COUNT,STRIDE)
     Get the data from a NetCDF variable. The data DATA is loaded from the variable VARID of the NetCDF file NCID. START is the start index of each dimension (0-based and defaults to a vector of zeros), COUNT is the number of elements of to be written along each dimension (default all elements) and STRIDE is the sampling interval.

netcdf_putVar

netcdf_inq
----------

 -- Loadable Function: VERS = netcdf_inqLibVers()
     Returns the version of the NetCDF library.

netcdf_open

netcdf_inqAtt
-------------

 -- Loadable Function: NAME = netcdf_inqAttName (NCID,VARID,ATTNUM)
     Get the name of a NetCDF attribute. This function returns the name of the attribute with the id ATTNUM of the variable VARID in the NetCDF file NCID. For global attributes VARID can be netcdf_getConstant("global"). netcdf_inqAttName

netcdf_inqAttID
---------------

 -- Loadable Function: ATTNUM = netcdf_inqAttID(NCID,VARID,ATTNAME)
     Return the attribute id ATTNUM of the attribute named ATTNAME of the variable VARID in the dataset NCID. For global attributes VARID can be netcdf_getConstant("global"). netcdf_inqAttName

netcdf_inqAttName
-----------------

 -- Loadable Function: NAME = netcdf_inqAttName (NCID,VARID,ATTNUM)
     Get the name of a NetCDF attribute. This function returns the name of the attribute with the id ATTNUM of the variable VARID in the NetCDF file NCID. For global attributes VARID can be netcdf_getConstant("global"). netcdf_inqAttName

netcdf_inqDim
-------------

 -- Loadable Function: [NAME,LENGTH] = netcdf_inqDim(NCID,DIMID)
     Returns the name and length of a NetCDF dimension. netcdf_inqDimID

netcdf_inqDimID
---------------

 -- Loadable Function: DIMID = netcdf_inqDimID(NCID,DIMNAME)
     Return the id of a NetCDF dimension. netcdf_inqDim

netcdf_inqDimIDs
----------------

 -- Loadable Function: DIMIDS = netcdf_inqDimID(NCID)
 -- Loadable Function: DIMIDS = netcdf_inqDimID(NCID,INCLUDE_PARENTS)
     Return the dimension ids defined in a NetCDF file. If INCLUDE_PARENTS is 1, the dimension ids of the parent group are also returned. Per default this is not the case (INCLUDE_PARENTS is 0). netcdf_inqDim

netcdf_inqFormat
----------------

 -- Loadable Function: FORMAT = netcdf_inqFormat(NCID)
     Return the NetCDF format of the dataset NCID. Format might be one of the following "FORMAT_CLASSIC", "FORMAT_64BIT", "FORMAT_NETCDF4" or "FORMAT_NETCDF4_CLASSIC"

netcdf_inq

netcdf_inqGrpFullNcid
---------------------

 -- Loadable Function: GRP_NCID = netcdf_inqGrpFullNcid(NCID,NAME)
     Return the group id based on the full group name. netcdf_inqGrpName

netcdf_inqGrpName
-----------------

 -- Loadable Function: NAME = netcdf_inqGrpName(NCID)
     Return group name in a NetCDF file. netcdf_inqGrps

netcdf_inqGrpNameFull
---------------------

 -- Loadable Function: NAME = netcdf_inqGrpNameFull(NCID)
     Return full name of group in NetCDF file. netcdf_inqGrpName

netcdf_inqGrpParent
-------------------

 -- Loadable Function: PARENT_NCID = netcdf_inqGrpParent(NCID)
     Return id of the parent group netcdf_inqGrpName

netcdf_inqGrps
--------------

 -- Loadable Function: NCIDS = netcdf_inqGrps(NCID)
     Return all groups ids in a NetCDF file. netcdf_inqGrps

netcdf_inqLibVers
-----------------

 -- Loadable Function: VERS = netcdf_inqLibVers()
     Returns the version of the NetCDF library.

netcdf_open

netcdf_inqNcid
--------------

 -- Loadable Function: GRP_NCID = netcdf_inqNcid(NCID,NAME)
     Return group id based on its name netcdf_inqGrpFullNcid

netcdf_inqUnlimDims
-------------------

 -- Loadable Function: UNLIMDIMIDS = netcdf_inqUnlimDims(NCID)
     Return the id of all unlimited dimensions of the NetCDF file NCID.

netcdf_inq

netcdf_inqUserType
------------------

 -- Loadable Function: [TYPENAME, BYTESIZE, BASETYPEID, NUMFIELDS, CLASSID] =  netcdf_inqUserType(NCID,TYPEID)
     Provide information on a user defined type TYPEID in the dataset NCID.

     The function returns the typename, bytesize, base type id, number of fields and class identifier of the type.

netcdf_open, netcdf_defVlen, netcdf_inqVlen

netcdf_inqVar
-------------

 -- Loadable Function: [NO_FILL,FILLVALUE] =  netcdf_inqVarFill(NCID,VARID)
     Determines the fill-value settings of the NetCDF variable VARID. If NO_FILL is false, then the values between no-contiguous writes are filled with the value FILL_VALUE. This is disabled by setting NO_FILL to true.

netcdf_defVarFill

netcdf_inqVarChunking
---------------------

 -- Loadable Function: [STORAGE,CHUNKSIZES] =  netcdf_inqVarChunking (NCID,VARID)
     Determines the chunking settings of NetCDF variable VARID. If STORAGE is the string "chunked", the variable is stored by chunk of the size CHUNKSIZES. If STORAGE is the string "contiguous", the variable is stored in a contiguous way.

netcdf_defVarChunking

netcdf_inqVarDeflate
--------------------

 -- Loadable Function: [SHUFFLE,DEFLATE,DEFLATE_LEVEL] =  netcdf_inqVarDeflate (NCID,VARID)
     Determines the compression settings NetCDF variable VARID. If DEFLATE is true, then the variable is compressed. The compression level DEFLATE_LEVEL is an integer between 0 (no compression) and 9 (maximum compression).

netcdf_defVarDeflate

netcdf_inqVarFill
-----------------

 -- Loadable Function: [NO_FILL,FILLVALUE] =  netcdf_inqVarFill(NCID,VARID)
     Determines the fill-value settings of the NetCDF variable VARID. If NO_FILL is false, then the values between no-contiguous writes are filled with the value FILL_VALUE. This is disabled by setting NO_FILL to true.

netcdf_defVarFill

netcdf_inqVarFletcher32
-----------------------

 -- Loadable Function: CHECKSUM = netcdf_inqVarFletcher32(NCID,VARID)
     Determines the checksum settings of the variable with the id VARID in the data set NCID. If fletcher32 checksums is turned on for this variable, then CHECKSUM is the string "FLETCHER32". Otherwise it is the string "NOCHECKSUM".

netcdf_defVar,netcdf_inqVarFletcher32

netcdf_inqVarID
---------------

 -- Loadable Function: VARID =  netcdf_inqVarID (NCID,NAME)
     Return the id of a variable based on its name. netcdf_defVar,netcdf_inqVarIDs

netcdf_inqVarIDs
----------------

 -- Loadable Function: VARIDS =  netcdf_inqVarID (NCID)
     Return all variable ids. This functions returns all variable ids in a NetCDF file or NetCDF group. netcdf_inqVarID

netcdf_inqVlen
--------------

 -- Loadable Function: [TYPENAME, BYTESIZE, BASETYPEID] =  netcdf_inqVlen(NCID,TYPEID)
     Provide information on a NC_VLEN variable length array type TYPEID in the dataset NCID.

     The function returns the typename, bytesize, and base type id.

netcdf_open, netcdf_defVlen

netcdf_open
-----------

 -- Loadable Function: NCID = netcdf_open(FILENAME,MODE)
     Opens the file named FILENAME in the mode MODE.

netcdf_close

netcdf_putAtt
-------------

 -- Loadable Function: netcdf_putAtt (NCID,VARID,NAME,DATA)
     Defines a NetCDF attribute. This function defines the attribute called NAME of the variable VARID in the NetCDF file NCID. The value of the attribute will be DATA. For global attributes VARID can be netcdf_getConstant("global"). netcdf_getAtt

netcdf_putVar
-------------

 -- Loadable Function: netcdf_putVar (NCID,VARID,DATA)
 -- Loadable Function: netcdf_putVar (NCID,VARID,START,DATA)
 -- Loadable Function: netcdf_putVar (NCID,VARID,START,COUNT,DATA)
 -- Loadable Function: netcdf_putVar (NCID,VARID,START,COUNT,STRIDE,DATA)
     Put data in a NetCDF variable. The data DATA is stored in the variable VARID of the NetCDF file NCID. START is the start index of each dimension (0-based and defaults to a vector of zeros), COUNT is the number of elements of to be written along each dimension (default all elements) and STRIDE is the sampling interval.

netcdf_endDef

netcdf_reDef
------------

 -- Loadable Function: netcdf_reDef (NCID)
     Enter define-mode of NetCDF file NCID.

netcdf_endDef

netcdf_renameAtt
----------------

 -- Loadable Function: netcdf_renameAtt(NCID,VARID,OLD_NAME,NEW_NAME)
     Renames the attribute named OLD_NAME of the variable VARID in the data set NCID. NEW_NAME is the new name of the attribute. To rename a global attribute use netcdf_getConstant("global") for VARID. netcdf_copyAtt,netcdf_getConstant

netcdf_renameDim
----------------

 -- Loadable Function: netcdf_renameDim(NCID,DIMID,NAME)
     Renames the dimension with the id DIMID in the data set NCID. NAME is the new name of the dimension.

netcdf_defDim

netcdf_renameVar
----------------

 -- Loadable Function: netcdf_renameVar(NCID,VARID,NAME)
     Renames the variable with the id VARID in the data set NCID. NAME is the new name of the variable.

netcdf_defVar

netcdf_setChunkCache
--------------------

 -- Loadable Function: netcdf_setChunkCache(SIZE, NELEMS, PREEMPTION)
     Sets the default chunk cache settings in the HDF5 library. The settings applies to all files which are subsequently opened or created.

netcdf_getChunkCache

netcdf_setDefaultFormat
-----------------------

 -- Loadable Function: OLD_FORMAT = netcdf_setDefaultFormat(FORMAT)
     Sets the default format of the NetCDF library and returns the previous default format (as a numeric value). FORMAT can be "format_classic", "format_64bit",  "format_netcdf4" or "format_netcdf4_classic".

netcdf_open

netcdf_setFill
--------------

 -- Loadable Function: OLD_MODE = netcdf_setFill(NCID,FILLMODE)
     Change the fill mode (FILLMODE) of the data set NCID. The previous value of the fill mode is returned. FILLMODE can be either "fill" or "nofill".

netcdf_open

netcdf_sync
-----------

 -- Loadable Function: netcdf_sync(NCID)
     Writes all changes to the disk and leaves the file open.

netcdf_close

Low-level functions
===================

netcdf.abort
------------

 -- netcdf.abort(NCID):
     Aborts all changes since the last time the dataset entered in define mode.

netcdf.close
------------

 -- netcdf.close(NCID):
     Close the NetCDF file with the id NCID.

netcdf.copyAtt
--------------

 -- netcdf.copyAtt: (NCID,VARID,NAME,NCID_OUT,VARID_OUT)
     Copies the attribute named OLD_NAME of the variable VARID in the data set NCID to the variable VARID_OUT in the data set NCID_OUT. To copy a global attribute use netcdf.getConstant("global") for VARID or VARID_OUT. netcdf.getAtt,netcdf.getConstant

netcdf.create
-------------

 -- NCID =: netcdf.create(FILENAME,MODE)
     Creates the file named FILENAME in the mode MODE which can have the following values: "clobber" (overwrite existing files), "noclobber" (prevent to overwrite existing files) "64bit_offset" (use the 64bit-offset format), "netcdf4" (use the NetCDF4, i.e. HDF5 format) or "share" (concurrent reading of the dataset). MODE can also be the numeric value return by netcdf.getConstant. In the later-case it can be combined with a bitwise-or.

Example
.......

      mode = bitor(netcdf.getConstant("classic_model"), ...
      netcdf.getConstant("netcdf4"));
      ncid = netcdf.create("test.nc",mode);

netcdf.defDim
-------------

 -- DIMID =: netcdf.defDim(NCID,NAME,LEN)
     Define the dimension with the name NAME and the length LEN in the dataset NCID. The id of the dimension is returned.

netcdf.defGrp
-------------

 -- NEW_NCID =: netcdf.defGrp(NCID,NAME)
     Define a group in a NetCDF file. netcdf.inqGrps

netcdf.defVar
-------------

 -- VARID = : netcdf.defVar(NCID,NAME,XTYPE,DIMIDS)
     Defines a variable with the name NAME in the dataset NCID. XTYPE can be "byte", "ubyte", "short", "ushort", "int", "uint", "int64", "uint64", "float", "double", "char" or the corresponding number as returned by netcdf.getConstant. The parameter DIMIDS define the ids of the dimension. For scalar this parameter is the empty array ([]). The variable id is returned.

netcdf.defVarChunking
---------------------

 -- netcdf.defVarChunking: (NCID,VARID,STORAGE,CHUNKSIZES)
     Define the chunking settings of NetCDF variable VARID. If STORAGE is the string "chunked", the variable is stored by chunk of the size CHUNKSIZES. If STORAGE is the string "contiguous", the variable is stored in a contiguous way.

netcdf.defVarDeflate
--------------------

 -- netcdf.defVarDeflate: (NCID,VARID,SHUFFLE,DEFLATE,DEFLATE_LEVEL)
     Define the compression settings NetCDF variable VARID. If DEFLATE is true, then the variable is compressed. The compression level DEFLATE_LEVEL is an integer between 0 (no compression) and 9 (maximum compression).

netcdf.defVarFill
-----------------

 -- netcdf.defVarFill(NCID,VARID,NO_FILL,FILLVALUE):
     Define the fill-value settings of the NetCDF variable VARID. If NO_FILL is false, then the values between no-contiguous writes are filled with the value FILL_VALUE. This is disabled by setting NO_FILL to true.

netcdf.defVarFletcher32
-----------------------

 -- netcdf.defVarFletcher32(NCID,VARID,CHECKSUM):
     Defines the checksum settings of the variable with the id VARID in the data set NCID. If CHECKSUM is the string "FLETCHER32", then fletcher32 checksums will be turned on for this variable. If CHECKSUM is "NOCHECKSUM", then checksums will be disabled.

netcdf.defVlen
--------------

 -- VARID = : netcdf.defVlen(NCID,TYPENAME,BASETYPE)
     Defines a NC_VLEN variable length array type with the type name TYPENAME and a base datatype of BASETYPE in the dataset NCID. BASETYPE can be "byte", "ubyte", "short", "ushort", "int", "uint", "int64", "uint64", "float", "double", "char" or the corresponding number as returned by netcdf.getConstant. The new data type id is returned.

netcdf.delAtt
-------------

 -- netcdf.delAtt(NCID,VARID,NAME):
     Deletes the attribute named NAME of the variable VARID in the data set NCID. To delete a global attribute use netcdf.getConstant("global") for VARID. netcdf.defAtt,netcdf.getConstant

netcdf.endDef
-------------

 -- netcdf.endDef: (NCID)
     Leaves define-mode of NetCDF file NCID.

netcdf.getAtt
-------------

 -- DATA =: netcdf.getAtt (NCID,VARID,NAME)
     Get the value of a NetCDF attribute. This function returns the value of the attribute called NAME of the variable VARID in the NetCDF file NCID. For global attributes VARID can be netcdf.getConstant("global"). netcdf.putAtt

netcdf.getChunkCache
--------------------

 -- [SIZE, NELEMS, PREEMPTION] =: netcdf.getChunkCache()
     Gets the default chunk cache settings in the HDF5 library.

netcdf.getConstant
------------------

 -- VALUE =: netcdf.getConstant(NAME)
     Returns the value of a NetCDF constant called NAME. netcdf.getConstantNames

netcdf.getConstantNames
-----------------------

 -- VALUE =: netcdf.getConstantNames()
     Returns a list of all constant names.

netcdf.getVar
-------------

 -- DATA =: netcdf.getVar (NCID,VARID)
 -- DATA =: netcdf.getVar (NCID,VARID,START)
 -- DATA =: netcdf.getVar (NCID,VARID,START,COUNT)
 -- DATA =: netcdf.getVar (NCID,VARID,START,COUNT,STRIDE)
     Get the data from a NetCDF variable. The data DATA is loaded from the variable VARID of the NetCDF file NCID. START is the start index of each dimension (0-based and defaults to a vector of zeros), COUNT is the number of elements of to be written along each dimension (default all elements) and STRIDE is the sampling interval.

netcdf.inq
----------

 -- [NDIMS,NVARS,NGATTS,UNLIMDIMID] =: netcdf.inq(NCID)
     Return the number of dimension (NDIMS), the number of variables (NVARS), the number of global attributes (NGATTS) and the id of the unlimited dimension (UNLIMDIMID). If no unlimited dimension is declared -1 is returned. For NetCDF4 files, one should use the function netcdf.inqUnlimDims as multiple unlimite dimension exists.

netcdf.inqAtt
-------------

 -- [XTYPE,LEN] = : netcdf.inqAtt(NCID,VARID,NAME)
     Get attribute type and length. netcdf.inqAttName

netcdf.inqAttID
---------------

 -- ATTNUM =: netcdf.inqAttID(NCID,VARID,ATTNAME)
     Return the attribute id ATTNUM of the attribute named ATTNAME of the variable VARID in the dataset NCID. For global attributes VARID can be netcdf.getConstant("global"). netcdf.inqAttName

netcdf.inqAttName
-----------------

 -- NAME =: netcdf.inqAttName (NCID,VARID,ATTNUM)
     Get the name of a NetCDF attribute. This function returns the name of the attribute with the id ATTNUM of the variable VARID in the NetCDF file NCID. For global attributes VARID can be netcdf.getConstant("global"). netcdf.inqAttName

netcdf.inqDim
-------------

 -- [NAME,LENGTH] =: netcdf.inqDim(NCID,DIMID)
     Returns the name and length of a NetCDF dimension. netcdf.inqDimID

netcdf.inqDimID
---------------

 -- DIMID =: netcdf.inqDimID(NCID,DIMNAME)
     Return the id of a NetCDF dimension. netcdf.inqDim

netcdf.inqDimIDs
----------------

 -- DIMIDS =: netcdf.inqDimID(NCID)
 -- DIMIDS =: netcdf.inqDimID(NCID,INCLUDE_PARENTS)
     Return the dimension ids defined in a NetCDF file. If INCLUDE_PARENTS is 1, the dimension ids of the parent group are also returned. Per default this is not the case (INCLUDE_PARENTS is 0). netcdf.inqDim

netcdf.inqFormat
----------------

 -- FORMAT =: netcdf.inqFormat(NCID)
     Return the NetCDF format of the dataset NCID. Format might be one of the following "FORMAT_CLASSIC", "FORMAT_64BIT", "FORMAT_NETCDF4" or "FORMAT_NETCDF4_CLASSIC"

netcdf.inqGrpFullNcid
---------------------

 -- GRP_NCID =: netcdf.inqGrpFullNcid(NCID,NAME)
     Return the group id based on the full group name. netcdf.inqGrpName

netcdf.inqGrpName
-----------------

 -- NAME =: netcdf.inqGrpName(NCID)
     Return group name in a NetCDF file. netcdf.inqGrps

netcdf.inqGrpNameFull
---------------------

 -- NAME =: netcdf.inqGrpNameFull(NCID)
     Return full name of group in NetCDF file. netcdf.inqGrpName

netcdf.inqGrpParent
-------------------

 -- PARENT_NCID =: netcdf.inqGrpParent(NCID)
     Return id of the parent group netcdf.inqGrpName

netcdf.inqGrps
--------------

 -- NCIDS =: netcdf.inqGrps(NCID)
     Return all groups ids in a NetCDF file. netcdf.inqGrps

netcdf.inqLibVers
-----------------

 -- VERS =: netcdf.inqLibVers()
     Returns the version of the NetCDF library.

netcdf.inqNcid
--------------

 -- GRP_NCID =: netcdf.inqNcid(NCID,NAME)
     Return group id based on its name netcdf.inqGrpFullNcid

netcdf.inqUnlimDims
-------------------

 -- UNLIMDIMIDS =: netcdf.inqUnlimDims(NCID)
     Return the id of all unlimited dimensions of the NetCDF file NCID.

netcdf.inqUserType
------------------

 -- [TYPENAME, BYTESIZE, BASETYPEID, NUMFIELDS, CLASSID] = : netcdf.inqUserType(NCID,TYPEID)
     Provide information on a user defined type TYPEID in the dataset NCID.

     The function returns the typename, bytesize, base type id, number of fields and class identifier of the type.

netcdf.inqVar
-------------

 -- [NAME,NCTYPE,DIMIDS,NATTR] = : netcdf.inqVar (NCID,VARID)
     Inquires information about a NetCDF variable. This functions returns the NAME, the NetCDF type NCTYPE, an array of dimension ids DIMIDS and the number of attributes NATTR of the NetCDF variable. NCTYPE in an integer corresponding NetCDF constants. netcdf.inqVarID,netcdf.getConstant

netcdf.inqVarChunking
---------------------

 -- [STORAGE,CHUNKSIZES] = : netcdf.inqVarChunking (NCID,VARID)
     Determines the chunking settings of NetCDF variable VARID. If STORAGE is the string "chunked", the variable is stored by chunk of the size CHUNKSIZES. If STORAGE is the string "contiguous", the variable is stored in a contiguous way.

netcdf.inqVarDeflate
--------------------

 -- [SHUFFLE,DEFLATE,DEFLATE_LEVEL] = : netcdf.inqVarDeflate (NCID,VARID)
     Determines the compression settings NetCDF variable VARID. If DEFLATE is true, then the variable is compressed. The compression level DEFLATE_LEVEL is an integer between 0 (no compression) and 9 (maximum compression).

netcdf.inqVarFill
-----------------

 -- [NO_FILL,FILLVALUE] = : netcdf.inqVarFill(NCID,VARID)
     Determines the fill-value settings of the NetCDF variable VARID. If NO_FILL is false, then the values between no-contiguous writes are filled with the value FILL_VALUE. This is disabled by setting NO_FILL to true.

netcdf.inqVarFletcher32
-----------------------

 -- CHECKSUM =: netcdf.inqVarFletcher32(NCID,VARID)
     Determines the checksum settings of the variable with the id VARID in the data set NCID. If fletcher32 checksums is turned on for this variable, then CHECKSUM is the string "FLETCHER32". Otherwise it is the string "NOCHECKSUM".

netcdf.inqVarID
---------------

 -- VARID = : netcdf.inqVarID (NCID,NAME)
     Return the id of a variable based on its name. netcdf.defVar,netcdf.inqVarIDs

netcdf.inqVarIDs
----------------

 -- VARIDS = : netcdf.inqVarID (NCID)
     Return all variable ids. This functions returns all variable ids in a NetCDF file or NetCDF group. netcdf.inqVarID

netcdf.inqVlen
--------------

 -- [TYPENAME, BYTESIZE, BASETYPEID] = : netcdf.inqVlen(NCID,TYPEID)
     Provide information on a NC_VLEN variable length array type TYPEID in the dataset NCID.

     The function returns the typename, bytesize, and base type id.

netcdf.open
-----------

 -- NCID =: netcdf.open(FILENAME,MODE)
     Opens the file named FILENAME in the mode MODE.

netcdf.putAtt
-------------

 -- netcdf.putAtt: (NCID,VARID,NAME,DATA)
     Defines a NetCDF attribute. This function defines the attribute called NAME of the variable VARID in the NetCDF file NCID. The value of the attribute will be DATA. For global attributes VARID can be netcdf.getConstant("global"). netcdf.getAtt

netcdf.putVar
-------------

 -- netcdf.putVar: (NCID,VARID,DATA)
 -- netcdf.putVar: (NCID,VARID,START,DATA)
 -- netcdf.putVar: (NCID,VARID,START,COUNT,DATA)
 -- netcdf.putVar: (NCID,VARID,START,COUNT,STRIDE,DATA)
     Put data in a NetCDF variable. The data DATA is stored in the variable VARID of the NetCDF file NCID. START is the start index of each dimension (0-based and defaults to a vector of zeros), COUNT is the number of elements of to be written along each dimension (default all elements) and STRIDE is the sampling interval.

netcdf.reDef
------------

 -- netcdf.reDef: (NCID)
     Enter define-mode of NetCDF file NCID.

netcdf.renameAtt
----------------

 -- netcdf.renameAtt(NCID,VARID,OLD_NAME,NEW_NAME):
     Renames the attribute named OLD_NAME of the variable VARID in the data set NCID. NEW_NAME is the new name of the attribute. To rename a global attribute use netcdf.getConstant("global") for VARID. netcdf.copyAtt,netcdf.getConstant

netcdf.renameDim
----------------

 -- netcdf.renameDim(NCID,DIMID,NAME):
     Renames the dimension with the id DIMID in the data set NCID. NAME is the new name of the dimension.

netcdf.renameVar
----------------

 -- netcdf.renameVar(NCID,VARID,NAME):
     Renames the variable with the id VARID in the data set NCID. NAME is the new name of the variable.

netcdf.setChunkCache
--------------------

 -- netcdf.setChunkCache(SIZE,: NELEMS, PREEMPTION)
     Sets the default chunk cache settings in the HDF5 library. The settings applies to all files which are subsequently opened or created.

netcdf.setDefaultFormat
-----------------------

 -- OLD_FORMAT =: netcdf.setDefaultFormat(FORMAT)
     Sets the default format of the NetCDF library and returns the previous default format (as a numeric value). FORMAT can be "format_classic", "format_64bit", "format_netcdf4" or "format_netcdf4_classic".

netcdf.setFill
--------------

 -- OLD_MODE =: netcdf.setFill(NCID,FILLMODE)
     Change the fill mode (FILLMODE) of the data set NCID. The previous value of the fill mode is returned. FILLMODE can be either "fill" or "nofill".

netcdf.sync
-----------

 -- netcdf.sync(NCID):
     Writes all changes to the disk and leaves the file open.

Import functions (Deprecated)
=============================

import_netcdf
-------------

 -- import_fits:
     Dummy function provided to provide compatibility with older versions of GNU Octave netcdf

     Function is deprecated.

Test function
=============

test_netcdf
-----------

 -- test_netcdf:
     Function to do a basic test of the netcdf interface