Open am-thyst opened 5 years ago
ping @dopplershift
My guess is that one particular column from the grid has some conditions that our CAPE code is not happy with. Any way to identify which set of indices is being worked on when the error occurs?
I think this is the same as #945, for which I have a PR.
@sgdecker any way to work around it?
The fix will be in master soon. Since the problem is internal to the lfc
function, the only thing I can suggest other than waiting is to put your call to surface_based_cape_cin
in a try/except block so that at least the gridpoints that don't trigger the bug can be computed.
@am-thyst did the PR provided by @sgdecker fix this issue? Just going back through issues and trying to figure out what hasn't been solved yet.
Hearing nothing on this, I'm going to close this issue.
Hi @zbruick sorry for the late response. I'm still getting this error, even with the PR implemented. It also occurs on the most_unstable_cape_cin
function.
To confirm, you've updated to the current version of master and tested again? Just want to make sure before investigating more, as the PR hasn't been released yet, but will be in 0.11 when that's released shortly.
I also get this error with all CAPE related calculations ie. most_unstable_cape_cin, surface_based_cape_cin.
Hey @michaelsessa! Can you provide any more details and do you have a reproducible example for this? Is it erring out for any point, or are you doing this on a grid? If we can get a reproducible example for this problem, that would be a great help in solving it!
Yes! I am calculating different environmental parameters across a domain of 72 grid points. It varies case to case with some giving me no errors at all and others successfully completing calculations over a portion of the grid points before producing the error.
Given that line 424 of thermo.py is not a return statement in master, I will second https://github.com/Unidata/MetPy/issues/1011#issuecomment-532379979 I suspect this is 0.10, which doesn't include the PR that fixes this issue.
@michaelsessa, thanks for the traceback. Could you test against the master branch of MetPy (install it in a new Conda environment)? If you need instructions, you can find them here. There was a PR that might have fixed this issue, and any testing that could be done to verify that would be very helpful! Otherwise, feel free to drop me your data file via email and I can play with it and see what's up.
I created a new Conda environment and tested against the master branch of Metpy and the issue appears to be resolved!
Ok thanks for checking...I'm glad to hear it!
@am-thyst Given that #1172 is merged (fixing #1167), is your original issue here still present on master?
Bumping from 0.11, but please do let me know if this still a problem.
Sorry for re-upping an old thread, but I get an "index out of bounds" error when attempting to calculate wet bulb temperatures. Oddly, it only occurs with certain sounding data (i.e. certain dates/observations):
works for:
doesn't work for:
Dates are generally selected at random except for a few local severe events. Any ideas?
============================================================ Code snippet:
df = WyomingUpperAir.request_data(date, station) #pressure, height, temp, dp, direction, speed, u_wind, v_wind, station, station_number, time, lat, lon, elev
print(df)
p = df['pressure'].values * units.hPa
T = df['temperature'].values * units.degC
Td = df['dewpoint'].values * units.degC
wind_speed = df['speed'].values * units.knots
wind_dir = df['direction'].values * units.degrees
u, v = mpcalc.wind_components(wind_speed, wind_dir)
mask = p >= 100 * units.hPa
Tw = mpcalc.wet_bulb_temperature(p, T, Td).to('degC')
============================================================ Error:
Traceback (most recent call last):
File ".\MetPy_Sounding.py", line 42, in <module>
Tw = mpcalc.wet_bulb_temperature(p, T, Td).to('degC')
File "C:\ProgramData\Anaconda3\lib\site-packages\metpy\xarray.py", line 655, in wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\metpy\units.py", line 320, in wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\metpy\calc\thermo.py", line 2413, in wet_bulb_temperature
ret[...] = moist_adiabat_temperatures[-1].magnitude
File "C:\ProgramData\Anaconda3\lib\site-packages\pint\quantity.py", line 1719, in __getitem__
return type(self)(self._magnitude[key], self._units)
IndexError: index -1 is out of bounds for axis 0 with size 0
Shouldn't this be a new issue? The original problem here was with sbcape
not wet_bulb_temperature
.
I went ahead and copied that comment to #1332.
Kind of follows on from issues #972 and #997 -
With a simple example, the
surface_based_cape_cin
function works fine:but when applying it to my loop, where pressure, temperature & dewpoint are definitely of shape (8,):
I get the following traceback:
edit: works when taking just one point from the loop, so definitely not the data that's the problem?