cf.Field.expand_dims

Field.expand_dims(arg=None, axis=0)

Expand the shape of the data array in place.

Insert a new size 1 axis, corresponding to a given position in the data array shape.

Parameters :
arg : str, optional

The dimension to insert. if specified, the dimension should exist in the field’s space and is identified by its standard name or by the space’s internal dimension name. By default, insert a new dimension which doesn’t yet exist in the field’s space.

axis : int, optional

Position (amongst axes) where new axis is to be inserted. By default, insert at position 0.

Returns :

None

Examples

>>> f.expand_dims()
>>> f.expand_dims(axis=1)
>>> f.expand_dims('height')
>>> f.expand_dims('height', 3)
>>> f.expand_dims('dim1', 3)

Previous topic

cf.Field.equals

Next topic

cf.Field.extract

This Page