5.6.2 Inserting a Field into a Compound Type: NF_INSERT_COMPOUND
Insert a named field into a compound type.
Usage
INTEGER FUNTION NF_INSERT_COMPOUND(INTEGER TYPEID, CHARACTER*(*) NAME, INTEGER OFFSET,
INTEGER FIELD_TYPEID)
TYPEID
- The typeid for this compound type, as returned by NF_DEF_COMPOUND, or
NF_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
NF_NOERR
- No error.
NF_EBADID
- Bad group id.
NF_ENAMEINUSE
- That name is in use. Field names must be unique within a compound type.
NF_EMAXNAME
- Name exceed max length NF_MAX_NAME.
NF_EBADNAME
- Name contains illegal characters.
NF_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 NF_NETCDF4. (see NF_OPEN).
NF_ESTRICTNC3
- This file was created with the strict netcdf-3 flag, therefore
netcdf-4 operations are not allowed. (see NF_OPEN).
NF_EHDFERR
- An error was reported by the HDF5 layer.
NF_ENOTINDEFINE
- Not in define mode.
Example
This example is from nf_test/ftst_types.F.
C Define a compound type.
retval = nf_def_compound(ncid, WIND_T_SIZE, type_name,
& wind_typeid)
if (retval .ne. nf_noerr) call handle_err(retval)
retval = nf_insert_compound(ncid, wind_typeid, u_name, 0, NF_INT)
if (retval .ne. nf_noerr) call handle_err(retval)
retval = nf_insert_compound(ncid, wind_typeid, v_name, 4, NF_INT)
if (retval .ne. nf_noerr) call handle_err(retval)