
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/plotting/plot_rhi_cfradial.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_plotting_plot_rhi_cfradial.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_plotting_plot_rhi_cfradial.py:


======================================================
Create a multiple panel RHI plot from a CF/Radial file
======================================================

An example which creates a multiple panel RHI plot of a CF/Radial file using
a RadarDisplay object.

.. GENERATED FROM PYTHON SOURCE LINES 10-63



.. image-sg:: /examples/plotting/images/sphx_glr_plot_rhi_cfradial_001.png
   :alt: HSRHI Az=37.299, HSRHI Az=67.302, HSRHI Az=97.300, HSRHI Az=127.299, HSRHI Az=157.302, HSRHI Az=187.300
   :srcset: /examples/plotting/images/sphx_glr_plot_rhi_cfradial_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    print(__doc__)

    # Author: Jonathan J. Helmus (jhelmus@anl.gov)
    # License: BSD 3 clause

    import matplotlib.pyplot as plt
    import netCDF4

    import pyart
    from pyart.testing import get_test_data

    filename = get_test_data("sgpxsaprrhicmacI5.c0.20110524.015604_NC4.nc")

    # create the plot using RadarDisplay
    radar = pyart.io.read_cfradial(filename)
    radar.metadata["instrument_name"] = "XSARP"
    display = pyart.graph.RadarDisplay(radar)

    fig = plt.figure(figsize=[12, 17])
    fig.subplots_adjust(hspace=0.4)
    xlabel = "Distance from radar (km)"
    ylabel = "Height agl (km)"
    colorbar_label = "Hz. Eq. Refl. Fac. (dBZ)"
    nplots = radar.nsweeps

    for snum in radar.sweep_number["data"]:
        fixed_angle = radar.fixed_angle["data"][snum]
        title = f"HSRHI Az={fixed_angle:.3f}"
        ax = fig.add_subplot(nplots, 1, snum + 1)
        display.plot(
            "reflectivity_horizontal",
            snum,
            vmin=-20,
            vmax=20,
            mask_outside=False,
            title=title,
            axislabels=(xlabel, ylabel),
            colorbar_label=colorbar_label,
            ax=ax,
        )
        display.set_limits(ylim=[0, 15], ax=ax)

    time_start = netCDF4.num2date(
        radar.time["data"][0],
        radar.time["units"],
        only_use_cftime_datetimes=False,
        only_use_python_datetimes=True,
    )
    figure_title = "Time: " + time_start.isoformat() + "Z"
    fig.text(0.35, 0.92, figure_title)

    plt.show()


.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_examples_plotting_plot_rhi_cfradial.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_rhi_cfradial.ipynb <plot_rhi_cfradial.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_rhi_cfradial.py <plot_rhi_cfradial.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_rhi_cfradial.zip <plot_rhi_cfradial.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
