cf.Field.set_construct¶

Field.
set_construct
(construct, key=None, axes=None, set_axes=True, copy=True, autocyclic={}, conform=True)[source]¶ Set a metadata construct.
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 existing 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).
New in version 3.0.0.
See also
constructs
,creation_commands
,del_construct
,get_construct
,set_coordinate_reference
,set_data_axes
 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
orint
, 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 constructs 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 copied.
 autocyclic:
dict
, optional Additional parameters for optimising the operation, relating to coordinate periodicity and cyclicity. See the code for details.
New in version 3.9.0.
 conform:
bool
, optional If True (the default), then attempt to replace placeholder identities in construct with existing construct identifiers. Specifically, cell method construct axis specifiers (such as
'T'
) are mapped to domain axis construct identifiers, and coordinate reference construct coordinate specifiers (such as'latitude'
) are mapped to their corresponding dimension or auxiliary coordinate construct identifiers.New in version 3.14.0.
 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')