cfdm.Constructs.filter_by_data

Constructs.filter_by_data(todict=False, cached=None)[source]

Selects metadata constructs that could contain data.

Selection is not based on whether they actually have data, rather by whether the construct supports the inclusion of data. For example, constructs selected by this method will all have a get_data method.

New in version (cfdm): 1.7.0

Parameters
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 could contain data:

>>> d = c.filter_by_data()