{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Create a two panel RHI plot\n\nAn example which creates a two panel RHI plot of a cfradial file. The fields\nincluded in the two panels are reflectivity and doppler velocity.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(__doc__)\n\n# Author: Max Grover (mgrover@anl.gov)\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nimport pyart\nfrom pyart.testing import get_test_data\n\n# Read the data and create the display object\nfilename = get_test_data(\"sgpxsaprrhicmacI5.c0.20110524.015604_NC4.nc\")\nradar = pyart.io.read_cfradial(filename)\ndisplay = pyart.graph.RadarDisplay(radar)\n\n# Fields to plot and ranges\nfields_to_plot = [\"reflectivity_horizontal\", \"mean_doppler_velocity\"]\nranges = [(-20, 20), (-17.0, 17.0)]\ncmaps = [\"HomeyerRainbow\", \"balance\"]\n\n# Plot the data\nnplots = len(fields_to_plot)\nplt.figure(figsize=[5 * nplots, 4])\n\n# Plot each field\nfor plot_num in range(nplots):\n field = fields_to_plot[plot_num]\n vmin, vmax = ranges[plot_num]\n cmap = cmaps[plot_num]\n\n plt.subplot(1, nplots, plot_num + 1)\n display.plot(field, 0, vmin=vmin, vmax=vmax, title_flag=False, cmap=cmap)\n display.set_limits(ylim=[0, 17])\n\n# Grab the fixed angle and time from the first sweep\nfixed_angle = radar.fixed_angle[\"data\"][0]\ntime = radar.time[\"units\"][13:]\n\n# Add the metadata to the title\nplt.suptitle(\n f\"Reflectivity and Velocity \\n Azimuth: {np.around(fixed_angle, 3)}\\u00b0 {time} UTC\"\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 }