Loading...
Searching...
No Matches
dattput.c File Reference

Functions to write attributes. More...

`#include "ncdispatch.h"`
Include dependency graph for dattput.c:

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)
| Write an attribute of any type.
int | nc_put_att_double (int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *value)
| Write an attribute of type double.
int | nc_put_att_float (int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *value)
| Write an attribute of type float.
int | nc_put_att_int (int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *value)
| Write an attribute of type int.
int | nc_put_att_long (int ncid, int varid, const char *name, nc_type xtype, size_t len, const long *value)
| Write an attribute of type long.
int | nc_put_att_longlong (int ncid, int varid, const char *name, nc_type xtype, size_t len, const long long *value)
| Write an attribute of type long long.
int | nc_put_att_schar (int ncid, int varid, const char *name, nc_type xtype, size_t len, const signed char *value)
| Write an attribute of type signed char.
int | nc_put_att_short (int ncid, int varid, const char *name, nc_type xtype, size_t len, const short *value)
| Write an attribute of type short.
int | nc_put_att_string (int ncid, int varid, const char *name, size_t len, const char **value)
| Write a string attribute.
int | nc_put_att_text (int ncid, int varid, const char *name, size_t len, const char *value)
| Write a text attribute.
int | nc_put_att_ubyte (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned char *value)
| Write an attribute of type unsigned char.
int | nc_put_att_uchar (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned char *value)
| Write an attribute of type unsigned char.
int | nc_put_att_uint (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned int *value)
| Write an attribute of type unsigned int.
int | nc_put_att_ulonglong (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned long long *value)
| Write an attribute of type unsigned long long.
int | nc_put_att_ushort (int ncid, int varid, const char *name, nc_type xtype, size_t len, const unsigned short *value)
| Write an attribute of type unsigned short.

## Detailed Description

Functions to write attributes.

These functions write attributes.

Definition in file dattput.c.