[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #GNH-263504]: simple example of usage metpy.calc.cape_cin()


Apologies for the delay. Here's some sample code that calculates the parcel 
profile for the surface parcel in the sounding, and uses that to calculate cape 
and cin using `cape_cin()`:

    from datetime import datetime
    import metpy.calc as mpcalc
    from metpy.units import pandas_dataframe_to_unit_arrays
    from siphon.simplewebservice.wyoming import WyomingUpperAir

    df = WyomingUpperAir.request_data(datetime(2013, 5, 20, 18), 'OUN')
    data = pandas_dataframe_to_unit_arrays(df)

    # Calculate the parcel profile, including the LCL--this interpolates the 
sounding to the level of the LCL
    # as well, so that the profile and all variables have the same points
    p, t, d, prof = mpcalc.parcel_profile_with_lcl(data['pressure'], 
data['temperature'], data['dewpoint'])

    cape, cin = mpcalc.cape_cin(p, t, d, prof)

Hope this helps,


> Hello
> I have a stupid question but I'm writing to you because I'm new with
> metpy and I don't know how to calculate cape. Do you have maby simple
> example of usage metpy.calc.cape_cin()? I was looking for it but I haven't
> found. If you have a simple example please share with me if you can. I
> will be very grateful.

Ticket Details
Ticket ID: GNH-263504
Department: Support Python
Priority: Low
Status: Closed
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.