Variables hold data values. In the classic
netCDF data model, a variable can hold a multidimensional array of
values of the same type.
A variable has a name, type, shape, attributes, and values.
- In the classic data model, the type of a variable is the
external type of its data as represented on disk, one of
- char (text character)
- byte (8 bits)
- short (16 bits)
- int (32 bits)
- float (32 bits)
- double (64 bits)
- The shape of a variable is specified with a list of
- no dimensions: a scalar variable with only one value
- 1 dimension: a 1-D (vector) variable, such as time
- 2 dimensions: a 2-D (grid or matrix) variable, such as surface_pressure
- 3 dimensions: a 3-D variable, such as relative_humidity
- 4 dimensions: a 4-D variable, such as relative_humidity at a series of times
- A variable may have attributes to specify properties
such as units.
- The values of variables are the data in a netCDF file.
- A record variable is a variable that uses a record (or
unlimited) dimension. It can grow efficiently by having data added
along the record dimension.