Plots and analyses atmospheric profile data from UWyo database
SkewT provides a few useful tools to help with the plotting and analysis of upper atmosphere data. In particular it provides some useful classes to handle the awkward skew-x projection (provided by Ryan May, see notes in source code and LICENSE.txt).
It’s most basic implementation is to read a text file of the format provided by the University of Wyoming’s website:
New in version 0.1.5 SkewT now comes packaged with some working examples. To try them out, download the tarball (big green button) and extract, navigate to SkewT/skewt, and run:
This should produce four SkewT plots, which should match the png files in the tarball under skewt/examples. I have also hosted the input and output files on my web page, so you can check them to see if they look right.
Once you have installed the package on your system, typical usage of SkewT often looks like this:
#!/usr/bin/env python from skewt import SkewT sounding = SkewT.Sounding(filename="soundingdata.txt") sounding.plot_skewt(color='r',lw=2)
Alternatively you may input the required data fields in a dictionary. The dictionary must have as a minimum the fields PRES and TEMP corresponding to pressure (hPa) and temperature (deg C). Soundings will typically have a dew point temperature trace and wind barbs as well, so it’s best to include the dewpoint temp DWPT (deg C), wind speed SKNT (knots) and wind direction in degrees WDIR. Other fields may be included as per the docstring:
#!/usr/bin/env python from skewt import SkewT sounding = SkewT.Sounding(data=data_dict) sounding.plot_skewt(color='r',lw=2)
One thing on my to-do list is to make the package a bit more user-friendly in that it will accept one of a number of moisture fields (e.g. dew-point temperature relative humidity, mixing ratio or vapour partial pressure) and fill in the others for you. For any moisture calculations, the module looks for DWPT, and if it’s not there it complains.
Thanks for your interest in this package and I’d love to hear your feedback: thomas.chubb AT monash.edu
Version 0.1.5 released! I mucked around with getting the examples incorporated in the package so much that it warranted an increment. No major functional changes since 0.1.4r5.
Here’s a summary of what’s new in Version 0.1.4:
- Version 0.1.4r5 (trivial). Included the examples! So now you should be able to run them as I originally intended.
- Version 0.1.4r3 (trivial). Gokhan asked me to fix the heights on the right axis so that they match the heights in the sounding file rather than the standard atmosphere. I’m still thinking about this, but in the mean time I have at least fixed the lowest level, so that the zmin corresponds to the highest plotted pressure (nominally 1050 hPa) according to the barometric formula (about -300m). And that’s all, she wrote.
- (Version 0.1.4r2) Bug fix in readfile. A long time ago I decided to ignore the diagnostics at the end of the University of Wyoming sounding files by chopping the last 34 lines from the file, so when a file containing only the raw data was used, it was truncated half-way up. This has been replaced by a routine that checks for valid pressure data in the right place.
- A major-ish change to the layout. I’m planning on adding more diagnostics as time goes by so I decided to get the test from the parcel and the column diagnostics out of the plot area.
- The new release contains a diagnostic for Total Precipitable Water (TPW). This is simply the total column-integrated water vapour, based on mixing ratio derived from DWPT. It uses a trapezoidal approximation for integration and gives values within about one percent of the values in the UWyo text files (I have no idea how UWyo do their diagnostic). More diagnostics to come!
The format for the sounding files is very specific (sorry). You are best off using the example in “examples” as a template. Here’s a sample of the first few lines:
94975 YMHB Hobart Airport Observations at 00Z 02 Jul 2013 ----------------------------------------------------------------------------- PRES HGHT TEMP DWPT RELH MIXR DRCT SKNT THTA THTE THTV hPa m C C % g/kg deg knot K K K ----------------------------------------------------------------------------- 1004.0 27 12.0 10.2 89 7.84 330 14 284.8 306.7 286.2 1000.0 56 12.4 10.3 87 7.92 325 16 285.6 307.8 286.9 993.0 115 12.8 9.7 81 7.66 311 22 286.5 308.1 287.9
The script defines columns by character number so you really do have to get the format exactly right. One day I will get around to writing a routine to output the text files properly.
Simple routine to calculate the characteristics of a parcel initialised with pressure, temperature and dew point temperature. You could do it like this:
from skewt import SkewT sounding=SkewT.Sounding("examples/94975.2013070200.txt") sounding.make_skewt_axes() sounding.add_profile(color='r',lw=2) sounding.lift_parcel(1004.,17.4,8.6) draw()
Automatic Parcel Definition
You can still manually input a parcel as in the example above, but there is a new routine to automagically define a parcel from the sounding itself. You define a layer depth that you would like to characterise (say 100mb). The routine surface_parcel then returns
- The surface pressure (just the pressure of the lowest level)
- The characteristic dew-point temperature (from the average Qv in the layer)
- The characteristic temperature (from the maximum Theta in the layer)
You could do it like this:
from skewt import SkewT sounding=SkewT.Sounding("examples/94975.2013070200.txt") sounding.make_skewt_axes() sounding.add_profile(color='r',lw=2) parcel=sounding.surface_parcel(mixheight=100.) sounding.lift_parcel(*parcel) draw()
The above steps are also now included in the Sounding.plot_skewt() wrapper for your convenience, so all of the above can be condensed with:
from skewt import SkewT sounding=SkewT.Sounding("examples/94975.2013070200.txt") sounding.plot_skewt(color='r',lw=2)
- More diagnostics.
- The Sounding.readfile() routine is much smarter now.
- User-friendly moisture variable handling. At the moment it’s best to just make sure that you include DWPT.
- Hodographs? Anyone?
- Gokhan Sever (North Carolina) is a keen user and has been encouraging me to add more stuff. One day soon we’ll put in a CAPE routine.
- Simon Caine.
- Hamish Ramsay (Monash) has promised to at least think about adding some extra diagnostics.
- The initial SkewX classes were provided by a fellow called Ryan May who was a student at OU. I have not made contact with Ryan other than to download his scripts and modify them for my own purposes.
- Thanks to Douglas Miller of UNC-Asheville, who prompted me to get the TPW routine up for a class exercise (yay!), and is checking for more bugs.