NOAA SPC Convective Outlook#

Demonstrate the use of geoJSON and shapefile data with PlotGeometry in MetPy’s simplified plotting interface. This example walks through plotting the Day 1 Convective Outlook from NOAA Storm Prediction Center. The geoJSON file was retrieved from the Storm Prediction Center’s archives.

import geopandas

from metpy.cbook import get_test_data
from metpy.plots import MapPanel, PanelContainer, PlotGeometry

Read in the geoJSON file containing the convective outlook.

day1_outlook = geopandas.read_file(get_test_data('spc_day1otlk_20210317_1200_lyr.geojson'))

Preview the data.

day1_outlook
DN VALID EXPIRE ISSUE LABEL LABEL2 stroke fill geometry
0 2 202103171200 202103181200 202103170552 TSTM General Thunderstorms Risk #55BB55 #C1E9C1 MULTIPOLYGON (((-75.21498 35.85713, -75.12000 ...
1 3 202103171200 202103181200 202103170552 MRGL Marginal Risk #005500 #66A366 MULTIPOLYGON (((-85.71646 29.55317, -85.76700 ...
2 4 202103171200 202103181200 202103170552 SLGT Slight Risk #DDAA00 #FFE066 MULTIPOLYGON (((-85.95065 29.84763, -85.98500 ...
3 5 202103171200 202103181200 202103170552 ENH Enhanced Risk #FF6600 #FFA366 MULTIPOLYGON (((-88.40000 30.20000, -90.09000 ...
4 6 202103171200 202103181200 202103170552 MDT Moderate Risk #CC0000 #E06666 MULTIPOLYGON (((-87.07000 31.68000, -88.65000 ...
5 8 202103171200 202103181200 202103170552 HIGH High Risk #CC00CC #EE99EE MULTIPOLYGON (((-91.88000 32.99000, -89.82000 ...


Plot the shapes from the ‘geometry’ column. Give the shapes their fill and stroke color by providing the ‘fill’ and ‘stroke’ columns. Use text from the ‘LABEL’ column as labels for the shapes.

geo = PlotGeometry()
geo.geometry = day1_outlook['geometry']
geo.fill = day1_outlook['fill']
geo.stroke = day1_outlook['stroke']
geo.labels = day1_outlook['LABEL']
geo.label_fontsize = 'large'

Add the geometry plot to a panel and container.

panel = MapPanel()
panel.title = 'SPC Day 1 Convective Outlook (Valid 12z Mar 17 2021)'
panel.plots = [geo]
panel.area = [-120, -75, 25, 50]
panel.projection = 'lcc'
panel.layers = ['lakes', 'land', 'ocean', 'states', 'coastline', 'borders']

pc = PanelContainer()
pc.size = (12, 8)
pc.panels = [panel]
pc.show()
SPC Day 1 Convective Outlook (Valid 12z Mar 17 2021)

Total running time of the script: ( 0 minutes 7.746 seconds)

Gallery generated by Sphinx-Gallery