Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windchill calculation does not work with Kelvin as input units #385

Closed
jrleeman opened this issue Apr 6, 2017 · 0 comments
Closed

Windchill calculation does not work with Kelvin as input units #385

jrleeman opened this issue Apr 6, 2017 · 0 comments
Assignees
Labels
Area: Calc Pertains to calculations Type: Bug Something is not working like it should
Milestone

Comments

@jrleeman
Copy link
Contributor

jrleeman commented Apr 6, 2017

This should work, but doesn't (full trace included).

mpcalc.windchill(263 * units.kelvin, 20 * units('m/s'))
```python --------------------------------------------------------------------------- OffsetUnitCalculusError Traceback (most recent call last) in () ----> 1 mpcalc.windchill(263 * units.kelvin, 20 * units('m/s'))

/Users/johnleeman/anaconda/envs/unidata-workshop/lib/python3.6/site-packages/metpy/units.py in wrapper(*args, **kwargs)
204 ' x = x * units.meter / units.second')
205 raise ValueError(msg)
--> 206 return func(*args, **kwargs)
207
208 return wrapper

/Users/johnleeman/anaconda/envs/unidata-workshop/lib/python3.6/site-packages/metpy/calc/basic.py in windchill(temperature, speed, face_level_winds, mask_undefined)
159 delta = temperature - 0. * units.degC
160 wcti = (13.12 * units.degC + 0.6215 * delta -
--> 161 11.37 * units.delta_degC * speed_factor + 0.3965 * delta * speed_factor)
162
163 # See if we need to mask any undefined values

/Users/johnleeman/anaconda/envs/unidata-workshop/lib/python3.6/site-packages/pint/quantity.py in add(self, other)
585
586 def add(self, other):
--> 587 return self._add_sub(other, operator.add)
588
589 radd = add

/Users/johnleeman/anaconda/envs/unidata-workshop/lib/python3.6/site-packages/pint/quantity.py in _add_sub(self, other, op)
574 units = other._units
575 else:
--> 576 raise OffsetUnitCalculusError(self._units, other._units)
577
578 return self.class(magnitude, units)

OffsetUnitCalculusError: Ambiguous operation with offset unit (degC, kelvin).

</details>
@jrleeman jrleeman added Area: Calc Pertains to calculations Type: Bug Something is not working like it should labels Apr 6, 2017
@jrleeman jrleeman modified the milestones: 0.5.0, 0.5.1 Bugfix Apr 6, 2017
@dopplershift dopplershift self-assigned this Apr 11, 2017
dopplershift added a commit to dopplershift/MetPy that referenced this issue Apr 11, 2017
Windchill formula uses direct values of Celsius. The hack we had in
there to make that work with units did not work properly with Kelvin.
Instead, just convert to Celsius, drop units, and attach proper units
after calc.
jrleeman added a commit that referenced this issue Apr 12, 2017
BUG: Fix windchill when given kelvin temperatures (Fixes #385)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Calc Pertains to calculations Type: Bug Something is not working like it should
Projects
None yet
Development

No branches or pull requests

2 participants