Domain.has_construct(*identity, **filter_kwargs)[source]

Whether a unique metadata construct exists.

New in version (cfdm): 1.7.0


Select the unique construct that has the identity, defined by its identities method, that matches the given values.

Additionally, the values are matched against construct identifiers, with or without the 'key%' prefix.

A value may be any object that can match via the == operator, or a re.Pattern object that matches via its search method.

Note that in the output of a dump method or print call, a construct is always described by an identity that will select it.

New in version (cfdm):

filter_kwargs: optional

Keyword arguments as accepted by Constructs.filter that define additional construct selection criteria.

New in version (cfdm):


Whether or not a unique construct can be identified.


>>> f = cfdm.example_field(0)
>>> print(f)
Field: specific_humidity (ncvar%q)
Data            : specific_humidity(latitude(5), longitude(8)) 1
Cell methods    : area: mean
Dimension coords: latitude(5) = [-75.0, ..., 75.0] degrees_north
                : longitude(8) = [22.5, ..., 337.5] degrees_east
                : time(1) = [2019-01-01 00:00:00]
>>> f.has_construct('time')
>>> f.del_construct('altitude')