cf.Constructs.filter_by_size¶
- Constructs.filter_by_size(*sizes, todict=False, cached=None)[source]¶
Select domain axis constructs by size.
Added in version (cfdm): 1.7.3
See also
filter,filters_applied,inverse_filter,clear_filters_applied,unfilter- Parameters:
- sizes: optional
Select domain axis constructs that have sizes, defined by their
get_sizemethods, that match any of the given values.If no sizes are provided then all domain axis constructs are selected.
A value may be any object that can match an integer via
==.- todict:
bool, optional If True then return a dictionary of constructs keyed by their construct identifiers, instead of a
Constructsobject. This is a faster option.Added in version (cfdm): 1.8.9.0
- cached: optional
If any value other than
Nonethen return cached without selecting any constructs.Added in version (cfdm): 1.8.9.0
- Returns:
Constructsordictor cachedThe selected constructs, or a cached valued.
Examples
Select domain axis constructs that have a size of 1:
>>> d = c.filter_by_size(1)
Select domain axis constructs that have a size of 1 or 96:
>>> d = c.filter_by_size(1, 96)