Fundamentals of netCDF data storage

The storage of netCDF data

The data in a netCDF file is stored in the form of arrays. For example, temperature varying over time at a location is stored as a one-dimensional array. Temperature over an area for a given time is stored as a two-dimensional array.

Three-dimensional (3D) data, like temperature over an area varying with time, or four-dimensional (4D) data, like temperature over an area varying with time and altitude, is stored as a series of two-dimensional arrays.

Three-dimensional data: Data over an area varying with time
Three-dimensional data: Data over an area varying with time
Four-dimensional data: Data over an area varying with time and altitude
Four-dimensional data: Data over an area varying with time and altitude

Basic components of a netCDF file

A netCDF file contains dimensions, variables, and attributes. These components are used together to capture the meaning of data and relations among data fields in an array-oriented dataset. The following figure shows the structure of a netCDF file using the CDL (network Common Data form Language) notation. CDL is the ASCII format used to describe the content of a netCDF file.

CDL File
CDL File example

The names of dimensions, variables, and attributes consist of arbitrary sequences of alphanumeric characters, including an underscore and hyphen, beginning with a letter or underscore. However, names starting with an underscore are reserved for system use. Case is significant in netCDF names.

Dimensions

A netCDF dimension has both a name and a size. A dimension size is an arbitrary positive integer. Only one dimension in a netCDF file can have the size UNLIMITED. Such a dimension is the unlimited dimension or record dimension. A variable with an unlimited dimension can grow to any length along that dimension.

A dimension can be used to represent a real physical dimension, for example, time, latitude, longitude, or height. A dimension can also be used to index other quantities, for example, station or model run number. It is possible to use the same dimension more than once in specifying a variable shape.

Variables

A variable represents an array of values of the same type. Variables are used to store the bulk of the data in a netCDF file. A variable has a name, data type, and shape described by its list of dimensions specified when the variable is created. The number of dimensions is the rank (also known as dimensionality). A scalar variable has a rank of 0, a vector has a rank of 1, and a matrix has a rank of 2. A variable can also have associated attributes that can be added, deleted, or changed after the variable is created.

Coordinate variables

A one-dimensional variable with the same name as a dimension is a coordinate variable. It is associated with a dimension of one or more data variables and typically defines a physical coordinate corresponding to that dimension.

Coordinate variables have no special meaning to the netCDF library. However, the software using this library should handle coordinate variables in a specialized way.

Attributes

NetCDF attributes are used to store ancillary data or metadata. Most attributes provide information about a specific variable. These attributes are identified by the name of the variable together with the name of the attribute.

Attributes that provide information about the entire netCDF file are global attributes. These attributes are identified by the attribute name together with a blank variable name (in CDL) or a special null variable ID (in C or Fortran).

Conventions

The conventions define metadata that provides a definitive description of the data in each variable and their spatial and temporal properties. A convention helps users of data from different sources to decide which quantities are comparable. The name of the convention is presented as a global attribute in a netCDF file.

Learn more about netCDF conventions

Currently, the Climate and Forecast (CF) and Cooperative Ocean/Atmosphere Research Data Service (COARDS) conventions are supported in ArcGIS.

Note:

NetCDF files created using other conventions may also work directly with ArcGIS. Consult the specifications for those conventions for more details.