The NCDF_ATTPUT procedure creates an attribute in a NetCDF file. If the attribute is new, or if the space required to store the attribute is greater than before, the NetCDF file must be in define mode.
NCDF_ATTPUT, Cdfid [, Varid] , Name , Value [, /GLOBAL] [, LENGTH=value] [, /BYTE | , /CHAR | , /DOUBLE | , /FLOAT | , /LONG | , /SHORT] [, /STRING] [, /UBYTE] [, /UINT64] [, /ULONG] [, / USHORT]
The NetCDF ID, returned from a previous call to NCDF_OPEN, NCDF_CREATE, or NCDF_GROUPDEF.
The NetCDF variable ID, returned from a previous call to NCDF_VARDEF or NCDF_VARID, or the name of the variable. If the GLOBAL keyword is set, this argument must be omitted.
A scalar string containing the attribute name.
Note: The Name string may contain only alphanumeric characters and the - , _ , and . characters.
An expression containing the data to be written. Although this procedure checks that there are a sufficient number of bytes of data, the data type is not checked or altered.
Set this keyword to create a global attribute.
Use this keyword to override the default length (the whole value). Set this keyword to a value less than or equal to the number of elements in Value. For example:
ATTR_ID = NCDF_ATTPUT(CDFID, VARID, 'Attr1', $
INDGEN(10), LENGTH=5
writes Attr1 as [0,1,2,3,4].
The following keywords specify a non-default data type for the variable. By default, NCDF_ATTPUT chooses one based upon the type of data. If a data type flag is specified, the data supplied in Value is converted to that data type before being written to the file. Only one of these keywords can be used in a single call to NCDF_ATTPUT.
Set this keyword to indicate that the data is composed of bytes.
Set this keyword to indicate that the data is composed of bytes (assumed to be ASCII).
Set this keyword to indicate that the data is composed of 8-byte floating point numbers (doubles).
Set this keyword to indicate that the data is composed of 4-byte floating point numbers (floats).
Set this keyword to indicate that the data is composed of 4-byte integers (longs).
Set this keyword to indicate that the data is composed of 2-byte integers.
Set this keyword to indicate that the data is composed of string.
Set this keyword to indicate that the data is composed of unsigned bytes.
Set this keyword to indicate that the data is composed of unsigned eight-byte integers.
Set this keyword to indicate that the data is composed of unsigned four-byte integers.
Set this keyword to indicate that the data is composed of unsigned two-byte integers.
NCDF_ATTPUT, cdfid, /GLOBAL, "Title", "My Favorite Data File"
NCDF_ATTPUT, cdfid, "data", "scale_factor", 12.5D
Pre 4.0 |
Introduced |
8.1 | Added STRING, UBYTE, UINT64, ULONG, and USHORT keywords |