{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Map two radars to a Cartesian grid\n\nMap the reflectivity field of two nearby ARM XSARP radars from antenna\ncoordinates to a Cartesian grid.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(__doc__)\n\n# Author: Jonathan J. Helmus (jhelmus@anl.gov)\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\n\nimport pyart\nfrom pyart.testing import get_test_data\n\n# read in the data from both XSAPR radars\nxsapr_sw_file = get_test_data(\"swx_20120520_0641.nc\")\nxsapr_se_file = get_test_data(\"sex_20120520_0641.nc\")\nradar_sw = pyart.io.read_cfradial(xsapr_sw_file)\nradar_se = pyart.io.read_cfradial(xsapr_se_file)\n\n# filter out gates with reflectivity > 100 from both radars\ngatefilter_se = pyart.filters.GateFilter(radar_se)\ngatefilter_se.exclude_transition()\ngatefilter_se.exclude_above(\"corrected_reflectivity_horizontal\", 100)\ngatefilter_sw = pyart.filters.GateFilter(radar_sw)\ngatefilter_sw.exclude_transition()\ngatefilter_sw.exclude_above(\"corrected_reflectivity_horizontal\", 100)\n\n# perform Cartesian mapping, limit to the reflectivity field.\ngrid = pyart.map.grid_from_radars(\n (radar_se, radar_sw),\n gatefilters=(gatefilter_se, gatefilter_sw),\n grid_shape=(1, 201, 201),\n grid_limits=((1000, 1000), (-50000, 40000), (-60000, 40000)),\n grid_origin=(36.57861, -97.363611),\n fields=[\"corrected_reflectivity_horizontal\"],\n)\n\n# create the plot\nfig = plt.figure()\nax = fig.add_subplot(111)\nax.imshow(\n grid.fields[\"corrected_reflectivity_horizontal\"][\"data\"][0],\n origin=\"lower\",\n extent=(-60, 40, -50, 40),\n vmin=0,\n vmax=48,\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 }