Go to the previous, next section.

Dimensions

Dimensions for a netCDF file are defined when it is created, while the netCDF file is in define mode. Additional dimensions may be added later by reentering define mode. A netCDF dimension has a name and a size. At most one dimension in a netCDF file can have the NC_UNLIMITED size, which means a variable using this dimension can grow to any length (like a record number in a file).

There is a suggested limit (currently 32) to the number of dimensions that can be defined in a single netCDF file. The limit is the value of the predefined macro MAX_NC_DIMS (MAXNCDIM for FORTRAN). The purpose of the limit is to make writing generic applications simpler. They need only provide an array of MAX_NC_DIMS dimensions to handle any netCDF file. The implementation of the netCDF library does not enforce this advisory maximium, so it is possible to use more dimensions, if necessary; just don't expect generic applications or netCDF utilities to be able to handle the resulting netCDF files.

Ordinarily, the name and size of a dimension are fixed when the dimension is first defined. The name may be changed later, but the size of a dimension cannot be changed without copying the netCDF to a new netCDF with a redefined dimension size.

Dimension sizes in the C interface are type long rather than type int to make it possible to access all the data in a netCDF file on a platform that only supports a 16-bit int data types, for example MSDOS. If dimension sizes were type int instead, it would not be possible to access data from variables with a dimension size greater than a 16-bit int can accommodate.

Operations supported on dimensions are:

Go to the previous, next section.