Next: , Previous: NF_DEF_VAR_ENDIAN, Up: Variables


6.16 Learn About Endian Parameters for a Variable: NF_INQ_VAR_ENDIAN

The function NF_INQ_VAR_ENDIAN returns the endianness settings for a variable in a netCDF-4 file.

Usage

     NF_INQ_VAR_ENDIAN(INTEGER NCID, INTEGER VARID, INTEGER ENDIAN)
NCID
NetCDF ID, from a previous call to NF_OPEN or NF_CREATE.
VARID
Variable ID.
ENDIAN
NF_INQ_VAR_ENDIAN will set this to NF_ENDIAN_LITTLE if this variable is stored in little-endian format, NF_ENDIAN_BIG if it is stored in big-endian format, and NF_ENDIAN_NATIVE if the endianness is not set, and the variable is not created yet.

Errors

NF_INQ_VAR_ENDIAN returns the value NF_NOERR if no errors occurred. Otherwise, the returned status indicates an error.

Possible return codes include:

NF_NOERR
No error.
NF_BADID
Bad ncid.
NF_ENOTNC4
Not a netCDF-4 file.
NF_ENOTVAR
Can't find this variable.

Example

In this example from nf_test/ftst_vars.F, the endianness of a variable is checked to make sure it is NF_ENDIAN_BIG.

           retval = nf_inq_var_endian(ncid, varid, endianness)
           if (retval .ne. nf_noerr) call handle_err(retval)
           if (endianness .ne. NF_ENDIAN_BIG) stop 2