5.9.1 Creating a Enum Type: NF90_DEF_ENUM
Create an enum type. Provide an ncid, a name, and a base integer
type.
After calling this function, fill out the type with repeated calls to
NF90_INSERT_ENUM (see NF90_INSERT_ENUM). Call NF90_INSERT_ENUM once for
each value you wish to make part of the enumeration.
Usage
function nf90_def_enum(ncid, base_typeid, name, typeid)
integer, intent(in) :: ncid
integer, intent(in) :: base_typeid
character (len = *), intent(in) :: name
integer, intent(out) :: typeid
integer :: nf90_def_enum
NCID
- The groupid where this compound type will be created.
BASE_TYPEID
- The base integer type for this enum. Must be one of: NF90_BYTE,
NF90_UBYTE, NF90_SHORT, NF90_USHORT, NF90_INT, NF90_UINT, NF90_INT64, NF90_UINT64.
NAME
- The name of the new enum type.
TYPEIDP
- The typeid of the new type will be placed here.
Errors
NF90_NOERR
- No error.
NF90_EBADID
- Bad group id.
NF90_ENAMEINUSE
- That name is in use. Compound type names must be unique in the data
file.
NF90_EMAXNAME
- Name exceeds max length NF90_MAX_NAME.
NF90_EBADNAME
- Name contains illegal characters.
NF90_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 NF90_NETCDF4. (see NF90_OPEN).
NF90_ESTRICTNC3
- This file was created with the strict netcdf-3 flag, therefore
netcdf-4 operations are not allowed. (see NF90_OPEN).
NF90_EHDFERR
- An error was reported by the HDF5 layer.
NF90_EPERM
- Attempt to write to a read-only file.
NF90_ENOTINDEFINE
- Not in define mode.
Example