.. highlightlang:: us .. index:: nc_attput .. _nc_attput: nc_attput ========= .. us.tag nc_attput ENGLISH NC_Att :ref:`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. .. function:: r = nc_attput(ncid, varid, ssName, nDataType, values) r = nc_attput(ncid, varid, ssName, nDataType, values, bOverwrite) .. us.return **Return Value** *r* is -1, if an error occurred. .. us.params **Parameters** .. uparam:: ncid Identifies the netCDF file. .. uparam:: 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. .. uparam:: 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. .. uparam:: nDataType *nDataType* is the data type of the attribute. The valid netCDF data types are: .. list-table:: :header-rows: 1 * - 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 .. uparam:: values *values* is the data value of the appropriate type. *values* can be a column or row vector. .. uparam:: 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. .. us.comment **Comment** File must be in definition mode (see:ref:`nc_redef`). .. seealso:: :ref:`overview-netcdf-files`, :ref:`nc_create`, :ref:`nc_attget` :sub:`id-550528`