{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Create a PPI plot on a cartopy map\n\nAn example which creates a PPI plot of a file with a cartopy background\nand range rings\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(__doc__)\n\n# Author: Jason Hemedinger\n# License: BSD 3 clause\n\nimport cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nimport pyart\nfrom pyart.testing import get_test_data\n\n# Read in the file, create a RadarMapDisplay object\nfilename = get_test_data(\"nsaxsaprppiC1.a1.20140201.184802.nc\")\nradar = pyart.io.read(filename)\ndisplay = pyart.graph.RadarMapDisplay(radar)\n\n# Setting projection and ploting the second tilt\nprojection = ccrs.LambertConformal(\n central_latitude=radar.latitude[\"data\"][0],\n central_longitude=radar.longitude[\"data\"][0],\n)\n\nfig = plt.figure(figsize=(6, 6))\ndisplay.plot_ppi_map(\n \"reflectivity_horizontal\",\n 1,\n vmin=-20,\n vmax=20,\n min_lon=-157.1,\n max_lon=-156,\n min_lat=71.2,\n max_lat=71.6,\n lon_lines=np.arange(-158, -154, 0.2),\n resolution=\"10m\",\n lat_lines=np.arange(69, 72, 0.1),\n projection=projection,\n fig=fig,\n lat_0=radar.latitude[\"data\"][0],\n lon_0=radar.longitude[\"data\"][0],\n)\n\n# Plot range rings at 10, 20, 30, 40km\ndisplay.plot_range_ring(10.0, line_style=\"k-\")\ndisplay.plot_range_ring(20.0, line_style=\"k--\")\ndisplay.plot_range_ring(30.0, line_style=\"k-\")\ndisplay.plot_range_ring(40.0, line_style=\"k--\")\n\n# Plot cross hairs\ndisplay.plot_line_xy(\n np.array([-40000.0, 40000.0]), np.array([0.0, 0.0]), line_style=\"k-\"\n)\ndisplay.plot_line_xy(\n np.array([0.0, 0.0]), np.array([-20000.0, 200000.0]), line_style=\"k-\"\n)\n\n# Indicate the radar location with a point\ndisplay.plot_point(radar.longitude[\"data\"][0], radar.latitude[\"data\"][0])\n\nplt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.14.3" } }, "nbformat": 4, "nbformat_minor": 0 }