cf.Data.get_units

Data.get_units(default=ValueError())[source]

Return the units.

See also

del_units, set_units

Parameters
default: optional

Return the value of the default parameter if the units have not been set. If set to an Exception instance then it will be raised instead.

Returns

The units.

Examples

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