
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/plotting/plot_xsect.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_xsect.py>`
        to download the full example code.

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

.. _sphx_glr_examples_plotting_plot_xsect.py:


=======================================
Plot a cross section from  a PPI volume
=======================================

An example which extracts a cross section at two azimuth angles from a volume
of PPI scans and plots both cross sections.

.. GENERATED FROM PYTHON SOURCE LINES 10-46



.. image-sg:: /examples/plotting/images/sphx_glr_plot_xsect_001.png
   :alt: xsapr-sg 225.0 Deg. 2011-05-20T06:42:20.859075Z  Equivalent reflectivity factor, xsapr-sg 270.0 Deg. 2011-05-20T06:42:22.830890Z  Equivalent reflectivity factor
   :srcset: /examples/plotting/images/sphx_glr_plot_xsect_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 pyart
    from pyart.testing import get_test_data

    # Read the data, a cfradial file
    filename = get_test_data("swx_20120520_0641.nc")
    radar = pyart.io.read(filename)

    # Create a cross section at 225 and 270 degrees azimuth
    xsect = pyart.util.cross_section_ppi(radar, [225, 270])

    # Set the colorbar label
    colorbar_label = "Equivalent \n reflectivity factor \n (dBZ)"

    display = pyart.graph.RadarDisplay(xsect)
    fig = plt.figure()
    ax1 = fig.add_subplot(211)
    display.plot(
        "reflectivity_horizontal", 0, vmin=-32, vmax=64.0, colorbar_label=colorbar_label
    )
    plt.ylim(0, 15)
    ax2 = fig.add_subplot(212)
    display.plot(
        "reflectivity_horizontal", 1, vmin=-32, vmax=64.0, colorbar_label=colorbar_label
    )
    plt.ylim(0, 15)

    plt.tight_layout()
    plt.show()


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

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


.. _sphx_glr_download_examples_plotting_plot_xsect.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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