You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error in XLRD reader when reading temperature #101
@anomam thanks for this. Pint handles temperature slightly differently than other units because it can also have an offset in addition to a conversion factor. Please read their documentation. I've been burned by it before too, but basically you can't just multiply by a unit, you have to use the Q_(blah, blah
However, multiplication, division and exponentiation of quantities with offset units is problematic just like addition. Pint (since version 0.6) will by default raise an error when a quantity with offset unit is used in these operations. Due to this quantities with offset units cannot be created like other quantities by multiplication of magnitude and unit but have to be explicitly created:
It should be stated more clearly in the documentation, and any data readers or other classes that use units or convert them should be changed to use Q_(value, units) instead of value * units. Sorry!
Note that this issue was addressed in data_readers.py in ccb6349. Originally PVSimLife used Quantities instead of Pint, and Quantities does not allow unit offsets, so it doesn't do Celsius or Fahrenheit, so it didn't have non-multiplicative units and this issue.
Activity
mikofski commentedon Mar 24, 2017
@anomam thanks for this. Pint handles temperature slightly differently than other units because it can also have an offset in addition to a conversion factor. Please read their documentation. I've been burned by it before too, but basically you can't just multiply by a unit, you have to use the
Q_(blah, blahIt should be stated more clearly in the documentation, and any data readers or other classes that use units or convert them should be changed to use
Q_(value, units)instead ofvalue * units. Sorry!Note that this issue was addressed in
data_readers.pyin ccb6349. Originally PVSimLife used Quantities instead of Pint, and Quantities does not allow unit offsets, so it doesn't do Celsius or Fahrenheit, so it didn't have non-multiplicative units and this issue.