Skip to content

FIX: add exception handling for when CAPE and CIN cannot be calculated#1031

Open
cgodine wants to merge 2 commits into
ARM-DOE:mainfrom
cgodine:bugfix/cape-cin-calculation
Open

FIX: add exception handling for when CAPE and CIN cannot be calculated#1031
cgodine wants to merge 2 commits into
ARM-DOE:mainfrom
cgodine:bugfix/cape-cin-calculation

Conversation

@cgodine

@cgodine cgodine commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
  • PEP8 Standards or use of linter

When attempting to calculate stability indices for a sonde profile with an LCL above the top of the temperature profile, an IndexError is raised because the environmental profile never intersects with the LCL (see below image for an example).

dstsondewnpnM1 b1 enhanced_skewt 173000 20260705

This means that metpy.calc cannot interpolate a parcel profile and thus cannot calculate CAPE or CIN values. In this case, the CAPE and CIN values will be set to np.nan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant