smif.convert.unit module¶
Handles conversion between units used in the SosModel
First implementation delegates to pint.
Reference¶
-
class
smif.convert.unit.
UnitRegister
[source]¶ Bases:
smif.convert.register.Register
-
names
¶
-
convert_old
(data, from_unit, to_unit)[source]¶ Convert the data from one unit to another unit
Parameters: - data (numpy.ndarray) – An array of values with dimensions regions x intervals
- from_unit (str) – The name of the unit of the data
- to_unit (str) – The name of the required unit
Returns: An array of data with dimensions regions x intervals
Return type: Raises: ValueError
– If the units are not in the unit register or conversion is not possible
-