cf.Field.insert_axis

Field.insert_axis(size, key=None, replace=True)[source]

Insert an axis into the domain in place.

Parameters:
size: int

The size of the new axis.

key: str, optional

The domain identifier for the new axis. By default a new, unique identifier is generated.

replace: bool, optional

If False then do not replace an existing axis with the same identifier but a different size. By default an existing axis with the same identifier is changed to have the new size.

Returns:
out:

The domain identifier of the new axis.

Examples:
>>> f.insert_axis(1)
>>> f.insert_axis(90, key='dim4')
>>> f.insert_axis(23, key='dim0', replace=False)