-
Notifications
You must be signed in to change notification settings - Fork 416
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
MetPy broken by pint 0.9 #997
Comments
Thanks @markmuetz - thought I was going crazy. Could've sworn it was working a couple of weeks ago. Time to downgrade metpy until the bug is fixed? edit: downgrading metpy just brought up another error. Keeping metpy as 0.10.0 and downgrading pint to 0.8.1 as mentioned in #998 seems to fix it with a quick test: from metpy.calc.thermo import surface_based_cape_cin
from metpy.units import units
t = [288, 284, 278] * units.kelvin
dp = [285, 278, 269] * units.kelvin
p = [1013, 950, 900] * units.hPa
surface_based_cape_cin(p, t, dp)
(<Quantity(21.53649906623308, 'joule / kilogram')>, <Quantity(-8.118571674744551, 'joule / kilogram')>) Now to see if it works on my entire dataset |
Thanks @am-thyst - downgrading pint to 0.8.1 worked. For me this was: |
Leaving this open to track our problem with pint 0.9. |
For whatever reason, I got side-tracked into trying to figure out what was wrong with MetPy and pint 0.9. From what I could tell, I got it traced down to two separate issues:
I have a branch up with workarounds for both these issues (https://github.com/jthielen/MetPy/tree/pint-0.9). Almost all the tests are passing for me locally, just two matplotlib tests are failing on the second issue. With that in mind, should we push for hgrecco/pint#751 to get fixed upstream? Also, is the workaround for the |
@jthielen So I have fixes for the pint I didn't see, what's your solution for the other issue? |
Cool! I simply wrapped def iterable(value):
"""Determine if value can be iterated over."""
# Special case for pint Quantities
if hasattr(value, 'magnitude'):
value = value.magnitude
return np.iterable(value) |
@jthielen Can you put in a PR with your fixes for pint? That PR could also remove the restriction against pint 0.9 then. I'm thinking we need a 0.10.1 right now with fixes for everything upstream that's broken us, esp. xarray. |
Sure! I should be able to get it up soon. |
I was successfully calculating CAPE and CIN with an older version of metpy. The profiles are taken from a mean state of an idealized cloud resolving model. On upgrade to a newer version (v0.10.0), I started seeing a problem (see Actual output below). I don't think there's a problem with my profiles as it was working previously. I've worked out where the bug was introduced - see the expected and actual output commits. The diff between the commits looked fairly extensive though so I couldn't work out what the problem was!
Problem description: I believe you should be able to calculate CAPE/CIN for the given profiles.
Expected output (eb60959):
The text was updated successfully, but these errors were encountered: