Previous: NF_INQ_COMPOUND, Up: Compound Types


5.6.5 Learn About a Field of a Compound Type: NF_INQ_COMPOUND_FIELD

Get information about one of the fields of a compound type.

Usage

     INTEGER FUNCTION NF_INQ_COMPOUND_FIELD(INTEGER NCID, INTEGER XTYPE,
             INTEGER FIELDID, CHARACTER*(*) NAME, INTEGER OFFSETP,
             INTEGER FIELD_TYPEIDP, INTEGER NDIMSP, INTEGER DIM_SIZESP)
     
     INTEGER FUNCTION NF_INQ_COMPOUND_FIELDNAME(INTEGER TYPEID,
             INTEGER FIELDID, CHARACTER*(*) NAME)
     
     INTEGER FUNCTION NF_INQ_COMPOUND_FIELDINDEX(INTEGER TYPEID,
             CHARACTER*(*) NAME, INTEGER FIELDIDP)
     
     INTEGER FUNCTION NF_INQ_COMPOUND_FIELDOFFSET(INTEGER TYPEID,
             INTEGER FIELDID, INTEGER OFFSETP)
     
     INTEGER FUNCTION NF_INQ_COMPOUND_FIELDTYPE(INTEGER TYPEID,
             INTEGER FIELDID, INTEGER FIELD_TYPEIDP)
     
     INTEGER FUNCTION NF_INQ_COMPOUND_FIELDNDIMS(INTEGER NCID,
             INTEGER XTYPE, INTEGER FIELDID, INTEGER NDIMSP)
     
     INTEGER FUNCTION NF_INQ_COMPOUND_FIELDDIM_SIZES(INTEGER NCID,
             INTEGER XTYPE, INTEGER FIELDID, INTEGER DIM_SIZES)
NCID
The groupid where this compound type exists.
XTYPE
The typeid for this compound type, as returned by NF_DEF_COMPOUND, or NF_INQ_VAR.
FIELDID
A one-based index number specifying a field in the compound type.
NAME
A character array which will get the name of the field. The name will be NF_MAX_NAME characters, at most.
OFFSETP
An integer which will get the offset of the field.
FIELD_TYPEID
An integer which will get the typeid of the field.
NDIMSP
An integer which will get the number of dimensions of the field.
DIM_SIZESP
An integer array which will get the dimension sizes of the field.

Errors

NF_NOERR
No error.
NF_EBADTYPEID
Bad type id.
NF_EHDFERR
An error was reported by the HDF5 layer.

Example

This example is from nf_test/fst_types.F.

     C     Check the first field of the compound type.
           retval = nf_inq_compound_field(ncid, typeids(1), 1, name_in,
          &     offset_in, field_typeid_in, ndims_in, dim_sizes_in)
           if (retval .ne. nf_noerr) call handle_err(retval)
           if (name_in(1:len(u_name)) .ne. u_name .or. offset_in .ne. 0 .or.
          &     field_typeid_in .ne. NF_INT .or. ndims_in .ne. 0) stop 2
           retval = nf_inq_compound_fieldname(ncid, typeids(1), 1, name_in)
           if (retval .ne. nf_noerr) call handle_err(retval)
           if (name_in(1:len(u_name)) .ne. u_name) stop 2
           retval = nf_inq_compound_fieldoffset(ncid, typeids(1), 1,
          &     offset_in)
           if (retval .ne. nf_noerr) call handle_err(retval)
           if (offset_in .ne. 0) stop 2
           retval = nf_inq_compound_fieldtype(ncid, typeids(1), 1,
          &     field_typeid_in)
           if (retval .ne. nf_noerr) call handle_err(retval)
           if (field_typeid_in .ne. NF_INT) stop 2
           retval = nf_inq_compound_fieldndims(ncid, typeids(1), 1,
          &     ndims_in)
           if (retval .ne. nf_noerr) call handle_err(retval)
           if (ndims_in .ne. 0) stop 2