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

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

.. _sphx_glr_examples_plotting_plot_ppi_with_rings.py:


==================================
Create a PPI plot on a cartopy map
==================================

An example which creates a PPI plot of a file with a cartopy background
and range rings

.. GENERATED FROM PYTHON SOURCE LINES 10-71



.. image-sg:: /examples/plotting/images/sphx_glr_plot_ppi_with_rings_001.png
   :alt: xsapr-nsar1 0.5 Deg. 2014-02-01T18:48:28.084000Z  Equivalent reflectivity factor
   :srcset: /examples/plotting/images/sphx_glr_plot_ppi_with_rings_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    print(__doc__)

    # Author: Jason Hemedinger
    # License: BSD 3 clause

    import cartopy.crs as ccrs
    import matplotlib.pyplot as plt
    import numpy as np

    import pyart
    from pyart.testing import get_test_data

    # Read in the file, create a RadarMapDisplay object
    filename = get_test_data("nsaxsaprppiC1.a1.20140201.184802.nc")
    radar = pyart.io.read(filename)
    display = pyart.graph.RadarMapDisplay(radar)

    # Setting projection and ploting the second tilt
    projection = ccrs.LambertConformal(
        central_latitude=radar.latitude["data"][0],
        central_longitude=radar.longitude["data"][0],
    )

    fig = plt.figure(figsize=(6, 6))
    display.plot_ppi_map(
        "reflectivity_horizontal",
        1,
        vmin=-20,
        vmax=20,
        min_lon=-157.1,
        max_lon=-156,
        min_lat=71.2,
        max_lat=71.6,
        lon_lines=np.arange(-158, -154, 0.2),
        resolution="10m",
        lat_lines=np.arange(69, 72, 0.1),
        projection=projection,
        fig=fig,
        lat_0=radar.latitude["data"][0],
        lon_0=radar.longitude["data"][0],
    )

    # Plot range rings at 10, 20, 30, 40km
    display.plot_range_ring(10.0, line_style="k-")
    display.plot_range_ring(20.0, line_style="k--")
    display.plot_range_ring(30.0, line_style="k-")
    display.plot_range_ring(40.0, line_style="k--")

    # Plot cross hairs
    display.plot_line_xy(
        np.array([-40000.0, 40000.0]), np.array([0.0, 0.0]), line_style="k-"
    )
    display.plot_line_xy(
        np.array([0.0, 0.0]), np.array([-20000.0, 200000.0]), line_style="k-"
    )

    # Indicate the radar location with a point
    display.plot_point(radar.longitude["data"][0], radar.latitude["data"][0])

    plt.show()


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

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


.. _sphx_glr_download_examples_plotting_plot_ppi_with_rings.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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