Field.del_construct(key, default=ValueError())[source]

Remove a metadata construct.

If a domain axis construct is selected for removal then it can’t be spanned by any data arrays of the field nor metadata constructs, nor be referenced by any cell method constructs. However, a domain ancillary construct may be removed even if it is referenced by coordinate reference construct.

New in version (cfdm): 1.7.0

key: str

The construct identifier of the metadata construct to be removed.

Parameter example:


default: optional

Return the value of the default parameter if the data axes have not been set.

If set to an Exception instance then it will be raised instead.


The removed metadata construct.


>>> f = cfdm.core.example_field(4)
>>> f.del_construct('auxiliarycoordinate2')
<AuxiliaryCoordinate: longitude(3) degrees_east>
>>> f = cfdm.core.example_field(0)
>>> f.del_construct('auxiliarycoordinate2')
Traceback (most recent call last):
ValueError: Can't remove non-existent construct
>>> f.del_construct('auxiliarycoordinate2', default=False)