cf.Field.expand_dims

Field.expand_dims(arg=None, axis=0)[source]

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 domain and is identified by its standard name or by the domain’s internal dimension name. By default, insert a new dimension which doesn’t yet exist in the field’s domain.

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.equivalent_data

Next topic

cf.Field.finalize

This Page