python-quantities-developers team mailing list archive
-
python-quantities-developers team
-
Mailing list archive
-
Message #00067
Temperature conversion bug and known issues
I'm surprised I didn't notice this before: temperature conversions
between Celsius and Kelvin don't work correctly.
>>> T = 20 * pq.degC
>>> T.units = pq.K
>>> print T
20.0 K
I'm not sure how to fix this conversion problem, since it requires an
offset during conversion (which is not yet possible, as far as I can
tell). In any case, I don't think the above error should pass
silently. Until, this conversion error is fixed, it'd be nice to
remove the capability of converting between temperatures (except
between Rankine and Kelvin, which works fine). Below is a patch that
does this.
Also, I wanted to follow up on my suggestion for a known issues page.
I've attached a rough draft of what I had in mind. (Side note: I
emailed the numpy list about the interpolation issue with zero-rank
arrays, but it hasn't shown up on the list yet; I'll try again at some
latter point).
Best,
-Tony
Attachment:
issues.rst
Description: Binary data
=== modified file 'quantities/units/temperature.py'
--- quantities/units/temperature.py 2009-06-20 14:21:23 +0000
+++ quantities/units/temperature.py 2009-07-10 19:58:35 +0000
@@ -20,7 +20,6 @@
)
degC = celsius = Celsius = UnitTemperature(
'Celsius',
- K,
symbol='degC',
u_symbol='°C',
aliases=['degC', 'celsius'],
@@ -31,7 +30,6 @@
)
degF = fahrenheit = Fahrenheit = UnitTemperature(
'Fahrenheit',
- degR,
symbol='degF',
u_symbol='°F',
aliases=['degF', 'fahrenheit'],
Follow ups