-
Notifications
You must be signed in to change notification settings - Fork 447
Calculation fixes #929
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
Calculation fixes #929
Conversation
metpy/calc/tests/test_thermo.py
Outdated
| 176., 150.], 'hectopascal') | ||
| t = units.Quantity([24.2, 24., 20.2, 21.6, 21.4, 20.4, 20.2, 14.4, 13.2, 13., 6.8, -3.3, | ||
| -13.1, -13.7, -17.9, -25.5, -26.9, -37.9, -46.7, -48.7, -52.1, -58.9], | ||
| 'degC') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E127 continuation line over-indented for visual indent
metpy/calc/tests/test_thermo.py
Outdated
| -13.1, -13.7, -17.9, -25.5, -26.9, -37.9, -46.7, -48.7, -52.1, -58.9], | ||
| 'degC') | ||
| td = units.Quantity([2.19000000e+01, 2.21000000e+01, 1.92000000e+01, 2.05000000e+01, | ||
| 2.04000000e+01, 1.84000000e+01, 1.74000000e+01, 8.40000000e+00, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
metpy/calc/tests/test_thermo.py
Outdated
| 'degC') | ||
| td = units.Quantity([2.19000000e+01, 2.21000000e+01, 1.92000000e+01, 2.05000000e+01, | ||
| 2.04000000e+01, 1.84000000e+01, 1.74000000e+01, 8.40000000e+00, | ||
| -2.80000000e+00, -3.00000000e+00, -1.52000000e+01, -2.03000000e+01, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
metpy/calc/tests/test_thermo.py
Outdated
| td = units.Quantity([2.19000000e+01, 2.21000000e+01, 1.92000000e+01, 2.05000000e+01, | ||
| 2.04000000e+01, 1.84000000e+01, 1.74000000e+01, 8.40000000e+00, | ||
| -2.80000000e+00, -3.00000000e+00, -1.52000000e+01, -2.03000000e+01, | ||
| -2.91000000e+01, -2.77000000e+01, -2.49000000e+01, -3.95000000e+01, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
metpy/calc/tests/test_thermo.py
Outdated
| 2.04000000e+01, 1.84000000e+01, 1.74000000e+01, 8.40000000e+00, | ||
| -2.80000000e+00, -3.00000000e+00, -1.52000000e+01, -2.03000000e+01, | ||
| -2.91000000e+01, -2.77000000e+01, -2.49000000e+01, -3.95000000e+01, | ||
| -4.19000000e+01, -5.19000000e+01, -6.07000000e+01, -6.27000000e+01, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
metpy/calc/tests/test_thermo.py
Outdated
| -2.80000000e+00, -3.00000000e+00, -1.52000000e+01, -2.03000000e+01, | ||
| -2.91000000e+01, -2.77000000e+01, -2.49000000e+01, -3.95000000e+01, | ||
| -4.19000000e+01, -5.19000000e+01, -6.07000000e+01, -6.27000000e+01, | ||
| -6.51000000e+01, -7.19000000e+01], 'degC') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
b019fb3 to
a793bc5
Compare
jrleeman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall - just need to add to the override file for CI's sake.
By not including the LCL in the profiles used in calculations, some odd corner cases result where, e.g., the intersection points with the ambient profile change. It also has an impact in cape/cin calculations. Refactor profile handling to explicitly work with a profile that includes the LCL and expose this as an API function.
With changes to LFC calculation to use a profile that includes the LCL, the old data does not match the test case of an uncapped sounding. Tweak a temperature to get back to that case, since that's what we want to test here.
Now that sfc cape/cin uses a profile that includes the LCL, this increases the amount of negative area in the profile, so we need to adjust the value here.
a793bc5 to
415c981
Compare
|
Done. |
jrleeman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix issue with SRH returning missing value instead of 0 for pos/neg parts of SRH. Works around Odd behavior with masked array sum() numpy/numpy#11736
Fix calc.lfc( ) bug report. #902. The sounding in question hits a corner case where the fact that were did not include the LCL in the calculated parcel profile significantly affected the intersection points with the sounding. The right thing to do is use the LCL in the profiles in these calculations (
lfc,el,surface_based_cape_cin) by default. As a result, this PR significantly refactors the profile calculation and adds an API function forparcel_profile_with_lclthat returns (pressure, temp, dew point, profile) all with the LCL included.Also fixes a couple tests impacted by the LCL change.