gordias.util.units.ensure_precipitation_unit_and_standard_name#
- gordias.util.units.ensure_precipitation_unit_and_standard_name(unit: Unit | None, standard_name: str | None) tuple[Unit, str]#
Get valid unit and standard name pair.
This function expects at least one of the arguments to be given. If one or both of the arguments are given, a valid pair of unit and standard name is returned if possible, otherwise an exception will be raised.
- Parameters:
unit (cf_units.Unit | None) – Unit to check.
standard_name (str | None) – Standard name to check.
- Returns:
unit (cf_units.Unit) – A precipitation unit valid to the standard_name.
standard_name (str) – A precipitation standard name valid to the unit.
- Raises:
ValueError – If a valid pair of unit and standard name could not be found.