Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Next: , Previous: Enum Type, Up: Enum Type



5.8.1 Creating a Enum Type: NF_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 NF_INSERT_ENUM (see NF_INSERT_ENUM). Call NF_INSERT_ENUM once for each value you wish to make part of the enumeration.

Usage

     INTEGER FUNCTION NF_DEF_ENUM(INTEGER NCID, INTEGER BASE_TYPEID,
             CHARACTER*(*) NAME, INTEGER TYPEIDP)
NCID
The groupid where this compound type will be created.
BASE_TYPEID
The base integer type for this enum. Must be one of: NF_BYTE, NF_UBYTE, NF_SHORT, NF_USHORT, NF_INT, NF_UINT, NF_INT64, NF_UINT64.
NAME
The name of the new enum type.
TYPEIDP
The typeid of the new type will be placed here.

Errors

NF_NOERR
No error.
NF_EBADID
Bad group id.
NF_ENAMEINUSE
That name is in use. Compound type names must be unique in the data file.
NF_EMAXNAME
Name exceeds 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_EPERM
Attempt to write to a read-only file.
NF_ENOTINDEFINE
Not in define mode.

This example is from nf_test/ftst_vars3.F.

     C     Create the enum type.
           retval = nf_def_enum(ncid, NF_INT, enum_type_name, enum_typeid)
           if (retval .ne. nf_noerr) call handle_err(retval)
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690