cf.Field.axis_size

Field.axis_size(*identity, default=ValueError(), axes=None, **filter_kwargs)[source]

Return the size of a domain axis construct.

Parameters
identity, filter_kwargs: optional

Select the unique domain axis construct returned by f.domain_axis(*identity, **filter_kwargs). See domain_axis for details.

default: optional

Return the value of the default parameter if a domain axis construct can not be found. If set to an Exception instance then it will be raised instead.

axes: deprecated at version 3.0.0

Returns
int

The size of the selected domain axis

Examples:

>>> f
<CF Field: eastward_wind(time(3), air_pressure(5), latitude(110), longitude(106)) m s-1>
>>> f.axis_size('longitude')
106
>>> f.axis_size('Z')
5