cf.Constructs.filter_by_measure¶
-
Constructs.
filter_by_measure
(*measures)[source]¶ Select cell measure constructs by measure.
New in version 1.7.0.
See also
filter_by_axis
,filter_by_data
,filter_by_key
,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
- measures: optional
Select cell measure constructs that have any of the given measure values.
A measure is specified by a string (e.g.
'area'
); or a compiled regular expression (e.g.re.compile('^a')
), for which all constructs whose measures match (viare.search
) are selected.If no measures are provided then all cell measure constructs are selected.
- Returns
Constructs
The selected cell measure constructs and their construct keys.
Examples:
>>> print(t.constructs.filter_by_type('measure')) Constructs: {'cellmeasure0': <CellMeasure: measure:area(9, 10) km2>, 'cellmeasure1': <CellMeasure: measure:volume(3, 9, 10) m3>}
Select cell measure constructs that have a measure of ‘area’:
>>> print(c.filter_by_measure('area')) Constructs: {'cellmeasure0': <CellMeasure: measure:area(9, 10) km2>}
Select cell measure constructs that have a measure of ‘area’ or ‘volume’:
>>> print(c.filter_by_measure('area', 'volume')) Constructs: {'cellmeasure0': <CellMeasure: measure:area(9, 10) km2>, 'cellmeasure1': <CellMeasure: measure:volume(3, 9, 10) m3>}
Select cell measure constructs that have a measure of start with the letter “a” or “v”:
>>> print(c.filter_by_measure(re.compile('^a|v'))) Constructs: {'cellmeasure0': <CellMeasure: measure:area(9, 10) km2>, 'cellmeasure1': <CellMeasure: measure:volume(3, 9, 10) m3>}
Select cell measure constructs that have a measure of any value:
>>> print(c.filer_by_measure()) Constructs: {'cellmeasure0': <CellMeasure: measure:area(9, 10) km2>, 'cellmeasure1': <CellMeasure: measure:volume(3, 9, 10) m3>}