Next: , Previous: CDL Syntax, Up: NetCDF Utilities


5.2 CDL Data Types

The CDL primitive data types for the classic model are:

char
Characters.
byte
Eight-bit integers.
short
16-bit signed integers.
int
32-bit signed integers.
long
(Deprecated, synonymous with int)
float
IEEE single-precision floating point (32 bits).
real
(Synonymous with float).
double
IEEE double-precision floating point (64 bits).

NetCDF-4 supports the additional primitive types:

ubyte
Unsigned eight-bit integers.
ushort
Unsigned 16-bit integers.
uint
Unsigned 32-bit integers.
int64
64-bit singed integers.
uint64
Unsigned 64-bit singed integers.
string
Variable-length string of characters

Except for the added data-type byte, CDL supports the same primitive data types as C. For backward compatibility, in declarations primitive type names may be specified in either upper or lower case.

The byte type differs from the char type in that it is intended for numeric data, and the zero byte has no special significance, as it may for character data. The short type holds values between -32768 and 32767. The ushort type holds values between 0 and 65536. The int type can hold values between -2147483648 and 2147483647. The uint type holds values between 0 and 4294967296. The int64 type can hold values between -9223372036854775808 and 9223372036854775807. The uint64 type can hold values between 0 and 18446744073709551616.

The float type can hold values between about -3.4+38 and 3.4+38, with external representation as 32-bit IEEE normalized single-precision floating-point numbers. The double type can hold values between about -1.7+308 and 1.7+308, with external representation as 64-bit IEEE standard normalized double-precision, floating-point numbers. The string type holds variable length strings.