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: Compound Types, Up: Compound Types



5.5.1 Creating a Compound Type: NF90_DEF_COMPOUND

Create a compound type. Provide an ncid, a name, and a total size (in bytes) of one element of the completed compound type.

After calling this function, fill out the type with repeated calls to NF90_INSERT_COMPOUND (see NF90_INSERT_COMPOUND). Call NF90_INSERT_COMPOUND once for each field you wish to insert into the compound type.

Note that there does not seem to be a fully portable way to read such types into structures in Fortran 90 (and there are no structures in Fortran 77). Dozens of top-notch programmers are swarming over this problem in a sub-basement of Unidata's giant underground bunker in Wyoming.

Fortran users may use character buffers to read and write compound types. User are invited to try classic Fortran features such as the equivilence and the common block statment.

Usage

       function nf90_def_compound(ncid, size, name, typeid)
         integer, intent(in) :: ncid
         integer, intent(in) :: size
         character (len = *), intent(in) :: name
         integer, intent(out) :: typeid
         integer :: nf90_def_compound
NCID
The groupid where this compound type will be created.
SIZE
The size, in bytes, of the compound type.
NAME
The name of the new compound 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


       
 
 
  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