{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Map a single radar to a Cartesian grid\n\nMap the reflectivity field of a single radar from Antenna coordinates to a\nCartesian 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\nimport numpy as np\n\nimport pyart\nfrom pyart.testing import get_test_data\n\n# read in the data\nfile = get_test_data(\"110635.mdv\")\nradar = pyart.io.read_mdv(file)\n\n# mask out last 10 gates of each ray, this removes the \"ring\" around the radar.\nradar.fields[\"reflectivity\"][\"data\"][:, -10:] = np.ma.masked\n\n# exclude masked gates from the gridding\ngatefilter = pyart.filters.GateFilter(radar)\ngatefilter.exclude_transition()\ngatefilter.exclude_masked(\"reflectivity\")\n\n# perform Cartesian mapping, limit to the reflectivity field.\ngrid = pyart.map.grid_from_radars(\n (radar,),\n gatefilters=(gatefilter,),\n grid_shape=(1, 241, 241),\n grid_limits=((2000, 2000), (-123000.0, 123000.0), (-123000.0, 123000.0)),\n fields=[\"reflectivity\"],\n)\n\n# create the plot\nfig = plt.figure()\nax = fig.add_subplot(111)\nax.imshow(grid.fields[\"reflectivity\"][\"data\"][0], origin=\"lower\")\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.13.0" } }, "nbformat": 4, "nbformat_minor": 0 }