cf.FieldList.select_by_identity

FieldList.select_by_identity(*identities)[source]

Select list elements constructs by identity.

To find the inverse of the selection, use a list comprehension with the match_by_identity method of the constructs. For example, to select all constructs whose identity is not 'air_temperature':

>>> gl = cf.FieldList(
...     x for x in fl if not f.match_by_identity('air_temperature')
... )

New in version 3.0.0.

See also

select, __call__, select_by_ncvar, select_by_property, cf.FieldList.match_by_identity

Parameters
identities: optional

Select constructs from the list. By default all constructs are selected. May be one or more of:

  • A construct identity.

    A construct has a number of string-valued identities

defined by its identities method, and is selected if any of them match the identity parameter. identity may be a string that equals one of a construct’s identities; or a re.Pattern object that matches one of a construct’s identities via re.search.

Note that in the output of a dump method or print call, a metadata construct is always described by one of its identities, and so this description may always be used as an identity value.

If no identities are provided then all list elements are selected.

Parameter example:

'latitude'

Parameter example:

'long_name=Air Temperature'

Parameter example:

'air_pressure', 'longitude'

Returns
FieldList

The matching constructs.

Examples

See cf.FieldList.match_by_identity