cf.FieldList.select_by_property¶
-
FieldList.
select_by_property
(*mode, **properties)[source]¶ Select field constructs by property.
To find the inverse of the selection, use a list comprehension with
match_by_property
method of the field constucts. For example, to select all field constructs which do not have a long_name property of ‘Air Pressure’:>>> gl = cf.FieldList(f for f in fl ... if not f.match_by_property(long_name='Air Pressure))
New in version 3.0.0.
See also
select
,select_by_identity
,select_by_construct
,select_by_naxes
,select_by_rank
,select_by_units
Parameters: - mode: optional
Define the behaviour when multiple properties are provided.
By default (or if the mode parameter is
'and'
) a field construct is selected if it matches all of the given properties, but if the mode parameter is'or'
then a field construct will be selected when at least one of its properties matches.- properties: optional
Select field constructs. May be one or more of:
- The property of a field construct.
By default a field construct is selected if it matches all of the given properties, but it may alternatively be selected when at least one of its properties matches (see the mode positional parameter).
A property value is given by a keyword parameter of the property name. The value may be a scalar or vector (e.g.
'air_temperature'
,4
,['foo', 'bar']
); or a compiled regular expression (e.g.re.compile('^ocean')
), for which all constructs whose methods match (viare.search
) are selected.
Returns: FieldList
The matching field constructs.
Examples:
TODO