NetCDF  4.8.1
User Defined Types

Compound Types

In netCDF-4 files it's possible to create a data type which corresponds to a C struct. These are known as “compound” types (following HDF5 nomenclature).

That is, a netCDF compound type is a data structure which contains an arbitrary collection of other data types, including other compound types.

To define a new compound type, use nc_def_compound(). Then call nc_insert_compound() for each type within the compound type.

Read and write arrays of compound data with the nc_get_vara() and nc_put_vara() functions. These functions were actually part of the netCDF-2 API, brought out of semi-retirement to handle user-defined types in netCDF-4.

Opaque Types

Store blobs of bits in opaque types. Create an opaque type with nc_def_opaque. Read and write them with nc_get_vara()/nc_put_vara().

Variable Length Arrays (VLEN)

Create a VLEN type to store variable length arrays of a known base type. Use nc_def_vlen() to define a VLEN type, read and write them with nc_get_vara()/nc_put_vara().