cf.Data.has_units

Data.has_units()[source]

Whether units have been set.

Returns
bool

True if units have been set, otherwise False.

Examples:

>>> d.set_units('metres')
>>> d.has_units()
True
>>> d.get_units()
'metres'
>>> d.del_units()
>>> d.has_units()
False
>>> d.get_units()
ValueError: Can't get non-existent units
>>> print(d.get_units(None))
None
>>> print(d.del_units(None))
None