cf.Field.rank

Field.rank

The number of axes in the domain.

Note that this may be greater the number of data array axes.

See also

ndim, unsqueeze

Examples:

>>> print(f)
air_temperature field summary
-----------------------------
Data           : air_temperature(time(12), latitude(64), longitude(128)) K
Cell methods   : time: mean
Axes           : time(12) = [ 450-11-16 00:00:00, ...,  451-10-16 12:00:00] noleap
               : latitude(64) = [-87.8638000488, ..., 87.8638000488] degrees_north
               : longitude(128) = [0.0, ..., 357.1875] degrees_east
               : height(1) = [2.0] m
>>> f.rank
4
>>> f.ndim
3
>>> f
<CF Field: air_temperature(time(12), latitude(64), longitude(128)) K>
>>> f.unsqueeze(inplace=True)
<CF Field: air_temperature(height(1), time(12), latitude(64), longitude(128)) K>
>>> f.rank
4
>>> f.ndim
4