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

add downward cape #3120

Merged
merged 9 commits into from
Nov 14, 2023
Merged

add downward cape #3120

merged 9 commits into from
Nov 14, 2023

Conversation

wx4stg
Copy link
Contributor

@wx4stg wx4stg commented Jul 16, 2023

This adds downward CAPE for vertical profiles.

There is basically zero agreement on where a downdraft parcel starts. Based on Gilmore and Wicker, 1998, I've decided to find the minimum theta-e from 700 hPa to 500 hPa and start from there.

Scientific discussion is welcomed and encouraged.

  • Tests added
  • Fully documented

@wx4stg wx4stg requested a review from a team as a code owner July 16, 2023 18:12
@wx4stg wx4stg requested review from dcamron and removed request for a team July 16, 2023 18:12
@wx4stg
Copy link
Contributor Author

wx4stg commented Jul 16, 2023

I am so utterly confused as to why that is failing

@wx4stg
Copy link
Contributor Author

wx4stg commented Jul 28, 2023

I was totally unaware of this until now, but this closes #728 if implemented

@dopplershift
Copy link
Member

Does this relate in any way to #823?

@wx4stg
Copy link
Contributor Author

wx4stg commented Jul 28, 2023

it is the same as #823, oops, I didn't see that, I guess I had the wrong search terms.
How should I proceed?

@dopplershift
Copy link
Member

I'm happy to proceed here. #823 stalled out trying to replicate some values from SPC. How are we doing here?

@wx4stg
Copy link
Contributor Author

wx4stg commented Aug 8, 2023

So this does not attempt to recreate the SPC's method, I based the parcel start location as "get_layer between 500 and 700 hPa, find the data point with the lowest theta-e value."

Once the start point is identified, use moist_lapse to create a parcel trace, assuming the parcel is saturated and evaporating all the way to the surface. The parcel trace and provided environment profile are then virtual-temperature corrected (since the parcel is assumed to be saturated, dewpoint=temperature), and then use the "normal" CAPE formula to get the area between the parcel trace and the environment (DCAPE).

in the previous PR, #823, @kgoebber mentioned finding the LCL of a parcel between 500 and 700 hPa, as described by this NWS presentation. This produced (IMO) ridiclously high DCAPE values for the profiles I was testing with so I stopped doing that, but I'm open to discussion

@dopplershift dopplershift added this to the September 2023 milestone Aug 30, 2023
@kgoebber
Copy link
Collaborator

kgoebber commented Sep 14, 2023

Okay, so I have been able to play a little bit with this PR and here is what I found:

  1. The PR is based on sound science and I think it makes sense and is well documented - this solution will not replicate SPC values.
  2. I've compared the values for downdraft cape from this PR against the values in Add downdraft CAPE calculation #823 and here is what I found:
Source date (YYYYMMDDHH) station dCAPE (J/kg)
SPC 2018041712 OUN 1185
PR 3120 2018041712 OUN 1229
RAOB 2018041712 OUN 1397
SPC 2018041700 OUN 612
PR 3120 2018041700 OUN 777
RAOB 2018041700 OUN 893
SPC 2022081900 MFL 983
PR3120 2022081900 MFL 1034

So it seems that this version of downdraft CAPE falls between the method used by SPC and the one implemented in the RAOB program. Knowing that there is no one right answer, this PR seems to balance a number of factors and yields a value somewhere in the middle of other known dCAPE calculations.

My only suggestion at this point is do we want to name the function downdraft_cape instead of down_cape.

My only question is how does our naming convection work if someone would come along and propose a different dCAPE calculation (e.g., one that matches SPC or RAOB)?

@kgoebber
Copy link
Collaborator

@wx4stg the consensus on the MetPy call today was to call the function downdraft_cape as that seems to be the predominate way it has been documented in various places, including SPC. That is the only change needed as of now for this PR.

@sgdecker
Copy link
Contributor

I couldn't find the SPC method fleshed out in this or related issues, so for reference, here is the description from the SharpPy source code:

        Adapted from John Hart's (SPC) DCAPE code in NSHARP donated by Rich Thompson (SPC)

        Calculates the downdraft CAPE value using the downdraft parcel source found in the lowest
        400 mb of the sounding.  This downdraft parcel is found by identifying the minimum 100 mb layer
        averaged Theta-E.

        Afterwards, this parcel is lowered to the surface moist adiabatically (w/o virtual temperature
        correction) and the energy accumulated is called the DCAPE.

I agree with @kgoebber that there isn't a need to replicate the SPC calculation in general. It only would be important in the case someone was investigating a population of soundings and comparing that to a population of soundings analyzed in the literature by Thompson or others at SPC.

Copy link
Member

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

One minor nitpick and I think this is ready to go.

docs/_templates/overrides/metpy.calc.rst Outdated Show resolved Hide resolved
@dopplershift dopplershift added Type: Feature New functionality Area: Calc Pertains to calculations labels Nov 14, 2023
@dopplershift dopplershift merged commit eaa93e7 into Unidata:main Nov 14, 2023
38 checks passed
This was referenced Nov 14, 2023
@dopplershift
Copy link
Member

Thanks for the contribution @wx4stg !

@kylejgillett
Copy link
Contributor

Quick comment here.

I have been working on a project to implement DCIN (Downdraft Convective Inhibition) into SounderPy.

I have developed a DCIN calculation based on: https://rmets.onlinelibrary.wiley.com/doi/full/10.1002/asl.727.

I have done this "inside" the existing MetPy dcape function. Essentially, I use the diff variable to locate the "level of neutral buoyancy" (where diff is closest to zero), then I integrate again, from the "level of neutral buoyancy" to the sfc. This is the downdraft parcel equivalent of integrating between the LFC (essentially the "level of neutral bouyancy") and the LCL to find standard CIN.

Then I can thus return dcape, dcin, the parcel pressure trace, and parcel temperature trace. Some use DCIN as a way of determining the likelihood of severe downdraft winds in elevated convection environments.

Would this be of any interest to include in future MetPy releases?

@dopplershift
Copy link
Member

@kylejgillett That would be great! I'm not sure if there's a good way to add this to the existing function (without breaking API), so I'm not sure the details. Regardless, we can discuss that in a draft PR or, if you prefer, a separate issue.

@wx4stg
Copy link
Contributor Author

wx4stg commented Sep 25, 2024

I agree that this would be a nice feature to implement.

Some notes on the design of the current dcape function, it's currently written in a way that it gives everything needed to both calculate DCAPE and plot the downdraft parcel on a SkewT. However this doesn't really line up with how the API works with updraft parcels, where the user is expected to calculate the parcel trajectory and CAPE separately.

If I could go back to do it over again, I'd have a "downdraft_parcel" function where the user could specify whether they wanted minimum theta-e or most a particular level or something, and "downdraft_cape_cin" function which actually computes the integral, accepting a keyword arg for the parcel path (and if that's not provided, do some assumed default like generate one based on min theta-e)

This feels suspiciously close to touching #461...

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: Feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants