cfdm.Field.has_property

Field.has_property(prop)[source]

Whether a property has been set.

New in version (cfdm): 1.7.0

Parameters
prop: str

The name of the property.

Parameter example:

prop='long_name'

Returns
bool

True if the property has been set, otherwise False.

Examples

>>> f = cfdm.Field()
>>> f.set_property('project', 'CMIP7')
>>> f.has_property('project')
True
>>> f.get_property('project')
'CMIP7'
>>> f.del_property('project')
'CMIP7'
>>> f.has_property('project')
False
>>> print(f.del_property('project', None))
None
>>> print(f.get_property('project', None))
None