File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1313from property_utils .units .descriptors import UnitDescriptor
1414from property_utils .exceptions .units .converter_types import UnitConversionError
1515from property_utils .units .units import (
16+ NonDimensionalUnit ,
1617 RelativeTemperatureUnit ,
1718 AbsoluteTemperatureUnit ,
1819 LengthUnit ,
@@ -153,6 +154,17 @@ def convert(
153154 return value * cls .get_factor (from_descriptor , to_descriptor )
154155
155156
157+ @register_converter (NonDimensionalUnit )
158+ class NonDimensionalUnitConverter (AbsoluteUnitConverter ):
159+ """
160+ This converter is needed for compatibility, i.e. for conversions to work from
161+ non-dimensional units to non-dimensional dimensions.
162+ """
163+
164+ reference_unit = NonDimensionalUnit .NON_DIMENSIONAL
165+ conversion_map = {NonDimensionalUnit .NON_DIMENSIONAL : 1 }
166+
167+
156168@register_converter (LengthUnit )
157169class LengthUnitConverter (AbsoluteUnitConverter ):
158170 """
You can’t perform that action at this time.
0 commit comments