AWIPS Tips: Create a Colored Surface Temperature Plot

AWIPS Tips

Welcome back to AWIPS Tips! This latest entry in the blog series has to do with another Jupyter Notebook for python-awips. We have previously released blogs about python-awips, specifically to do with accessing data, displaying and saving GOES imagery, and working with map resources. This notebook focuses on accessing and creating a colorized surface temperature plot of the continental United States.

While our other examples have all shown how to access data on the EDEX server by creating a connection and setting the datatype, this example also uses a geographic filter in the form of an envelope. The envelope is defined with the boundaries of the continental United States using a bounding box with the longitudes (in °E) and latitudes (in °N) listed in order, respectfully -- westernmost, easternmost, southernmost, northernmost, like the following:

bbox = [-130, -70, 15, 55]
envelope = Polygon([(bbox[0],bbox[2]),(bbox[0],bbox[3]),
            (bbox[1], bbox[3]),(bbox[1],bbox[2]),
            (bbox[0],bbox[2])])

and is passed into the EDEX search with this:

request = DataAccessLayer.newDataRequest("obs", envelope=envelope)

This allows the search to be more efficient and only bring back data within the boundaries of the geographic filter.

To further limit the data, we can use a time filter and reduce the scope to observations. For example, we can limit observations to only those within the last 15 minutes. The timerange is then passed into the Geometry Data query to get only the relevant data, using this:

response = DataAccessLayer.getGeometryData(request,timerange)
obs = DataAccessLayer.getMetarObs(response)

The temperature data we are accessing in this example is stored in degrees Celsius. To make a more understandable figure for those here in the United States, we convert the data from °C to °F with the following line:

tair = (tair*1.8)+32

The next step is to define a temperature mapping we will call the thresholds. This mapping correlates temperature ranges to colors. The ranges can be whatever you see fit, and should help make the plot easy to understand. We don't want all the temperatures to be drawn as the same color, so make sure the ranges for each color are not too large. You can also add or remove colors as you see fit. Our initial mapping looks like this:

thresholds = {
    '15': 'purple',
    '25': 'c',
    '35': 'royalblue',
    '45': 'darkgreen',
    '55': 'green',
    '65': 'y',
    '75': 'orange',
    '85': 'red'
}

Finally, we create a plot and draw all the colorized surface observations on the map at their locations with their corresponding colors. After reviewing the initial plot and temperature mapping, we can see that a few modifications need to be made to more clearly demonstrate differences in temperature. Using the slider in the figure below, compare the before and after images with their respective temperature mapping.

Thanks for joining us this week! We hope you download and experiment with the example notebooks provided with python-awips, and check back in two weeks for our annual recap and holiday cheers blog.

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

Comments:

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

Welcome

FAQs

Developers’ blog

Take a poll!

What if we had an ongoing user poll in here?

Browse By Topic
Browse by Topic
« December 2024
SunMonTueWedThuFriSat
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today