[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #UEC-670182]: Need to find information on the NetCDF data type constants

Hi Rachel,

> I am using matlab to read in NetCDF data and it is very important that I
> know what type of data type a particular variable is.  I use the following
> command:
> [varname, vartype, dimids, natts] = netcdf.inqVar(ncid,0)
> The 'vartype' variable gives me a number associated with a particular data
> type (integer, byte, double, etc) but I cannot find the information about
> which data types go along with which constant.

Assuming Matlab uses the same constants as the netCDF C library, then here 
are the types, from the the netCDF C library documentation:


They are also listed in the netcdf.h header file for the netCDF C library:

 *  The netcdf external data types
#define NC_NAT          0       /**< Not A Type */
#define NC_BYTE         1       /**< signed 1 byte integer */
#define NC_CHAR         2       /**< ISO/ASCII character */
#define NC_SHORT        3       /**< signed 2 byte integer */
#define NC_INT          4       /**< signed 4 byte integer */
#define NC_LONG         NC_INT  /**< deprecated, but required for backward 
compatibility. */
#define NC_FLOAT        5       /**< single precision floating point number */
#define NC_DOUBLE       6       /**< double precision floating point number */
#define NC_UBYTE        7       /**< unsigned 1 byte int */
#define NC_USHORT       8       /**< unsigned 2-byte int */
#define NC_UINT         9       /**< unsigned 4-byte int */
#define NC_INT64        10      /**< signed 8-byte int */
#define NC_UINT64       11      /**< unsigned 8-byte int */
#define NC_STRING       12      /**< string */

/* The following are use internally in support of user-defines
 * types. They are also the class returned by nc_inq_user_type. */
#define NC_VLEN         13      /**< vlen (variable-length) types */
#define NC_OPAQUE       14      /**< opaque types */
#define NC_ENUM         15      /**< enum types */
#define NC_COMPOUND     16      /**< compound types */


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: UEC-670182
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.