Welcome back to AWIPS Tips! Today we’re going to take a look at another python-awips example notebook. This notebook deals with a special EDEX access method that uses ModelSounding objects in python-awips. We’ll see the importance of creating functions and how that allows us to quickly and easily compare output from different datasets.
We’ll set our EDEX connection first, and then define a few variables that will be used throughout the notebook:
- Model name
- Location (point defined with longitude and latitude)
- Time (defined with run and forecast times)
NOTE: Try defining a different location and see how the output changes.
Next we define three separate functions that will be used several times:- get_surface_data
- get_levels_data
- plot_skewT
get_surface_data
This function is used to get the ModelSounding data at the surface level. We specify the model name, location, and time (from the variables we set earlier), and it returns arrays for pressure, temperature, dewpoint, and u and v components of wind. These arrays will then be used when we retrieve the additional data for pressure levels above the ground.
get_levels_data
This function builds on the output from the previous function, and continues to populate the arrays for pressure, temperature, dewpoint, and wind. The finalized arrays will be critical for plotting and visualizing our soundings.
plot_skewt
This function is used to plot the skewT and hodographs for the data we’ve retrieved from EDEX. It takes advantage of the powers of MetPy.
Now that we have our functions defined, collecting the necessary data for the soundings is as easy as two lines:
p,t,d,u,v = get_surface_data(model,point,timeRange)
p,t,d,u,v,w = get_levels_data(model,point,timeRange,p,t,d,u,v)
We take the output arrays from that and the timeRange object defined at the beginning, and plot with this simple line:
plot_skewT(model, p, t, d, u, v, w, timeRange[0])
Our output looks like this:
Now that we have this process worked out, we can easily cycle through several different models, retrieve the data, and visualize them. In this notebook we also look at RAP13 and GFS20 data, but try it out for yourself and see the other model sounding data from our EDEX.
Thanks for joining us and check back in two weeks for the next blog post.
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 support-awips@unidata.ucar.edu