cfdm.Field.set_construct

Field.set_construct(construct, key=None, axes=None, copy=True)[source]

Set a metadata construct.

New in version (cfdm): 1.7.0

Parameters
construct:

The metadata construct to be inserted.

key: str, optional

The construct identifier to be used for the construct. If not set then a new, unique identifier is created automatically. If the identifier already exists then the existing construct will be replaced.

Parameter example:

key='cellmeasure0'

axes: (sequence of) str, optional

The construct identifiers of the domain axis constructs spanned by the data array. An exception is raised if used for a metadata construct that can not have a data array, i.e. domain axis, cell method and coordinate reference constructs.

Parameter example:

axes='domainaxis1'

Parameter example:

axes=['domainaxis1']

Parameter example:

axes=['domainaxis1', 'domainaxis0']

copy: bool, optional

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

Returns
str

The construct identifier for the construct.

Examples

>>> key = f.set_construct(c)
>>> key = f.set_construct(c, copy=False)
>>> key = f.set_construct(c, axes='domainaxis2')
>>> key = f.set_construct(c, key='cellmeasure0')