Next: , Previous: , Up: Variables   [Index]


4.2 Language Types Corresponding to netCDF external data types

The following table gives the netCDF external data types defined in CDF-1 and CDF-2 and the corresponding type constants for defining variables in the C interface:

TypeC #defineBitsIntent of use
charNC_CHAR8text data
byteNC_BYTE81-byte integer*
shortNC_SHORT162-byte signed integer
intNC_INT324-byte signed integer
floatNC_FLOAT324-byte floating point number
doubleNC_DOUBLE648-byte real number in double precision

The first column gives the netCDF external data type, which is the same as the CDL data type. The next column gives the corresponding C preprocessor macro for use in PnetCDF functions (the preprocessor macros are defined in the netCDF C header-file pnetcdf.h). The third column gives the number of bits used in the external representation of values of the corresponding type.

* NC_BYTE is considered unsigned when calling from _uchar APIs and the file is in either CDF-1 or CDF-2 format. In all other cases, NC_BYTE is considered signed. For more information about this special treatment, see http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion

New data types supported in CDF-5 format

TypeC #defineBitsIntent of use
unsigned byteNC_UBYTE8unsigned 1-byte integer
unsigned shortNC_USHORT16unsigned 2-byte integer
unsigned intNC_UINT32unsigned 4-byte integer
long longNC_INT6464signed 8-byte integer
unsigned long longNC_UINT6464unsigned 8-byte integer

Next: , Previous: , Up: Variables   [Index]