The CDL primitive data types for the classic model are:
NetCDF-4 supports the additional primitive types:
Except for the added numeric data-types byte and ubyte, CDL supports the same numeric 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. In the classic data model, byte data could be interpreted as either signed (-128 to 127) or unsigned (0 to 255). When reading byte data in a way that converts it into another numeric type, the default interpretation is signed. The netCDF-4 enhanced data model added an unsigned byte type.
The short type holds values between -32768 and
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.
A netCDF-4 string is a variable length array of Unicode http://unicode.org/ characters. When reading/writing a String to a netCDF file or other external representation, the characters are UTF-8 encoded http://en.wikipedia.org/wiki/UTF-8 (note that ASCII is a subset of UTF-8). Libraries may use different internal representations, for example the Java library uses UTF-16 encoding.
The netCDF char type contains uninterpreted characters, one character per byte. Typically these contain 7-bit ASCII characters, but the character encoding is application specific. For this reason, applications writing data using the enhanced data model are encouraged to use the netCDF-4 string data type in preference to the char data type. Applications writing string data using the char data type are encouraged to add the special variable attribute "_Encoding" with a value that the netCDF libraries recognize. Currently those valid values are "UTF-8" or "ASCII", case insensitive.