From d69b02c78e1b93bf708e4edf27f60e252e1b8575 Mon Sep 17 00:00:00 2001 From: mgrover1 Date: Thu, 5 Oct 2023 11:30:38 -0500 Subject: [PATCH] DOC: Add xradar gridding example --- examples/xradar/plot_grid_xradar.py | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 examples/xradar/plot_grid_xradar.py diff --git a/examples/xradar/plot_grid_xradar.py b/examples/xradar/plot_grid_xradar.py new file mode 100644 index 0000000000..fa6874bb1b --- /dev/null +++ b/examples/xradar/plot_grid_xradar.py @@ -0,0 +1,40 @@ +""" +================================== +Plot a PPI Using Xradar and Py-ART +================================== + +An example which uses xradar and Py-ART to grid a PPI file. + +""" + +# Author: Max Grover (mgrover@anl.gov) +# License: BSD 3 clause + + +import xradar as xd + +import pyart +from pyart.testing import get_test_data + +# Locate the test data and read in using xradar +filename = get_test_data("swx_20120520_0641.nc") +tree = xd.io.open_cfradial1_datatree(filename) + +# Give the tree Py-ART radar methods +radar = pyart.xradar.Xradar(tree) + +# Grid using 11 vertical levels, and 101 horizontal grid cells at a resolution on 1 km +grid = pyart.map.grid_from_radars( + (radar,), + grid_shape=(11, 101, 101), + grid_limits=( + (0.0, 10_000), + (-50_000.0, 50_000.0), + (-50_000, 50_000.0), + ), +) + +display = pyart.graph.GridMapDisplay(grid) +display.plot_grid( + "reflectivity_horizontal", level=0, vmin=-20, vmax=60, cmap="ChaseSpectral" +)