cf.FieldAncillary.match_by_identity

FieldAncillary.match_by_identity(*identities)[source]

Whether or not the construct identity satisfies conditions.

New in version 3.0.0.

Parameters:
identities: optional

Define one or more conditions on the identities.

A construct identity is specified by a string (e.g. 'latitude', 'long_name=time', ``'ncvar%lat', etc.); a Query object (e.g. cf.eq('longitude')); or a compiled regular expression (e.g. re.compile('^atmosphere')) that is compared with the construct’s identities via re.search.

A construct has a number of identities, and the condition is satisfied if any of the construct’s identities, as returned by the identities method, equals the condition value. A construct’s identities are those returned by its identities method. In the following example, the construct x has six identities:

>>> x.identities()
['time', 'long_name=Time', 'foo=bar', 'standard_name=time', 'ncvar%t', T']
Returns:
bool

Whether or not at least one of the conditions are met.

Examples:

>>> f.match_by_identity('time')
>>> f.match_by_identity(re.compile('^air'))
>>> f.match_by_identity('air_pressure', 'air_temperature')
>>> f.match_by_identity('ncvar%t')