cf.Constructs.filter_by_naxes

Constructs.filter_by_naxes(*naxes, todict=False, cached=None)[source]

Selects constructs by the number of axes their data spans.

Specifically, selects metadata constructs by the number of domain axis constructs spanned by their data.

New in version (cfdm): 1.7.0

Parameters
naxes: optional

Select constructs that have data whose number of dimensions matches any of the given values.

If no values are provided then all constructs that do or could have data, spanning any domain axes 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 Constructs object. This is a faster option.

New in version (cfdm): 1.8.9.0

cached: optional

If any value other than None then return cached without selecting any constructs.

New in version (cfdm): 1.8.9.0

Returns
Constructs or dict or cached

The selected constructs, or a cached valued.

Examples

Select constructs that contain data that spans two domain axis constructs:

>>> d = c.filter_by_naxes(2)

Select constructs that contain data that spans one or two domain axis constructs:

>>> d = c.filter_by_ncdim(1, 2)