Next: , Previous: NF90_INSERT_ARRAY_COMPOUND, Up: Compound Types


5.6.4 Learn About a Compound Type: NF90_INQ_COMPOUND

Get the number of fields, length in bytes, and name of a compound type.

In addtion to the NF90_INQ_COMPOUND function, three additional functions are provided which get only the name, size, and number of fields.

Usage

       function nf90_inq_compound(ncid, xtype, name, size, nfields)
         integer, intent(in) :: ncid
         integer, intent(in) :: xtype
         character (len = *), intent(out) :: name
         integer, intent(out) :: size
         integer, intent(out) :: nfields
         integer :: nf90_inq_compound
     
       function nf90_inq_compound_name(ncid, xtype, name)
         integer, intent(in) :: ncid
         integer, intent(in) :: xtype
         character (len = *), intent(out) :: name
         integer :: nf90_inq_compound_name
     
       function nf90_inq_compound_size(ncid, xtype, size)
         integer, intent(in) :: ncid
         integer, intent(in) :: xtype
         integer, intent(out) :: size
         integer :: nf90_inq_compound_size
     
       function nf90_inq_compound_nfields(ncid, xtype, nfields)
         integer, intent(in) :: ncid
         integer, intent(in) :: xtype
         integer, intent(out) :: nfields
         integer :: nf90_inq_compound_nfields
NCID
The ID of any group in the file that contains the compound type.
XTYPE
The typeid for this compound type, as returned by NF90_DEF_COMPOUND, or NF90_INQ_VAR.
NAME
Character array which will get the name of the compound type. It will have a maximum length of NF90_MAX_NAME.
SIZEP
The size of the compound type in bytes will be put here.
NFIELDSP
The number of fields in the compound type will be placed here.

Return Codes

NF90_NOERR
No error.
NF90_EBADID
Couldn't find this ncid.
NF90_ENOTNC4
Not a netCDF-4/HDF5 file.
NF90_ESTRICTNC3
A netCDF-4/HDF5 file, but with CLASSIC_MODEL. No user defined types are allowed in the classic model.
NF90_EBADTYPE
This type not a compound type.
NF90_EBADTYPEID
Bad type id.
NF90_EHDFERR
An error was reported by the HDF5 layer.

Example