Next: , Previous: , Up: Dimensions   [Index]


3.1 Dimensions Introduction

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 length. At most one dimension in a netCDF file can have the unlimited length, which means variables using this dimension can grow along this dimension.

There is a suggested limit (1024) to the number of dimensions that can be defined in a single netCDF file. The limit is the value of the predefined macro NC_MAX_DIMS. The purpose of the limit is to make writing generic applications simpler. They need only provide an array of NC_MAX_DIMS dimensions to handle any netCDF file. The implementation of the PnetCDF library does not enforce this advisory maximum, so it is possible to use more dimensions, if necessary, but netCDF utilities that assume the advisory maximums may not be able to handle the resulting netCDF files.

Ordinarily, the name and length of a dimension are fixed when the dimension is first defined. The name may be changed later, but the length of a dimension (other than the unlimited dimension) cannot be changed without copying all the data to a new netCDF file with a redefined dimension length.

Dimension lengths in the C interface are type MPI_Offset rather than type size_t as defined in netCDF-3. The original note from netCDF-3 is "Dimension lengths in the C interface are type size_t 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 type. If dimension lengths were type int instead, it would not be possible to access data from variables with a dimension length greater than a 16-bit int can accommodate."

A netCDF dimension in an opened netCDF file is referred to by a small integer called a dimension ID. In the C interface, dimension IDs are 0, 1, 2, ..., in the order in which the dimensions were defined.

Operations supported on dimensions are:


Next: , Previous: , Up: Dimensions   [Index]