AWIPS Tips: Create Sounding Plots with Model Data


Welcome back to AWIPS Tips! Today we’re going to take a look at another example of python-awips in use. If you aren’t familiar with python-awips, please check out some of our previous blog posts explaining some of the existing functionality. This blog entry will be focused on our notebook for plotting model sounding data.

When defining the data request object for this example, we use the modelsounding data type. This data type is slightly different from other model data, which uses the grid data type, in the sense that model names are not set with the setLocationName function. For modelsounding data, the model name is actually set using an identifier. This notebook is already written with the knowledge that “reportType” is the proper identifier for setting the model name. To see a full list of the available identifiers run:

req = DataAccessLayer.newDataRequest(“modelsounding”)

In this case, reportType is the only available identifier. You can also take a look at what all models are available for sounding data by using the getIdentifierValues function:

print(DataAccessLayer.getIdentifierValues(req, “reportType”))

Here we see there are only two values, ETA and GFS. In this example we are looking at GFS model sounding data; ETA is for NAM sounding data. In addition to setting the model name on our request, we also need to specify the parameters we’ll be interested in. These parameters provide the information we’ll need to properly calculate and plot the final skewT and hodograph.

Before we’re ready to send off the request to EDEX, we’ll further narrow the information we’re interested in. For this example, we do accomplish this by setting the location name and limiting the time we’re interested in. The location name is set to KFRM which is the municipal airport in Fairmont, Minnesota. The notebook also shows you how to view all the available locations if you’d like to look at the data for somewhere else. The time is filtered to the latest cycle and first forecast run (Hour 0). Now we’re ready to request the data!

Now that we have the data we specified from EDEX, we need to put it in a format that will be easy to use for the rest of the notebook. The first thing we do is create several numpy arrays for each of the different parameters we requested, then we populate each of these arrays from the EDEX response. This can all be seen in the Prepare Data Objects section. You’ll notice that we have two arrays for prs (prs2) and tmp (tmp2). This is because at some point our specific humidity (specHum) reaches 0, and at that point, our dewpoint calculations will fail because we’ll be dividing by zero. So, in order to avoid these errors, we’re only populating the sh array, and duplicate pressure and temperature arrays, when the specific humidity is not equal to zero. This will ensure we have the same length arrays for all three parameters, which is necessary later on when doing calculations.

Speaking of calculations, the very next thing we do is convert units for the temperature, pressure and wind speed (u and v) data returned from EDEX. These calculations are necessary in order to calculate dewpoint, and needed for our final skewT and hodograph plots.

Next, we offer multiple different ways to calculate the dewpoint. Like many things in programming and science, there is more than one way to accomplish something. Three methods are shown for how to calculate dewpoint from specific humidity (this is where the shortened temperature and pressure arrays come in handy). Two methods take advantage of functions from MetPy, and the third uses logic from previous GEMPAK solutions. All three produce very similar results, which are highlighted in the created plot.

Finally, we are ready to produce our skewT and hodograph plots.

SkewT and Hodograph plot of model sounding data

This example plots all three dewpoints, the temperature, an example of the 0 isotherm, and the corresponding wind barbs. You’ll notice the temperature (in red) and wind barbs are plotted for all pressures, but the dewpoint stops around 200HPa, this is where specific humidity goes to 0. Also shown in the bottom left, is a zoomed in portion of the dewpoint lines. This plot shows the three distinct lines and has a reference area outlined in gray at the bottom of the main dewpoint plot. The hodograph in the upper right displays values for all levels above ground.

This plot could be altered in many ways, and we would love to see if you modify the notebook in any way to produce more or different data. We may add your contribution to our example notebooks. Thank you for joining this week and we hope you learned something new about python-awips. Please check back in two weeks for the next blog post, introducing another new AWIPS learning resource!

To view archived blogs, visit the AWIPS Tips blog tag, and get notified of the latest updates from the AWIPS team by signing up for the AWIPS mailing list. Questions or suggestions for the team on future topics? Let us know at


Post a Comment:
  • HTML Syntax: Allowed
News and information from the Unidata Program Center
News and information from the Unidata Program Center



Developers’ blog

Take a poll!

What if we had an ongoing user poll in here?

Browse By Topic
Browse by Topic
« July 2024