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: NF90_INQ_VAR_FLETCHER32, Up: Variables


6.12 Define Endianness of a Variable: NF90_DEF_VAR_ENDIAN

The function NF90_DEF_VAR_ENDIAN sets the endianness for a variable in a netCDF-4 file.

This function must be called after the variable is defined, but before NF90_ENDDEF is called.

By default, netCDF-4 variables are in native endianness. That is, they are big-endian on a big-endian machine, and little-endian on a little endian machine.

In some cases a user might wish to change from native endianness to either big or little-endianness. This function allows them to do that.

Usage

       function nf90_def_var_endian(ncid, varid, endian)
         integer, intent(in) :: ncid
         integer, intent(in) :: varid
         integer, intent(in) :: endian
         integer :: nf90_def_var_endian
NCIDi
NetCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.
VARID
Variable ID.
ENDIAN
Set to NF90_ENDIAN_NATIVE for native endianness. (This is the default). Set to NF90_ENDIAN_LITTLE for little endian, or NF90_ENDIAN_BIG for big endian.

Errors

NF90_DEF_VAR_ENDIAN returns the value NF90_NOERR if no errors occurred. Otherwise, the returned status indicates an error.

Possible return codes include:

NF90_NOERR
No error.
NF90_BADID
Bad ncid.
NF90_ENOTNC4
Not a netCDF-4 file.
NF90_ENOTVAR
Can't find this variable.
NF90_ELATEDEF
This variable has already been the subject of a NF90_ENDDEF call. In netCDF-4 files NF90_ENDDEF will be called automatically for any data read or write. Once enddef has been called, it is impossible to set the endianness of a variable.
NF90_ENOTINDEFINE
Not in define mode. This is returned for netCDF classic or 64-bit offset files, or for netCDF-4 files, when they were been created with NF90_STRICT_NC3 flag, and the file is not in define mode. (see NF90_CREATE).
NF90_EPERM
Attempt to create object in read-only file.

Example


       
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community 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