cf.Field.insert_axis

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

Insert a domain axis into the field.

Parameters:
axis: cf.DomainAxis

The new domain axis.

key: str, optional

The 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: str

The identifier of the new domain axis.

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