Skip to content
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

Fixes and improvements for wet_bulb_temperature #1579

Merged
merged 2 commits into from
Nov 23, 2020

Conversation

dopplershift
Copy link
Member

Description Of Changes

This fixes wet_bulb_temperature to no longer error out on saturated conditions. This was caused by some corner cases in moist_lapse (not handling inputs of uniform pressures due to strict > and < checks). The best fix is to use the fact that moist_lapse (now) supports passing in explicitly the starting pressure, separate from the desired pressure(s). Also fix moist_lapse to work with all scalars.

While here, refactor wet_bulb_temperature for performance. Use the fact that lcl works on grids to pull that calculation out of the loop. Improves performance by ~10% for a profile with 120 levels.

Checklist

…#1332)

Turns out that moist_lapse did not cope with being given a uniform array
of pressures (which while not useful, should just return an array full
of the original temperature). This caused the wet_bulb_temperature
calculation to fail when conditions were saturated. Simplify by using
the support for passing a reference level explicitly to moist_lapse, and
only request the value for our desired pressure.
Take advantage of the fact that lcl supports operating on entire grids
to move it out of the loop. This shaves down the runtime for an average
profiles (~120 levels) by about 10%.
@dopplershift dopplershift added Area: Calc Pertains to calculations Type: Bug Something is not working like it should Type: Enhancement Enhancement to existing functionality labels Nov 21, 2020
@dopplershift dopplershift added this to the 1.0 milestone Nov 21, 2020
@dcamron dcamron merged commit 1f182af into Unidata:master Nov 23, 2020
@dopplershift dopplershift deleted the wetbulb branch November 23, 2020 20:58
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 Type: Enhancement Enhancement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"index out of bounds" error when attempting to calculate wet bulb temperatures
2 participants