Compound data types can be defined for netCDF-4/HDF5 format files. A compound datatype is similar to a struct in C and contains a collection of one or more atomic or user-defined types. The netCDF-4 compound data must comply with the properties and constraints of the HDF5 compound data type in terms of which it is implemented.
In summary these are:
Currently there is an HDF5 restriction on total size of a compound type to not larger than 2^16 = 65536 bytes. Attempts to exceed this limit result in an NC_EHDFERR error.
Compound types are not supported in classic or 64-bit offset format files.
To write data in a compound type, first use nc_def_compound to create the type, multiple calls to nc_insert_compound to add to the compound type, and then write data with the appropriate nc_put_var1, nc_put_vara, nc_put_vars, or nc_put_varm call.
To read data written in a compound type, you must know its structure. Use the nc_inq_compound functions to learn about the compound type.