# Skew-T

(Sorry if this is a duplicate)

Hi,

I'm trying to make a Skew-T LogP plot, an important plot in meteorology, using matplotlib (mainly to help convert people away from much more horrible solutions). You can see one here: http://www.rap.ucar.edu/weather/upper/oun.gif

and more cartoonish:
http://www.srh.noaa.gov/oun/images/figure6.gif

(Pay attention only to the lower part with the bold red and green lines). I'm pretty sure matplotlib can't currently do this, but it shouldn't be too hard. The crux of the plot is that you plot temperature as a function of pressure, with pressure reversed and logarithmically spaced on the Y-axis (ie. high pressure at the bottom) and temperature plotted skewed along the X axis. That is, the lines of constant temperature intersect the bottom at 45 degree angles. I know matplotlib can do log axes, so how hard would it be for me to create a transform that can handle the 45 degree skew of the temperature?

Thanks,

Ryan

···

--
Ryan May
School of Meteorology
University of Oklahoma

Ryan May wrote:

(Sorry if this is a duplicate)

Hi,

I'm trying to make a Skew-T LogP plot, an important plot in meteorology, using matplotlib (mainly to help convert people away from much more horrible solutions). You can see one here: http://www.rap.ucar.edu/weather/upper/oun.gif

and more cartoonish:
http://www.srh.noaa.gov/oun/images/figure6.gif

(Pay attention only to the lower part with the bold red and green lines). I'm pretty sure matplotlib can't currently do this, but it shouldn't be too hard. The crux of the plot is that you plot temperature as a function of pressure, with pressure reversed and logarithmically spaced on the Y-axis (ie. high pressure at the bottom) and temperature plotted skewed along the X axis. That is, the lines of constant temperature intersect the bottom at 45 degree angles. I know matplotlib can do log axes, so how hard would it be for me to create a transform that can handle the 45 degree skew of the temperature?

Thanks,

Ryan

Ryan: I'm sure you could do it, and it would be a nice contribution to the community. There's some IDL code here

http://cimss.ssec.wisc.edu/camex3/archive/quicklooks/

you could work from. There's also NCL code (couldn't find it on the web, but the source code comes with NCL). I'd suggest working from those. I don't think you need transforms (although they might make it easier), since neither of those languages has them.

HTH,

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328

Jeff Whitaker wrote:

Ryan May wrote:

(Sorry if this is a duplicate)

Hi,

I'm trying to make a Skew-T LogP plot, an important plot in meteorology, using matplotlib (mainly to help convert people away from much more horrible solutions). You can see one here: http://www.rap.ucar.edu/weather/upper/oun.gif

and more cartoonish:
http://www.srh.noaa.gov/oun/images/figure6.gif

(Pay attention only to the lower part with the bold red and green lines). I'm pretty sure matplotlib can't currently do this, but it shouldn't be too hard. The crux of the plot is that you plot temperature as a function of pressure, with pressure reversed and logarithmically spaced on the Y-axis (ie. high pressure at the bottom) and temperature plotted skewed along the X axis. That is, the lines of constant temperature intersect the bottom at 45 degree angles. I know matplotlib can do log axes, so how hard would it be for me to create a transform that can handle the 45 degree skew of the temperature?

Thanks,

Ryan

Ryan: I'm sure you could do it, and it would be a nice contribution to the community. There's some IDL code here

http://cimss.ssec.wisc.edu/camex3/archive/quicklooks/

you could work from. There's also NCL code (couldn't find it on the web, but the source code comes with NCL). I'd suggest working from those. I don't think you need transforms (although they might make it easier), since neither of those languages has them.
HTH,

-Jeff

(Sending to the list this time. Oops)

Thanks. I also managed to find a matlab implementation, which was straightforward to port over. I'm working on fleshing out the full Skew-T look right now. As far as using the transforms, here's the question: Does anyone besides the meteorologists have a need for a plot with a skewed axis? If so, it might pay to make this general. Otherwise, this could stay as a specific Skew-T LogP plot. If the latter is the case, does it make sense to include such a method anywhere in Matplotlib? I guess if nothing else it could go in as an example.

Opinions?

Ryan

···

--
Ryan May
School of Meteorology
University of Oklahoma

--
Ryan May
School of Meteorology
University of Oklahoma

Ryan May wrote:

Thanks. I also managed to find a matlab implementation, which was straightforward to port over. I'm working on fleshing out the full Skew-T look right now. As far as using the transforms, here's the question: Does anyone besides the meteorologists have a need for a plot with a skewed axis? If so, it might pay to make this general. Otherwise, this could stay as a specific Skew-T LogP plot. If the latter is the case, does it make sense to include such a method anywhere in Matplotlib? I guess if nothing else it could go in as an example.

Ryan,

I think that it would make the most sense as an example; it seems too specialized to be suitable as an axes method, and I tend to think we already have too many of those as it is.

It would be especially valuable if you can do it using the transforms machinery, as a new projection, but this would require more work on your part; it would be less of a direct translation of code from other languages. If you have not already done so, look at examples/api/custom_projection_example.py in svn.

Eric

Eric Firing wrote:

Ryan May wrote:

Thanks. I also managed to find a matlab implementation, which was straightforward to port over. I'm working on fleshing out the full Skew-T look right now. As far as using the transforms, here's the question: Does anyone besides the meteorologists have a need for a plot with a skewed axis? If so, it might pay to make this general. Otherwise, this could stay as a specific Skew-T LogP plot. If the latter is the case, does it make sense to include such a method anywhere in Matplotlib? I guess if nothing else it could go in as an example.

Ryan,

I think that it would make the most sense as an example; it seems too specialized to be suitable as an axes method, and I tend to think we already have too many of those as it is.

It would be especially valuable if you can do it using the transforms machinery, as a new projection, but this would require more work on your part; it would be less of a direct translation of code from other languages. If you have not already done so, look at examples/api/custom_projection_example.py in svn.

Yeah, the projection approach is what I'm planning on using. Unfortunately, I can't use any of that immediately because Gentoo is stuck on Matplotlib 0.91.2 and Numpy 1.0.4. Once, Numpy 1.1 is in the tree, I can move to the latest matplotlib (even SVN), and then move over too it. In the meanwhile, I've at least looked over that code, and it looks promising. Half the problem has been figuring out the bizarre nature of the Skew-T LogP.

Ryan

···

--
Ryan May
School of Meteorology
University of Oklahoma

Just a note of caution: if you want to write something that will be
included in matplotlib or a toolkit, you need to be mindful of the
licenses of code you are looking at. While matplotlib has replicated
to an extent the names and signatures of many matlab functions, we
haven't looked at any of their code. A lot of IDL and matlab code
comes with restrictive licenses, so make sure you are not violating
the terms of those licenses for any code that might be suitable for
contribution.

Thanks,
JDH

···

On Fri, Jun 13, 2008 at 3:28 PM, Ryan May <rmay31@...149...> wrote:

Ryan: I'm sure you could do it, and it would be a nice contribution to
the community. There's some IDL code here

Thanks. I also managed to find a matlab implementation, which was
straightforward to port over. I'm working on fleshing out the full

John Hunter wrote:

···

On Fri, Jun 13, 2008 at 3:28 PM, Ryan May <rmay31@...149...> wrote:

Ryan: I'm sure you could do it, and it would be a nice contribution to
the community. There's some IDL code here

Thanks. I also managed to find a matlab implementation, which was
straightforward to port over. I'm working on fleshing out the full

Just a note of caution: if you want to write something that will be
included in matplotlib or a toolkit, you need to be mindful of the
licenses of code you are looking at. While matplotlib has replicated
to an extent the names and signatures of many matlab functions, we
haven't looked at any of their code. A lot of IDL and matlab code
comes with restrictive licenses, so make sure you are not violating
the terms of those licenses for any code that might be suitable for
contribution.

Yeah, I'm aware of this. The code I mention, however, is taken from meteorology class assignment. Also, in this case, I'm really only using it for a reference on how to do the "skew" calculation. The code is *far* too ugly to directly port.

I can appreciate the need for caution however.

Ryan

--
Ryan May