Go to the previous, next section.

Data Structures

The only kind of data structure directly supported by the netCDF abstraction is a collection of named scalar and multidimensional variables with attached vector attributes. NetCDF is not particularly well-suited for storing linked lists, trees, sparse matrices, or other kinds of data structures requiring pointers. The underlying XDR library on which netCDF is implemented is quite suitable for storing and retrieving arbitrary data structures in a network-transparent way, but such structures will no longer be self-describing unless you encode information about the structure with the data. It is possible to build other kinds of data structures from sets of multidimensional arrays by adopting various conventions regarding the use of data in one array as pointers into another array. The netCDF library won't provide much help or hindrance with constructing such data structures, but netCDF provides the mechanisms with which such conventions can be designed.

For example, it is possible to use a variable attribute to name an associated index variable: the variable attribute `array_index_var = "v_index"' might provide the name of another associated variable to be used as an index for fast retrieval by value in the variable to which the attribute is attached.

As another example, netCDF variables may be grouped within a netCDF file by defining attributes that list the names of the variables in each group, separated by a conventional delimiter such as a space or comma. A convention can be adopted to use particular sorts of attribute names for such groupings, so that an arbitrary number of named groups of variables can be supported. If needed, a particular conventional attribute for each variable might list the names of the groups of which it is a member. Use of attributes or variables that refer to other attributes or variables provides a flexible mechanism for representing complex structures in netCDF files.

Go to the previous, next section.