-
Notifications
You must be signed in to change notification settings - Fork 415
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
Pressure does not decrease monotonically in your sounding. #2077
Comments
For what it's worth...I get the same issue "sometimes" when using metpy 0.10.2. The origin in the latest case is plotting a parcel profile and not the sounding itself: When I plot the same parcel profile using metpy 1.0.1 the error does not occur, in the current case at least. Not sure how general this is and I seem to recall getting this error for perfectly good soundings and not understanding why. |
One more comment. I confirmed this breaks again in metpy 1.1.0 so to summarize for me: |
As the error indicates, the data you are using doesn't contain pressures that strictly decrease with height. However, I think it is a bug that It is definitely the case that real data does repeat pressures. For instance, with this code: from datetime import datetime
from siphon.simplewebservice.wyoming import WyomingUpperAir
sounding_time = datetime(2013, 5, 31, 0)
station = 'OUN'
sounding_df = WyomingUpperAir.request_data(sounding_time, station)
print(sounding_df.tail(20)) we get
where we see both 11.8 mb and 7.0 mb are repeated (presumably due to rounding) in the Norman sounding referenced above. |
Interestingly, when looking at this data in GEMPAK (downloaded from the ISU GEMPAK archive), I see:
For example, at 9.4 (or 9.43) mb, the data returned via Siphon has a temperature of -36.6 C, but GEMPAK has -38.48 C. I guess we'd have to dredge up the original text bulletin to know which is right. |
Finally, using the ISU reader shows NaN for the temperature at each of the non-mandatory levels where GEMPAK has a temperature (this might be the difference between a "merged" and "unmerged" sounding?): from datetime import datetime
from siphon.simplewebservice.iastate import IAStateUpperAir
sounding_time = datetime(2013, 5, 31, 0)
station = 'OUN'
sounding_df = IAStateUpperAir.request_data(sounding_time, station)
print(sounding_df.tail(20)) gives:
The ISU reader doesn't return a monotonic sounding either, but in this case the repeated pressures are 71.6 mb and 55.8 mb. |
Looking at these results, I see four possible ways to address the fundamental issue:
|
So Siphon is correctly returning what Wyoming gives us:
Not sure how they're doing their stuff. It never occurred to me before that what we're really suffering from here is essentially that Wyoming isn't giving us all the digits available. 😞 When we put in the check, we thought it was only rare, errant data that would trigger it--not regular, normal data due to data access issues. The check is only currently used by I'll also add that the purpose of that check was to give better errors than random errors out of the internal scipy/numpy calculations--not as a strict correctness check. So I'm inclined to make the change from |
This commit relaxes the monotonicity check that had been performed, as real data has a tendency to repeat pressures, especially in the stratosphere. Closes Unidata#2077
That's definitely the easiest way to fix this! |
This commit relaxes the monotonicity check that had been performed, as real data has a tendency to repeat pressures, especially in the stratosphere. Closes Unidata#2077
When I try to find the Parcel_profile with data from 72357 OUN Norman Observations at 00Z 31 May 2013 I get the following error.
metpy.calc.exceptions.InvalidSoundingError: Pressure does not decrease monotonically in your sounding. Using scipy.signal.medfilt may fix this.
The issue is that the data fails in thermo.py at:
def _check_pressure(pressure): """Check that pressure decreases monotonically. Returns True if the pressure decreases monotonically; otherwise, returns False. """ return np.all(pressure[:-1] > pressure[1:])
Should
np.all(pressure[:-1] > pressure[1:])
benp.all(pressure[:-1] >= pressure[1:])
because in the event that pressure[:-1] = pressure[1:] the function fill retun false.The text was updated successfully, but these errors were encountered: