nc_attputΒΆ
nc_attput changes a variable attribute or global attribute of an open nc file. If the attribute is new, or if the space required to store the attribute is greater than before, the nc file must be in define mode.
-
r = nc_attput(ncid, varid, ssName, nDataType, values)
-
r = nc_attput(ncid, varid, ssName, nDataType, values, bOverwrite)
Return Value
r is -1, if an error occurred.
Parameters
-
ncid
Identifies the netCDF file.
-
varid
varid is the variable ID of the variable to which the attribute will be assigned or -1 for a global attribute. The variable ID starts with 0.
-
ssName
ssName is the name of the attribute. It must begin with an alphabetic character, followed by zero or more alphanumeric characters including the underscore (
_
). Case is significant.
-
nDataType
nDataType is the data type of the attribute. The valid netCDF data types are:
Value Meaning NC_BYTE Eight-bit data NC_CHAR for representing text strings as arrays of ASCII characters NC_SHORT 16-Bit integers NC_LONG 32-Bit integers NC_FLOAT 32-Bit IEEE floating-point NC_DOUBLE 64-Bit IEEE floating-point
-
values
values is the data value of the appropriate type. values can be a column or row vector.
-
bOverwrite
If bOverwrite is set to TRUE (1) the attribute value will be overwritten. If bOverwrite is set to FALSE (0), a new attribute will be created (Default). A unique name will be created by adding a number to the attribute name.
Comment
File must be in definition mode (see:ref:nc_redef).
See also
id-550528