Skip to content

Conversation

@dopplershift
Copy link
Member

  1. 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

  2. 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 for parcel_profile_with_lcl that returns (pressure, temp, dew point, profile) all with the LCL included.

Also fixes a couple tests impacted by the LCL change.

@dopplershift dopplershift requested a review from jrleeman as a code owner August 26, 2018 04:39
@dopplershift dopplershift added Type: Bug Something is not working like it should Area: Calc Pertains to calculations labels Aug 26, 2018
@dopplershift dopplershift added this to the 0.9 milestone Aug 26, 2018
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')

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

-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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E241 multiple spaces after ','

'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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E241 multiple spaces after ','

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E241 multiple spaces after ','

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E241 multiple spaces after ','

-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')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E241 multiple spaces after ','

Copy link
Contributor

@jrleeman jrleeman left a 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.
@dopplershift
Copy link
Member Author

Done.

Copy link
Contributor

@jrleeman jrleeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jrleeman jrleeman merged commit cac1b2e into Unidata:master Aug 27, 2018
@dopplershift dopplershift deleted the thermo-calc-fixes branch August 27, 2018 19:03
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

Successfully merging this pull request may close these issues.

calc.lfc( ) bug report.

3 participants