cf.Constructs.filter_by_axis¶
-
Constructs.
filter_by_axis
(mode=None, *axes)[source]¶ Select metadata constructs by axes spanned by their data.
New in version 1.7.0.
See also
filter_by_data
,filter_by_key
,filter_by_measure
,filter_by_method
,filter_by_identity
,filter_by_naxes
,filter_by_ncdim
,filter_by_ncvar
,filter_by_property
,filter_by_type
,filters_applied
,inverse_filter
,unfilter
- Parameters
- mode:
str
Define the relationship between the given domain axes and the constructs’ data.
mode
Description
'and'
A construct is selected if it spans all of the given domain axes, and possibly others.
'or'
A construct is selected if it spans any of the domain axes, and possibly others.
exact
A construct is selected if it spans all of the given domain axes, and no others.
subset
A construct is selected if it spans a subset of the given domain axes, and no others.
- axes: optional
Select the constructs whose data spans particular domain axis constructs.
A domain axis construct is identified by its construct key (e.g.
'domainaxis1'
).If no axes are provided then all constructs that do or could have data, spanning any domain axes constructs, are selected.
- mode:
- Returns
Constructs
The selected constructs and their construct keys.
Examples:
Select constructs whose data spans the “domainaxis1” domain axis construct:
>>> d = c.filter_by_axis('and', 'domainaxis1')
Select constructs whose data does not span the “domainaxis2” domain axis construct:
>>> d = c.filter_by_axis('and', 'domainaxis2').inverse_filter()
Select constructs whose data spans the “domainaxis1”, but not the “domainaxis2” domain axis constructs:
>>> d = c.filter_by_axis('and', 'domainaxis1') >>> d = d.filter_by_axis('and', 'domainaxis2') >>> d = d.inverse_filter(1)
Select constructs whose data spans the “domainaxis1” or the “domainaxis2” domain axis constructs:
>>> d = c.filter_by_axis('or', 'domainaxis1', 'domainaxis2')