.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plots/spc_convective_outlook.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_plots_spc_convective_outlook.py: 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 `_. .. GENERATED FROM PYTHON SOURCE LINES 13-19 .. code-block:: Python import geopandas from metpy.cbook import get_test_data from metpy.plots import MapPanel, PanelContainer, PlotGeometry .. GENERATED FROM PYTHON SOURCE LINES 20-21 Read in the geoJSON file containing the convective outlook. .. GENERATED FROM PYTHON SOURCE LINES 21-23 .. code-block:: Python day1_outlook = geopandas.read_file(get_test_data('spc_day1otlk_20210317_1200_lyr.geojson')) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Preview the data. .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: Python day1_outlook .. raw:: html
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 ...


.. GENERATED FROM PYTHON SOURCE LINES 28-31 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. .. GENERATED FROM PYTHON SOURCE LINES 31-38 .. code-block:: Python 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' .. GENERATED FROM PYTHON SOURCE LINES 39-40 Add the geometry plot to a panel and container. .. GENERATED FROM PYTHON SOURCE LINES 40-51 .. code-block:: Python 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() .. image-sg:: /examples/plots/images/sphx_glr_spc_convective_outlook_001.png :alt: SPC Day 1 Convective Outlook (Valid 12z Mar 17 2021) :srcset: /examples/plots/images/sphx_glr_spc_convective_outlook_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.574 seconds) .. _sphx_glr_download_examples_plots_spc_convective_outlook.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: spc_convective_outlook.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: spc_convective_outlook.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: spc_convective_outlook.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_