Aborts all changes since the last time the dataset entered in define mode.
(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.
See also: netcdf.getAtt,netcdf.getConstant.
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.
mode = bitor(netcdf.getConstant("classic_model"), ... netcdf.getConstant("netcdf4")); ncid = netcdf.create("test.nc",mode);
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.
new_ncid =
netcdf.defGrp(ncid,name) ¶Define a group in a NetCDF file.
See also: netcdf.inqGrps.
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.
(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.
(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).
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.
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.
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.
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.
See also: netcdf.defAtt,netcdf.getConstant.
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").
See also: netcdf.putAtt.
[size, nelems, preemption] =
netcdf.getChunkCache() ¶Gets the default chunk cache settings in the HDF5 library.
value =
netcdf.getConstant(name) ¶Returns the value of a NetCDF constant called name.
See also: netcdf.getConstantNames.
value =
netcdf.getConstantNames() ¶Returns a list of all constant names.
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.
[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.
[xtype,len] =
netcdf.inqAtt(ncid,varid,name) ¶Get attribute type and length.
See also: netcdf.inqAttName.
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").
See also: 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").
See also: netcdf.inqAttName.
[name,length] =
netcdf.inqDim(ncid,dimid) ¶Returns the name and length of a NetCDF dimension.
See also: netcdf.inqDimID.
dimid =
netcdf.inqDimID(ncid,dimname) ¶Return the id of a NetCDF dimension.
See also: netcdf.inqDim.
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).
See also: netcdf.inqDim.
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"
grp_ncid =
netcdf.inqGrpFullNcid(ncid,name) ¶Return the group id based on the full group name.
See also: netcdf.inqGrpName.
name =
netcdf.inqGrpName(ncid) ¶Return group name in a NetCDF file.
See also: netcdf.inqGrps.
name =
netcdf.inqGrpNameFull(ncid) ¶Return full name of group in NetCDF file.
See also: netcdf.inqGrpName.
parent_ncid =
netcdf.inqGrpParent(ncid) ¶Return id of the parent group
See also: netcdf.inqGrpName.
ncids =
netcdf.inqGrps(ncid) ¶Return all groups ids in a NetCDF file.
See also: netcdf.inqGrps.
vers =
netcdf.inqLibVers() ¶Returns the version of the NetCDF library.
grp_ncid =
netcdf.inqNcid(ncid,name) ¶Return group id based on its name
See also: netcdf.inqGrpFullNcid.
unlimdimids =
netcdf.inqUnlimDims(ncid) ¶Return the id of all unlimited dimensions of the NetCDF file ncid.
[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.
[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.
See also: netcdf.inqVarID,netcdf.getConstant.
[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.
[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).
[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.
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".
varid =
netcdf.inqVarID (ncid,name)
¶Return the id of a variable based on its name.
See also: netcdf.defVar,netcdf.inqVarIDs.
varids =
netcdf.inqVarID (ncid)
¶Return all variable ids. This functions returns all variable ids in a NetCDF file or NetCDF group.
See also: netcdf.inqVarID.
[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.
ncid =
netcdf.open(filename,mode) ¶Opens the file named filename in the mode mode.
(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").
See also: netcdf.getAtt.
(ncid,varid,data)
¶(ncid,varid,start,data)
¶(ncid,varid,start,count,data)
¶(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.
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.
See also: netcdf.copyAtt,netcdf.getConstant.
Renames the dimension with the id dimid in the data set ncid. name is the new name of the dimension.
Renames the variable with the id varid in the data set ncid. name is the new name of the variable.
nelems, preemption)
¶Sets the default chunk cache settings in the HDF5 library. The settings applies to all files which are subsequently opened or created.
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".