You can easily visualize the CAPE and CIN with matplotlib using
fill_between() on the environmental and parcel temperature curves. As for
actually calculating it though, I don't know of a way to do it directly
from matplotlib. There are probably several other python packages out there
that can, but I am not familiar with them. In any case, why not just write
your own function for calculating the CAPE and CIN? It is a bit surprising
that this functionality isn't be included in the SkewT package, but since
you can use it to get the parcel temperature curve, you should be able to
calculate the CAPE and CIN rather easily by simply discretizing their
respective formulas. Here's a rough example:

import numpy as np
cape = 9.8 * np.sum(dz * (Tp - T) / T)

Where Tp and T are the parcel and environmental temperature arrays
respectively, and dz are the height differences between layers. You would
of course need to perform the sum from the LFC to EL for CAPE, so the
arrays would have to to be subsetted. With numpy the easiest way to do this
is with fancy indexing, eg:

levs = (z >= LFC) & (z <= EL)
Tp = Tp[levs]
T = T[levs]
where z is your array of heights (or pressure levels).

Does this help?

Alex


On Sat, Mar 29, 2014 at 4:32 PM, Gökhan Sever <gokhanse...@gmail.com> wrote:

> Hello,
>
> Lately, I am working on plotting sounding profiles on a SkewT/LogP
> diagram. The SkewT package which is located at
> https://github.com/tchubb/SkewT has a nice feature to lift a parcel on
> dry/moist adiabats. This is very useful to demonstrate the regions of CIN
> and CAPE overlaid with the full sounding.
>
> However, the package misses these diagnostic calculations. This is the
> only step holding me back to use Python only (migrating from NCL) for my
> plotting tasks.  I am aware that these calculations are usually performed
> in fortran. Are there any routines wrapped in Python to calculate CAPE and
> CIN parameters?  Any suggestions or comments would be really appreciated.
>
> --
> Gökhan
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>


-- 
Alex Goodman
Graduate Research Assistant
Department of Atmospheric Science
Colorado State University
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to