cf.Field.section¶
-
Field.
section
(axes=None, stop=None, **kwargs)[source]¶ Return a FieldList of m dimensional sections of a Field of n dimensions, where M <= N.
- Parameters
- axes: optional
A query for the m axes that define the sections of the Field as accepted by the Field object’s axes method. The keyword arguments are also passed to this method. See TODO cf.Field.axes for details. If an axis is returned that is not a data axis it is ignored, since it is assumed to be a dimension coordinate of size 1.
- stop:
int
, optional Stop after taking this number of sections and return. If stop is
None
all sections are taken.
- Returns
FieldList
The sections of the field construct.
Examples:
Section a field into 2D longitude/time slices, checking the units:
>>> f.section({None: 'longitude', units: 'radians'}, ... {None: 'time', 'units': 'days since 2006-01-01 00:00:00'})
Section a field into 2D longitude/latitude slices, requiring exact names:
>>> f.section(['latitude', 'longitude'], exact=True)
Section a field into 2D longitude/latitude slices, showing the results:
>>> f <CF Field: eastward_wind(model_level_number(6), latitude(145), longitude(192)) m s-1> >>> f.section(('X', 'Y')) [<CF Field: eastward_wind(model_level_number(1), latitude(145), longitude(192)) m s-1>, <CF Field: eastward_wind(model_level_number(1), latitude(145), longitude(192)) m s-1>, <CF Field: eastward_wind(model_level_number(1), latitude(145), longitude(192)) m s-1>, <CF Field: eastward_wind(model_level_number(1), latitude(145), longitude(192)) m s-1>, <CF Field: eastward_wind(model_level_number(1), latitude(145), longitude(192)) m s-1>, <CF Field: eastward_wind(model_level_number(1), latitude(145), longitude(192)) m s-1>]