Next: , Previous: NF_DEF_ENUM, Up: Enum Type


5.9.2 Inserting a Field into a Enum Type: NF_INSERT_ENUM

Insert a named member into a enum type.

Usage

     INTEGER FUNCTION NF_INSERT_ENUM(INTEGER NCID, INTEGER XTYPE,
             CHARACTER IDENTIFIER, INTEGER VALUE)
NCID
The ncid of the group which contains the type.
TYPEID
The typeid for this enum type, as returned by nf_def_enum, or nf_inq_var.
IDENTIFIER
The identifier of the new member.
VALUE
The value that is to be associated with this member.

Errors

NF_NOERR
No error.
NF_EBADID
Bad group id.
NF_ENAMEINUSE
That name is in use. Field names must be unique within a enum 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_vars3.F.

           one = 1
           zero = 0
           retval = nf_insert_enum(ncid, enum_typeid, zero_name, zero)
           if (retval .ne. nf_noerr) call handle_err(retval)
           retval = nf_insert_enum(ncid, enum_typeid, one_name, one)
           if (retval .ne. nf_noerr) call handle_err(retval)