NetCDF  4.8.1
dattput.c File Reference
#include "ncdispatch.h"

Go to the source code of this file.

Functions

Writing Attributes

Functions to write attributes.

For netCDF classic formats, attributes are defined when the dataset is first created, while the netCDF dataset is in define mode. Additional attributes may be added later by reentering define mode. For netCDF-4/HDF5 netCDF files, attributes may be defined at any time.

In classic format files, the data type, length, and value of an attribute may be changed even when in data mode, as long as the changed attribute requires no more space than the attribute as originally defined. In netCDF-4/HDF5 files, attribute name, length, and value may be changed at any time.

Attribute data conversion automatically takes place when the type of the data does not match the xtype argument. All attribute data values are converted to xtype before being written to the file.

If writing a new attribute, or if the space required to store the attribute is greater than before, the netCDF dataset must be in define mode for classic formats (or netCDF-4/HDF5 with NC_CLASSIC_MODEL).

Note
With netCDF-4 files, nc_put_att will notice if you are writing a _FillValue attribute, and will tell the HDF5 layer to use the specified fill value for that variable. With either classic or netCDF-4 files, a _FillValue attribute will be checked for validity, to make sure it has only one value and that its type matches the type of the associated variable.
int nc_put_att (int ncid, int varid, const char *name, nc_type xtype, size_t len, const void *value)
 
int nc_put_att_double (int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *value)
 
int nc_put_att_float (int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *value)
 
int nc_put_att_int (int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *value)
 
int nc_put_att_long (int ncid, int varid, const char *name, nc_type xtype, size_t len, const long *value)
 
int nc_put_att_longlong (int ncid, int varid, const char *name, nc_type xtype, size_t len, const long long *value)
 
int nc_put_att_schar (int ncid, int varid, const char *name, nc_type xtype, size_t len, const signed char *value)
 
int nc_put_att_short (int ncid, int varid, const char *name, nc_type xtype, size_t len, const short *value)
 
int nc_put_att_string (int ncid, int varid, const char *name, size_t len, const char **value)
 
int nc_put_att_text (int ncid, int varid, const char *name, size_t len, const char *value)
 
int nc_put_att_ubyte (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned char *value)
 
int nc_put_att_uchar (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned char *value)
 
int nc_put_att_uint (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned int *value)
 
int nc_put_att_ulonglong (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned long long *value)
 
int nc_put_att_ushort (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned short *value)
 

Detailed Description

Functions to write attributes.

These functions write attributes.

Definition in file dattput.c.