Handle equivalency of Celsius and Kelvin
This commit is contained in:
parent
af38be02bf
commit
a55fff0d35
@ -82,7 +82,10 @@ class Entry(object):
|
|||||||
else:
|
else:
|
||||||
return "Expected parameter '" + name + "' with unit '" + unit.to_string() + "' but got no unit."
|
return "Expected parameter '" + name + "' with unit '" + unit.to_string() + "' but got no unit."
|
||||||
if not attr.unit.is_equivalent(unit):
|
if not attr.unit.is_equivalent(unit):
|
||||||
return "Expected parameter '" + name + "' with unit equivalent to '" + unit.to_string() + \
|
if unit == u.K and attr.unit == u.Celsius:
|
||||||
|
setattr(self, name, attr.to(u.K, equivalencies=u.temperature()))
|
||||||
|
else:
|
||||||
|
return "Expected parameter '" + name + "' with unit equivalent to '" + unit.to_string() + \
|
||||||
"' but got unit '" + attr.unit.to_string() + "'."
|
"' but got unit '" + attr.unit.to_string() + "'."
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user