cf.Field.squeeze¶

Field.
squeeze
(axes=None, inplace=False, i=False, **kwargs)[source]¶ Remove size 1 axes from the data.
By default all size 1 axes are removed, but particular size 1 axes may be selected for removal.
Squeezed domain axis constructs are not removed from the metadata constructs, nor from the domain of the field construct.
See also
domain_axis
,flatten
,insert_dimension
,flip
,remove_axes
,transpose
,unsqueeze
 Parameters
 axes: (sequence of)
str
orint
, optional Select the domain axes to squeeze, defined by the domain axes that would be selected by passing each given axis description to a call of the field construct’s
domain_axis
method. For example, for a value of'X'
, the domain axis construct returned byf.domain_axis('X')
is selected.If no axes are provided then all size 1 axes are squeezed.
 inplace:
bool
, optional If True then do the operation inplace and return
None
. i: deprecated at version 3.0.0
Use the inplace parameter instead.
kwargs: deprecated at version 3.0.0
 axes: (sequence of)
 Returns
>>> g = f.squeeze() >>> g = f.squeeze('time') >>> g = f.squeeze(1) >>> g = f.squeeze(['time', 1, 'dim2']) >>> f.squeeze(['dim2'], inplace=True)