cf.Field.squeeze

Field.squeeze(axes=None, **kwargs)[source]

Remove size 1 axes from the data array.

By default all size 1 axes are removed from the field’s data array, but particular axes may be selected with the keyword arguments.

Squeezed axes are not squeezed from the domain’s coordinate and cell measure objects, nor are they removed from the field. To completely remove axes, use the field’s remove_axes method.

Parameters :
axes, kwargs : optional

Select the axes. The axes are those which would be selected by this call of the field’s axes method: f.axes(axes, size=1, **kwargs). See cf.Field.axes for details.

Returns :

None

Examples

>>> f.squeeze()
>>> f.squeeze('time')
>>> f.squeeze(1)
>>> f.squeeze('dim2')
>>> f.squeeze([1, 'time', 'dim2'])
>>> f.squeeze({'units': 'Pa'})

Previous topic

cf.Field.sort

Next topic

cf.Field.subspace

This Page