cfdm.core.abstract.PropertiesData.get_property

PropertiesData.get_property(prop, default=ValueError())[source]

Return a property.

New in version (cfdm): 1.7.0

Parameters
prop: str

The name of the property to be returned.

Parameter example:

prop='standard_name'

default: optional

Return the value of the default parameter if the property has not been set.

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

Returns

The value of the property.

Examples:

>>> f = cfdm.core.PropertiesData()
>>> 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