cfdm.Constructs.filter_by_axis¶
-
Constructs.
filter_by_axis
(*mode, **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: optional
Define the behaviour when multiple axes are provided.
By default (or if the modes parameter is
'and'
) a construct is selected if it matches all of the given axis requirements. If the mode parameter is'or'
then a construct will be selected when at least one of the axis requirements is met. If the mode parameter is'exact'
then a construct will be selected when its data axes are exactly those defined by the axis requirements. If the mode parameters is'subset'
then a construct will be selected when its data axes are a subset of those defined by the axis requirements. If the mode parameters is'superset'
then a construct will be selected when its data axes are a superset of those defined by the axis requirements.- axes: optional
Select constructs whose data does, or does not, span particular domain axis constructs.
A domain axis construct is identified by a keyword parameter of the domain axis construct key (e.g.
domainaxis1
). The value is a boolean indicating if a construct should be selected when its data does span the axis (True
), or selected when its data does not span the axis (False
).If no axes are provided then all constructs that do or could have data, spanning any domain axes constructs, are selected.
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(domainaxis1=True)
Select constructs whose data does not span the “domainaxis2” domain axis construct:
>>> d = c.filter_by_axis(domainaxis2=False)
Select constructs whose data spans the “domainaxis1”, but not the “domainaxis2” domain axis constructs:
>>> d = c.filter_by_axis(domainaxis1=True, domainaxis2=False)
Select constructs whose data spans the “domainaxis1” or the “domainaxis2” domain axis constructs:
>>> d = c.filter_by_axis('or', domainaxis1=True, domainaxis2=True)