Go to the previous, next section.
Variables for a netCDF file are defined when the file is created, while the
netCDF file is in define mode. Other variables may be added later
by reentering define mode. A netCDF variable has a name, a type, and a
shape, which are specified when it is defined. A variable may also have
values, which are established later in data mode.
Ordinarily, the name, type, and shape are fixed when the variable is
first defined. The name may be changed, but the type and shape of a
variable cannot be changed. However, a variable defined in terms of
the unlimited dimension can grow without bound in that dimension.
A netCDF variable is referred to by a small integer called a variable
ID. Attributes may be associated with a variable to specify such
properties as units, fill values, maximum and minimum valid values,
scaling factors, and offsets.
Operations supported on variables are:
-
Create a variable, given its name, data type, and shape.
-
Get a variable ID from its name.
-
Get a variable's name, data type, shape, and number of attributes from its ID.
-
Put a data value into a variable, given variable ID, indices, and value.
-
Put a hyperslab of values into a variable, given variable ID, corner
indices, edge lengths, and a block of values.
-
Put a generalized hyperslab of values into a variable, given variable ID,
corner indices, edge lengths, stride vector, index mapping vector,
and a block of values.
-
Put values into record variables, given record number and pointers to
blocks of values.
-
Get a data value from a variable, given variable ID and indices.
-
Get a hyperslab of values from a variable, given variable ID, corner
indices, and edge lengths.
-
Get a generalized hyperslab of values from a variable, given variable ID,
corner indices, edge lengths, stride vector, and index mapping vector.
-
Get values from record variables, given record number and pointers to
where the data should be stored for each record variable.
-
Rename a variable.
-
Get number of bytes for a given data type.
-
Get the number of record variables, their IDs, and their record sizes.
Go to the previous, next section.