class cf.CellMeasure(properties={}, attributes=None, data=None, source=None, copy=True)[source]

Bases: cf.variable.Variable

A CF cell measure construct.

A cell measure construct provides information that is needed about the size or shape of the cells and that depends on a subset of the domain axis constructs. Cell measure constructs have to be used when the size or shape of the cells cannot be deduced from the dimension or auxiliary coordinate constructs without special knowledge that a generic application cannot be expected to have. The cell measure construct consists of a numeric array of the metric data which spans a subset of the domain axis constructs, and properties to describe the data (in the same sense as for the field construct). The properties must contain a measure property, which indicates which metric of the space it supplies e.g. cell horizontal areas, and a units property consistent with the measure property e.g. square metres. It is assumed that the metric does not depend on axes of the domain which are not spanned by the array, along which the values are implicitly propagated. CF-netCDF cell measure variables correspond to cell measure constructs.


Attribute Type Description
measure str The spatial measure being represented, either 'area' or 'volume'.


properties: dict, optional

Initialize CF properties from the dictionary’s key/value pairs.

attributes: dict, optional

Provide attributes from the dictionary’s key/value pairs.

data: cf.Data, optional

Provide a data array.

source: cf.{+Variable}, optional

Take the attributes, CF properties and data array from the source {+variable}. Any attributes, CF properties or data array specified with other parameters are set after initialisation from the source {+variable}.

copy: bool, optional

If False then do not deep copy arguments prior to initialization. By default arguments are deep copied.

CF properties

add_offset The add_offset CF property.
calendar The calendar CF property.
comment The comment CF property.
_FillValue The _FillValue CF property.
history The history CF property.
leap_month The leap_month CF property.
leap_year The leap_year CF property.
long_name The long_name CF property.
missing_value The missing_value CF property.
month_lengths The month_lengths CF property.
scale_factor The scale_factor CF property.
standard_name The standard_name CF property.
units The units CF property.
valid_max The valid_max CF property.
valid_min The valid_min CF property.
valid_range The valid_range CF property.


array A numpy array deep copy of the data array.
binary_mask A binary (0 and 1) missing data mask of the data array.
data The cf.Data object containing the data array.
dtarray An independent numpy array of date-time objects.
dtype The numpy data type of the data array.
hardmask Whether the mask is hard (True) or soft (False).
isscalar True if the data array is scalar.
mask The mask of the data array.
ndim The number of dimensions in the data array.
shape A tuple of the data array’s dimension sizes.
size The number of elements in the data array.
subspace Return a new variable whose data is subspaced.
Units The cf.Units object containing the units of the data array.
varray A numpy array view of the data array.


all Test whether all data array elements evaluate to True.
allclose Returns True if two broadcastable cell measures have equal array values to within numerical tolerance.
any Return True if any data array elements evaluate to True.
asdatetime Convert the internal representation of data array elements to date-time objects.
asreftime Convert the internal representation of data array elements to numeric reference times.
attributes Inspect or change attributes which are not CF properties.
chunk Partition the data array.
ceil The ceiling of the data array.
clip Limit the values in the data array.
close Close all files referenced by the cell measure.
copy Return a deep copy.
cos Take the trigonometric cosine of the data array.
datum Return an element of the data array as a standard Python scalar.
delprop Delete a CF property.
dump Return a string containing a full description of the cell measure.
equals True if two cell measures are equal, False otherwise.
exp The exponential of the data array.
expand_dims Insert a size 1 axis into the data array.
files Return the names of any files containing parts of the data array.
fill_value Return the data array missing data value.
flip Flip dimensions of the data array in place.
floor Floor the data array.
getprop Get a CF property.
hasprop Return True if a CF property exists, otherise False.
HDF_chunks Specify HDF5 chunks for the data array.
identity Return the cell measure’s identity.
insert_data Insert a new data array into the variable in place.
inspect Inspect the object for debugging.
log The logarithm of the data array.
mask_invalid Mask the array where invalid values occur.
match Determine whether or not a variable satisfies conditions.
max The maximum of the data array.
mean The unweighted mean the data array.
min The minimum of the data array.
mid_range The unweighted average of the maximum and minimum of the data array.
name Return a name for the cell measure.
override_calendar Override the calendar of date-time units.
override_units Override the units.
properties Inspect or change the CF properties.
range The absolute difference between the maximum and minimum of the data array.
rint Round data array.
roll Roll the cell measure along an axis.
sample_size The number of non-missing data elements in the data array.
sd The unweighted sample standard deviation of the data array.
select has been deprecated.
setprop Set a CF property.
sin The trigonometric sine of the data array.
squeeze Remove size 1 dimensions from the data array
sum The sum of the data array.
transpose Permute the dimensions of the data array.
trunc Truncate the data array.
unique The unique elements of the data array.
var The unweighted sample variance of the data array.
where Set data array elements depending on a condition.