Re: [Matplotlib-users] CAPE and CIN calculation in Python

2014-03-29 Thread Alex Goodman
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  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


Re: [Matplotlib-users] pure Qt data visualization (not open source)

2014-03-29 Thread V. Armando Sole


On 28.03.2014 19:13, Pierre Haessig wrote:
> Hi,
>
> I just ran across this new Qt "add-on" for data visualization :
> blog.qt.digia.com/blog/2014/03/26/qt-data-visualization-1-0-released/
>
> It's a bit off-topic because I think there is not (yet?) a Python
> binding,

 From the PyQt mailing list:

"""
PyQtDataVisualization v1.0 has been released. These are Python bindings
for Digia's Qt Data Visualization library and PyQt5, see...

http://qt.digia.com/Product/Qt-Enterprise-Features/Advanced-Data-Visualization/

PyQtDataVisualization is bundled with PyQt. It is not available under 
an open source license.

Phil
"""

Anyways, being not open source products, the interest is limited.

For Qt the natural choice would be Qwt but then the problem would be to 
get a wrapper able to work with PySide, PyQt4 and PyQt5.

Because of those (an other) issues I am currently using matplotlib in 
my PyQt applications.

Armando

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] CAPE and CIN calculation in Python

2014-03-29 Thread Gökhan Sever
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


Re: [Matplotlib-users] colorsys.hsl_to_rgb(h, s, l), but not matplotlib.colors.hsl_to_rgb(array)

2014-03-29 Thread Alexander Heger
http://2sn.org/python3/color.py

On 30 March 2014 07:27, Emilia Petrisor  wrote:
> Hi all,
>
> While working  on this IPython Notebook
> http://nbviewer.ipython.org/github/empet/Math/blob/master/DomainColoring.ipynb
> I wanted to compare the visual images of the same complex-valued function
> generated by the classical domain coloring method, using HSV, respectively
> HSL color model.
>
> Unfortunately there is no matplotlib.colors.hsl_to_rgb(array)  function,
> only colorsys.hsl_to_rgb(h,s,l). The latter acts on each pixel and is time
> consuming.
>
> My question is, there is a special reason for which hsl_to_rgb is not
> implemented in matplotlib.colors for arrays?
>  I also looked in skimage.color
> http://scikit-image.org/docs/dev/api/skimage.color.html and couldn't find
> such a function.
>
> Is there a package containing such a conversion?
> Thank you!
>
> Em
>
>
>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] colorsys.hsl_to_rgb(h, s, l), but not matplotlib.colors.hsl_to_rgb(array)

2014-03-29 Thread Emilia Petrisor
Hi all,

While working  on this IPython Notebook
 
http://nbviewer.ipython.org/github/empet/Math/blob/master/DomainColoring.ipynb
I wanted to compare the visual images of the same complex-valued function
generated by the classical domain coloring method, using HSV, respectively
HSL color model.

Unfortunately there is no matplotlib.colors.hsl_to_rgb(array)  function,
only colorsys.hsl_to_rgb(h,s,l). The latter acts on each pixel and is time
consuming.

My question is, there is a special reason for which hsl_to_rgb is not
implemented in matplotlib.colors for arrays?
 I also looked in skimage.color
http://scikit-image.org/docs/dev/api/skimage.color.html and couldn't find
such a function.

Is there a package containing such a conversion?
Thank you!

Em
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] any existing method to plot array item on grid?

2014-03-29 Thread oyster
sometimes, we need to plot array value on a grid, for example
a=np.array([[1,3,5], [2,4,6]])
is shown as
+--+--+--+
|   1   |   3   |   5   |
 +--+--+--+
|   2   |   4   |   6   |
 +--+--+--+

Is there any ready-to-use method?

thanks
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users