# cf.Field.match_by_construct¶

Field.match_by_construct(*mode, **constructs)[source]

Whether or not metadata constructs satisfy conditions.

New in version 3.0.0.

Parameters: mode: optional Define the behaviour when multiple conditions are provided. By default (or if the mode parameter is 'and') the match is True if the field construct satisfies all of the given conditions, but if the mode parameter is 'or' then the match is True when at least one of the conditions is satisfied. constructs: optional Define conditions on metadata constructs. Metadata constructs are identified by the name of a keyword parameter. A keyword parameter name of, say, identity selects the metadata constructs as returned by this call of the constructs attribute: f.constructs(identity). See cf.Field.constructs for details. The keyword parameter value defines a condition to be applied to the selected metadata constructs, and is one of: None a scalar or Query object If the condition is None then the condition is one of existence and is satisfied if at least one metadata construct has been selected, regardless of their data. Otherwise the condition is satisfied if any element of the unique selected metadata construct’s data equals the value. Parameter example: To see if the field construct has a unique ‘X’ metadata construct with any data values of 180: X=180 Parameter example: To see if the field construct has a unique ‘latitude’ metadata construct with any data values greater than 0: latitude=cf.lt(0). Parameter example: To see if the field construct has any ‘Y’ metadata constructs: Y=None. Parameter example: To see if the the field construct has any ‘Y’ metadata constructs: Y=None. bool Whether or not the conditions are met.

Examples:

>>> f.match_by_construct(T=cf.contains(cf.dt('2019-01-01')))

>>> f.match_by_construct(Z=None, Y=30)

>>> f.match_by_construct(X=None, Y=None)

>>> f.match_by_construct(**{'grid_mapping_name:rotated_latitude_longitude': None})