-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2021 from 23ccozad/spc-example
SPC convective outlook example
- Loading branch information
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ pydata-sphinx-theme==0.5.2 | |
sphinx-gallery==0.9.0 | ||
myst-parser==0.15.1 | ||
netCDF4==1.5.7 | ||
geopandas==0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) 2021 MetPy Developers. | ||
# Distributed under the terms of the BSD 3-Clause License. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
""" | ||
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 <https://www.spc.noaa.gov/archive/>`_. | ||
""" | ||
|
||
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 | ||
|
||
########################### | ||
# 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[-75.21498337187248, 35.85713089454129], [-75.12, 35.649], [-75.166, 35.243], [-75.279, 34.984], [-75.429, 34.931], [-75.726, 34.857], [-76.265, 34.375], [-76.54, 34.248], [-76.776, 34.354], [-76.936, 34.358], [-77.521, 34.032], [-77.684, 33.615], [-77.95, 33.516], [-78.163, 33.577], [-78.569, 33.483], [-78.808, 33.309], [-78.931, 32.928], [-79.294, 32.69], [-79.725, 32.427], [-80.061, 32.203], [-80.21, 32.07], [-80.436, 31.966], [-80.764, 31.633], [-80.88894273127754, 31.29074889867841], [-80.88894273127754, 31.290748898678412], [-81.89, 31.31], [-83.38, 30.55], [-84.51, 29.94], [-85.04, 29.34], [-85.08376499074207, 29.2644059250819], [-85.336, 29.335], [-85.675, 29.436], [-85.767, 29.696], [-85.985, 29.876], [-86.462, 30.068], [-87.771, 29.878], [-88.406, 29.863], [-88.432, 29.714], [-88.695, 29.394], [-88.581, 29.249], [-88.619, 29.022], [-88.937, 28.691], [-89.175, 28.63], [-89.399, 28.577], [-89.712, 28.693], [-89.828, 28.916], [-90.102, 28.755], [-90.54, 28.711], [-90.745, 28.711], [-91.083, 28.732], [-91.315, 28.893], [-91.556, 28.983], [-91.655, 29.121], [-91.742, 29.058], [-92.079, 29.114], [-92.164, 29.181], [-92.629, 29.233], [-93.243, 29.441], [-93.588, 29.43], [-93.777, 29.35], [-93.961, 29.348], [-94.266, 29.222], [-94.502, 29.062], [-94.9, 28.808], [-95.134, 28.597], [-95.489, 28.428], [-96.044, 28.182], [-96.147, 28.055], [-96.427, 27.94], [-96.796, 27.579], [-97.017, 27.081], [-96.876, 26.595], [-96.749, 25.948], [-97.274, 25.953], [-97.396, 25.819], [-97.694, 26.005], [-98.202, 26.04], [-98.514, 26.191], [-99.017, 26.377], [-99.173, 26.54], [-99.298, 26.815], [-99.461, 27.078], [-99.505, 27.349], [-99.555, 27.605], [-99.67957046430763, 27.664953699399394], [-99.51, 29.8], [-98.39, 31.07], [-97.24, 32.41], [-96.88, 33.92], [-97.09, 34.33], [-97.34, 35.01], [-97.72, 35.49], [-99.16, 35.7], [-101.71, 35.33], [-102.95, 35.41], [-104.07, 36.66], [-101.48, 39.58], [-96.53, 41.15], [-91.73, 41.58], [-87.75, 41.57], [-84.23, 40.83], [-81.74, 39.99], [-79.95, 38.55], [-78.74, 37.15], [-76.53, 36.05], [-75.21498337187248, 35.85713089454129]]]]}, "properties": {"DN": 2, "VALID": "202103171200", "EXPIRE": "202103181200", "ISSUE": "202103170552", "LABEL": "TSTM", "LABEL2": "General Thunderstorms Risk", "stroke": "#55BB55", "fill": "#C1E9C1"}}, {"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[-85.71646162537326, 29.55317415866355], [-85.767, 29.696], [-85.985, 29.876], [-86.462, 30.068], [-87.771, 29.878], [-88.406, 29.863], [-88.432, 29.714], [-88.695, 29.394], [-88.581, 29.249], [-88.619, 29.022], [-88.937, 28.691], [-89.175, 28.63], [-89.399, 28.577], [-89.712, 28.693], [-89.828, 28.916], [-90.102, 28.755], [-90.54, 28.711], [-90.745, 28.711], [-91.083, 28.732], [-91.315, 28.893], [-91.556, 28.983], [-91.655, 29.121], [-91.742, 29.058], [-92.079, 29.114], [-92.164, 29.181], [-92.629, 29.233], [-93.243, 29.441], [-93.588, 29.43], [-93.777, 29.35], [-93.961, 29.348], [-94.266, 29.222], [-94.502, 29.062], [-94.9, 28.808], [-95.134, 28.597], [-95.489, 28.428], [-96.044, 28.182], [-96.147, 28.055], [-96.427, 27.94], [-96.796, 27.579], [-96.82458718812376, 27.514581811377248], [-97.98, 27.97], [-98.61, 28.63], [-98.56, 29.31], [-97.49, 30.0], [-96.66, 30.66], [-95.94, 32.2], [-95.99, 33.58], [-96.22, 34.73], [-96.88, 36.11], [-97.4, 37.08], [-98.13, 37.68], [-98.27, 38.18], [-97.2, 38.87], [-94.76, 39.62], [-92.85, 39.88], [-90.09, 39.38], [-88.03, 38.67], [-86.39, 37.36], [-83.86, 34.9], [-82.4, 33.39], [-82.08, 32.81], [-82.37, 32.26], [-82.76, 32.15], [-83.29, 31.97], [-83.78, 31.78], [-84.54, 31.18], [-85.71646162537326, 29.55317415866355]]]]}, "properties": {"DN": 3, "VALID": "202103171200", "EXPIRE": "202103181200", "ISSUE": "202103170552", "LABEL": "MRGL", "LABEL2": "Marginal Risk", "stroke": "#005500", "fill": "#66A366"}}, {"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[-85.95064553902712, 29.847633931306802], [-85.985, 29.876], [-86.462, 30.068], [-87.771, 29.878], [-88.406, 29.863], [-88.432, 29.714], [-88.695, 29.394], [-88.581, 29.249], [-88.619, 29.022], [-88.937, 28.691], [-89.175, 28.63], [-89.399, 28.577], [-89.712, 28.693], [-89.828, 28.916], [-90.102, 28.755], [-90.54, 28.711], [-90.745, 28.711], [-91.083, 28.732], [-91.315, 28.893], [-91.556, 28.983], [-91.655, 29.121], [-91.742, 29.058], [-92.079, 29.114], [-92.164, 29.181], [-92.629, 29.233], [-93.243, 29.441], [-93.588, 29.43], [-93.777, 29.35], [-93.961, 29.348], [-94.1303297224103, 29.27804739336493], [-94.68, 29.87], [-94.76, 31.31], [-95.0, 33.12], [-95.39, 34.75], [-95.73, 35.96], [-95.96, 36.86], [-95.33, 37.44], [-95.06, 37.72], [-94.16, 37.93], [-91.75, 37.94], [-89.54, 37.5], [-87.5, 36.62], [-85.26, 35.12], [-82.59, 32.84], [-82.87, 32.39], [-83.51, 32.2], [-83.97, 31.99], [-84.73, 31.39], [-85.95064553902712, 29.847633931306806], [-85.95064553902712, 29.847633931306802]]]]}, "properties": {"DN": 4, "VALID": "202103171200", "EXPIRE": "202103181200", "ISSUE": "202103170552", "LABEL": "SLGT", "LABEL2": "Slight Risk", "stroke": "#DDAA00", "fill": "#FFE066"}}, {"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[-88.4, 30.2], [-90.09, 29.87], [-91.6, 29.85], [-92.79, 29.94], [-93.69, 30.61], [-94.04, 31.75], [-94.3, 34.07], [-94.45, 35.99], [-94.41, 36.72], [-93.94, 37.22], [-93.27, 37.33], [-92.09, 37.33], [-90.58, 37.15], [-90.07, 36.99], [-88.49, 36.47], [-86.52, 35.47], [-85.71, 35.05], [-85.53, 34.85], [-84.97, 33.93], [-84.59, 33.07], [-84.57, 32.62], [-84.62, 31.94], [-85.11, 31.46], [-86.54, 30.69], [-88.4, 30.2]]]]}, "properties": {"DN": 5, "VALID": "202103171200", "EXPIRE": "202103181200", "ISSUE": "202103170552", "LABEL": "ENH", "LABEL2": "Enhanced Risk", "stroke": "#FF6600", "fill": "#FFA366"}}, {"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[-87.07, 31.68], [-88.65, 30.96], [-91.83, 30.52], [-92.83, 30.82], [-93.18, 31.77], [-92.65, 33.31], [-92.64, 35.22], [-91.74, 36.16], [-88.84, 35.53], [-86.13, 34.5], [-85.45, 33.01], [-86.0, 32.05], [-87.07, 31.68]]]]}, "properties": {"DN": 6, "VALID": "202103171200", "EXPIRE": "202103181200", "ISSUE": "202103170552", "LABEL": "MDT", "LABEL2": "Moderate Risk", "stroke": "#CC0000", "fill": "#E06666"}}, {"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[-91.88, 32.99], [-89.82, 34.4], [-88.19, 34.21], [-87.72, 33.46], [-88.23, 32.48], [-90.53, 32.0], [-91.74, 32.07], [-91.88, 32.99]]]]}, "properties": {"DN": 8, "VALID": "202103171200", "EXPIRE": "202103181200", "ISSUE": "202103170552", "LABEL": "HIGH", "LABEL2": "High Risk", "stroke": "#CC00CC", "fill": "#EE99EE"}}]} |