Groups and Types in NetCDF-4
The enhanced netCDF-4 model provides groups to organize data, and introduces new primitive types and new user-defined types.
What are Groups?
NetCDF-4 files can organize variables, dimensions, and attributes in hierarchical groups.
CDL Example of Groups
This CDL example demonstrates one use of groups.
Possible Uses for Groups
Some possible uses for groups are suggested.
The String type can replace character arrays for most purposes.
Example Creating an Array of Strings
This C example writes an array of strings as an attribute.
Additional Numeric Types
New primitive types include 64-bit integers and unsigned integer types.
Using User Defined Types
User-defined types can be used to store N-dimensional arrays of structs, variable length arrays, enumerations, and opaque data ojects of known size.
Writing and Reading Data of User Defined Type
Use these functions to read or write data of user defined type.
Learning about User Defined Types
Inquiry functions in netCDF-4 allow users to learn about user-defined types when reading a file.
Introduction to Compound Types
Use compound types to bundle one or more named values, possible of different types, together into a single named unit.
Example with Compound Types in netCDF-4
An example use of compound types for observational data in netCDF-4.
The enumerated type can associate integer constant values with names.
Uses for Enumerations
What are the uses for enum data?
Enum CDL Example
A CDL example shows enumerations which classify cloud types.
Using the Opaque Type
The opaque type holds arrays of unknown contents, with known size.
A CDL example shows an opaque data type used for 11-byte raw sensor data records.
Variable-length types provide support for ragged arrays.
Example of Variable-Length Types
This examples shows a 1D VLEN array.
Using Variable Length Types
Memory for variable length array data is allocated by the library when they are read, and must be freed by the user.
Sea Sounding Example
The ncdump output shows a compound type that contains a variable-length member.