hestia_earth.utils.model.convert_value¶
-
hestia_earth.utils.model.convert_value(value, from_unit, to_unit, **kwargs)[source]¶ Converts a value of unit into a different unit. Depending on the destination unit, additional arguments might be provided by name, see the list of parameters.
- Parameters
value (
float) – The value to convert, usually a float or an integer.from_unit (
str) – The unit the value is specified in.to_unit (
str) – The unit the converted value should be.density – Optional. When converting from a 2d unit to 3d or the opposite, a density is required.
- Returns
The converted value in the destination unit.
- Return type
float