.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/maps/plot_hmssmoke.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_auto_examples_maps_plot_hmssmoke.py: Plot Smoke Polygons =================== Get HMS Smoke from RSIG and create daily plots. .. GENERATED FROM PYTHON SOURCE LINES 7-17 .. code-block:: default import matplotlib.pyplot as plt import matplotlib.colors as mc import pandas as pd import pycno import pyrsig cno = pycno.cno() api = pyrsig.RsigApi() .. GENERATED FROM PYTHON SOURCE LINES 18-20 Retrieve data from RSIG (or cache) ---------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 20-28 .. code-block:: default hmsfs = [] dates = pd.date_range('2023-06-12', '2023-06-15') for bdate in dates: hmsf = api.to_dataframe("hms.smoke", bdate=bdate) hmsfs.append(hmsf) hmsf = pd.concat(hmsfs) .. GENERATED FROM PYTHON SOURCE LINES 29-31 Make Plot --------- .. GENERATED FROM PYTHON SOURCE LINES 31-64 .. code-block:: default # set up colormap and normalization levels = [0, 7.5, 20, 35] colors = ['green', 'yellow', 'red'] cmap, norm = mc.from_levels_and_colors(levels, colors) # create multipanel figure gskw = dict(left=0.05, right=0.915, bottom=0.05, top=0.9) fig, axx = plt.subplots( 2, 2, figsize=(11, 8), gridspec_kw=gskw, sharex=True, sharey=True ) # add axes for colorbar cax = fig.add_axes([0.925, 0.1, 0.025, 0.8]) # add maps to each panel for di, date in enumerate(dates): jdate = date.strftime('%Y%j') ax = axx.ravel()[di] plotf = hmsf.query(f'YYYYDDD1 == {jdate}').sort_values(['DENS_UGM3']) plotf.plot('DENS_UGM3', cmap=cmap, norm=norm, ax=ax, aspect=None) topts = dict(size=16, transform=ax.transAxes, bbox=dict(facecolor='white')) ax.text(0.02, 0.04, date.strftime('%F'), **topts) cno.drawstates(ax=ax) # set extent to data extent ax.set(xlim=api.bbox[::2], ylim=api.bbox[1::2]) # add colorbar with categories cb = fig.colorbar(ax.collections[0], cax=cax, ticks=[3.25, 13.75, 27.5]) cb.ax.set_yticklabels( ['Light', 'Medium', 'Heavy'], rotation=90, verticalalignment='center', size=16 ) fig.suptitle('HMS Smoke Qualitative Categories from GOES', size=20) fig.savefig('hms_smoke.png') .. image-sg:: /auto_examples/maps/images/sphx_glr_plot_hmssmoke_001.png :alt: HMS Smoke Qualitative Categories from GOES :srcset: /auto_examples/maps/images/sphx_glr_plot_hmssmoke_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 3.175 seconds) .. _sphx_glr_download_auto_examples_maps_plot_hmssmoke.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_hmssmoke.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_hmssmoke.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_