You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While MetPy's docs have an example that uses the declarative interface to plot a canned SPC outlook, here's one that pulls remote data for a given date/time:
fromdatetimeimportdatetimeimportgeopandasfrommetpy.cbookimportget_test_datafrommetpy.plotsimportadd_metpy_logo, MapPanel, PanelContainer, PlotGeometryimportnumpyasnpimportpandasaspdfromshapely.geometryimportMultiPoint# Full date and time; time only affects which convective outlook is pulleddt=datetime(2022, 12, 14, 20)
# Fetch and parse the outlook geojsonoutlook_url=f'https://www.spc.noaa.gov/products/outlook/archive/2022/day1otlk_{dt:%Y%m%d_%H00}_cat.lyr.geojson'day1_outlook=geopandas.read_file(outlook_url)
# Loop and fetch all the storm reports for that dateurl=f'https://www.spc.noaa.gov/climo/reports/{dt:%y%m%d}_rpts_raw_{{kind}}.csv'reports= [MultiPoint(np.array(pd.read_csv(url.format(kind=kind), skiprows=1)[['LON', 'LAT']]))
forkindin ('torn', 'hail', 'wind')]
# Set up plot using all of the presentation information in the geojsonoutlook_plot=PlotGeometry()
outlook_plot.geometry=day1_outlook['geometry']
outlook_plot.fill=day1_outlook['fill']
outlook_plot.stroke=day1_outlook['stroke']
outlook_plot.labels=day1_outlook['LABEL']
outlook_plot.label_fontsize='medium'# Hard-coded visual style to "match" SPCreport_plot=PlotGeometry()
report_plot.geometry=reportsreport_plot.fill= ['red', 'green', 'blue']
report_plot.marker='.'# Add elements to plotpanel=MapPanel()
panel.title=f'SPC Day 1 Convective Outlook (Valid {dt:%Hz %b %d %Y})'panel.plots= [outlook_plot, report_plot]
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]
add_metpy_logo(pc.figure, 15, 15, size='small')
pc.show()
The text was updated successfully, but these errors were encountered:
While MetPy's docs have an example that uses the declarative interface to plot a canned SPC outlook, here's one that pulls remote data for a given date/time:
The text was updated successfully, but these errors were encountered: