CODA netCDF Mapping Description

CODA provides access to netCDF by creating a view on the netCDF files using the CODA data types. Below we will describe how CODA maps the netCDF product structure to one that is based on the CODA data types.

NetCDF products are self describing products. This means that when a netCDF file is opened one can retrieve the product structure from the file itself. For this reason, CODA will not require fixed product format descriptions for netCDF files. What CODA will do is use the builtin CODA netCDF backend to retrieve the product format dynamically once a netCDF file is opened. Based on this format CODA will create, on the fly, a mapping of the netCDF product structure to one that is based on the CODA data types. Because of this approach CODA is able to provide you access to all netCDF files. In order to read data from netCDF files you can use the same CODA reading routines as you would have used for all other products.

netCDF files consist of Variables and Attributes. The concept of named dimensions of netCDF is not mapped to CODA.

Just as for HDF, names for variables and attributes can contain any kind of string and do not have to be unique. Since fieldnames in CODA have to be unique and have to be formatted as an identifier (i.e. no spaces and special characters may be used), CODA translates all object names it finds in the netCDF file to unique identifiers. This translation is the same translation as is used for HDF, so please look at the HDF4 mapping for an explanation of this mapping.

The root of a netCDF product is mapped to a record, with each netCDF variable being a field in this record. If the netCDF variable is a scalar (i.e. rank-0 dimension) then the field will also be a scalar, otherwise the record field will be an array of a basic type. If the variable is an array of characters (NC_CHAR), then CODA will use the last dimension as a string length indication (unless that dimension is the appendable dimension). So, a one-dimensional array of characters becomes a string scalar, and a two dimensional [3,12] array of characters becomes a one-dimensional [3] array of strings (of length 12).

Except for the character (NC_CHAR) which can become either char or string, CODA maps all netCDF basic types to the corresponding CODA basic types: NC_BYTE becomes int8, NC_SHORT becomes int16, NC_INT becomes int32, NC_FLOAT becomes float, and NC_DOUBLE becomes double.

The global attributes can be accessed via CODA as attributes of the root record. The attributes of a variable can be accessed as attributes of the base type (in case of scalar data) or as attributes of the array (for variables that have one or more dimensions). The same character to string mapping properties for variables also hold for attributes.

If a variable has a scale_factor and/or add_offset attribute CODA will use this to automatically convert any values that are read from the object (value_returned = value_read * scale_factor + add_offset). The application of this conversion can be enabled/disabled using the same global option that is used to turn on/off conversions for products that are described by CODA format definition files (this option is turned on by default).

If a variable has a missing_value and/or _FillValue attribute CODA will use this to automatically set the value to NaN (potentially upgrading the type to a double). The application of this conversion can be enabled/disabled as described above.