NetCDF has changed (and improved) over its lifetime. That means the user must have some understanding of netCDF versions.
To add to the confusion, there are versions for the APIs, and also for the data files that they produce. The API version is the version number that appears in the tarball file that is downloaded from the netCDF website. For example this document applied to API version 4.1.1.
The good news is that all netCDF files ever written can always be read by the latest netCDF release. That is, we guarantee backward data compatibility.
The default format is classic format. This is the original netCDF binary format - the format that the netCDF library has been using for almost 20 years, since its introduction with the first release of netCDF. No special flag is needed to create a file in classic format; it is the default.
Classic format has some strict limitations for files larger than two gigabytes. (see NetCDF Classic Format Limitations).
In December, 2004, version 3.6.0 of the netCDF library was released. It allows users to use a new version of the netCDF file format which greatly expands the sizes of variables and files which may be written.
The format which was introduced in 3.6.0 is called “64-bit Offset Format.”
Create files in this format by passing the 64-bit offset format flag to the create call (for example, in C, set the NC_64BIT_OFFSET flag when calling the function nc_create. (see nc_create).
64-bit offset is very useful for very large data files (over two gigabytes), however these files can only be shared with those who have upgraded to version 3.6.0 (or better) of netCDF. Earlier versions of netCDF will not be able to read these files.
With version 4.0 of netCDF, we introduce another new data format: netCDF-4/HDF5 format. This format is HDF5, with full use of the new dimension scales, creation ordering, and other features of HDF5 added in its version 1.8.0 release.
As with 64-bit offset, this format is turned on when the file is created. (For example, with the nf_netcdf4 flag in the nf_create function. see nf_create).
The classic format is the most portable. Classic format files can be read correctly by any version of netCDF. A netCDF-4 user can create a classic file, and share it with a user who has not upgraded netCDF since the version 2.3 in 1994.
64-bit offset format files can be read by any user who has at least version 3.6.0 of the netCDF API (released in Dec., 2004).
Users must have netCDF 4.0 to read netCDF-4/HDF5 files. However, netCDF-4 does produce backward compatible classic and 64-bit offset format files. That is, a netCDF-4.0 user can create a classic format file, and share it with researchers who are still using a old version of netCDF. Similarly a netCDF-4.0 user can read any existing netCDF data file, whatever version of netCDF was used to create it.
The original netCDF API represents a data model as well as a programming API. That is, the idea of variables, attributes, and the six data types (char, byte, short, integer, float, and double), comprises a model of how data may be stored.
The netCDF-4 release expands this model with groups, user-defined types, and new base types. New functions have been added to the APIs to accommodate these extensions, but once they are used, the file can no longer be output as a classic format file.
That is, once you use groups in your code, you can only produce netCDF-4/HDF5 files. If you try to change the format to classic, you will get an error when you attempt to use any of the group functions.
Since it is convenient to be able to produce files of all formats from the same code (restricting oneself to the classic data model), a flag has been added which, when used in the creation of a netCDF-4/HDF5 file, will instruct the library to disallow the use of any advanced features in the file.
This is referred to as a “classic model” netCDF-4/HDF5 file.
To get a classic model file, use the classic model flag when creating the file. For example, in Fortran 77, use the nf_classic_model flag when calling nf_create (see nf_create).
For more information about format issues see The NetCDF Users Guide.