cf.Field.replace_construct

Field.replace_construct(*identity, new=None, copy=True, **filter_kwargs)[source]

Replace a metadata construct.

Replacement assigns the same construct key and, if applicable, the domain axes of the original construct to the new, replacing construct.

New in version 3.0.0.

Parameters
identity: optional

Select the unique construct returned by f.construct(*identity, **filter_kwargs). See construct for details.

new:

The new construct to replace that selected by the identity parameter.

copy: bool, optional

If True then set a copy of the new construct. By default the construct is copied.

filter_kwargs: optional

Keyword arguments as accepted by Constructs.filter that define additional construct selection criteria.

New in version 3.9.0.

construct:

Deprecated at version 3.9.0

Returns

The construct that was replaced.

Examples

>>> f.replace_construct('X', new=X_construct)