cf.Constructs.filter_by_key

Constructs.filter_by_key(*keys)[source]

Select metadata constructs by key.

New in version (cfdm): 1.7.0

Parameters
keys: optional

Select constructs that have any of the given construct keys.

A key is specified by a string (e.g. 'fieldancillary0').

If no keys are provided then all constructs are selected.

Returns
Constructs

The selected constructs and their construct keys.

Examples:

Select the construct with key ‘domainancillary0’:

>>> d = c.filter_by_key('domainancillary0')

Select the constructs with keys ‘dimensioncoordinate1’ or ‘fieldancillary0’:

>>> d = c.filter_by_key('dimensioncoordinate1', 'fieldancillary0')