# cf.Field.set_construct¶

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

When inserting a construct with data, the domain axes constructs spanned by the data are either inferred, or specified with the axes parameter.

For a dimension coordinate construct, an exisiting dimension coordinate construct is discarded if it spans the same domain axis construct (since only one dimension coordinate construct can be associated with a given domain axis construct).

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 exisits then the exisiting construct will be replaced. Parameter example: key='cellmeasure0' axes: (sequence of) str or int, optional Set the domain axes constructs that are spanned by the construct’s data. If unset, and the set_axes parameter is True, then an attempt will be made to assign existing domain axis constructs to the data. The contents of the axes parameter is mapped to domain axis contructs by translating each element into a domain axis construct key via the domain_axis method. Parameter example: axes='domainaxis1' Parameter example: axes='X' Parameter example: axes=['latitude'] Parameter example: axes=['X', 'longitude'] Parameter example: axes=[1, 0] set_axes: bool, optional If False then do not set the domain axes constructs that are spanned by the data, even if the axes parameter has been set. By default the axes are set either according to the axes parameter, or an attempt will be made to assign existing domain axis constructs to the data. copy: bool, optional If True then set a copy of the construct. By default the construct is not copied. 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')