cf.Field.unsqueeze

Field.unsqueeze(axes=None, i=False, **kwargs)[source]

Insert size 1 axes into the data array of the field.

By default all size 1 axes of the domain which are not spanned by the field’s data array are inserted, but particular axes may be selected with the keyword arguments.

The axes are inserted into the slowest varying data array positions.

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.

i : bool, optional

If True then update the field in place. By default a new field is created.

Returns :

out : cf.Field

See also

axes, expand_dims, flip, squeeze, swapaxes, transpose,

Examples

>>> print f
Data            : air_temperature(time, latitude, longitude)
Cell methods    : time: mean
Dimensions      : time(1) = [15] days since 1860-1-1
                : latitude(73) = [-90, ..., 90] degrees_north
                : longitude(96) = [0, ..., 356.25] degrees_east
                : height(1) = [2] m
Auxiliary coords:
>>> f.unsqueeze()
>>> print f
Data            : air_temperature(height, time, latitude, longitude)
Cell methods    : time: mean
Dimensions      : time(1) = [15] days since 1860-1-1
                : latitude(73) = [-90, ..., 90] degrees_north
                : longitude(96) = [0, ..., 356.25] degrees_east
                : height(1) = [2] m
Auxiliary coords:

Previous topic

cf.Field.transpose

Next topic

cf.Field.weights

This Page