5.7 Inserting a Field into a Compound Type: nc_insert_compound
Insert a named field into a compound type.
Usage
int nc_insert_compound(nc_type typeid, char *name, size_t offset,
nc_type field_typeid);
typeid- The typeid for this compound type, as returned by nc_def_compound, or
nc_inq_var.
name- The name of the new field.
offset- Offset in byte from the beginning of the compound type for this
field.
field_typeid- The type of the field to be inserted.
Errors
NC_NOERR- No error.
NC_EBADID- Bad group id.
NC_ENAMEINUSE- That name is in use. Field names must be unique within a compound type.
NC_EMAXNAME- Name exceed max length NC_MAX_NAME.
NC_EBADNAME- Name contains illegal characters.
NC_ENOTNC4- Attempting a netCDF-4 operation on a netCDF-3 file. NetCDF-4
operations can only be performed on files defined with a create mode
which includes flag NC_NETCDF4. (see nc_open).
NC_ESTRICTNC3- This file was created with the strict netcdf-3 flag, therefore
netcdf-4 operations are not allowed. (see nc_open).
NC_EHDFERR- An error was reported by the HDF5 layer.
NC_ENOTINDEFINE- Not in define mode.
Example