Py-ART#

[1]:
import os
import pyart
import radarx as rx  # noqa
import cmweather  # noqa
import cartopy.crs as ccrs
from datetime import datetime

## You are using the Python ARM Radar Toolkit (Py-ART), an open source
## library for working with weather radar data. Py-ART is partly
## supported by the U.S. Department of Energy as part of the Atmospheric
## Radiation Measurement (ARM) Climate Research Facility, an Office of
## Science user facility.
##
## If you use this software to prepare a publication, please cite:
##
##     JJ Helmus and SM Collis, JORS 2016, doi: 10.5334/jors.119

Grid Setup#

[2]:
x_lims = (-300e3, 250e3)
y_lims = (-250e3, 300e3)
z_lims = (0, 15e3)
h_res = 2000
v_res = 500

Load data#

[3]:
file = "s3://noaa-nexrad-level2/2018/06/12/KSGF/KSGF20180612_083109_V06"
radar = pyart.io.read_nexrad_archive(file)
filename = os.path.basename(file) + ".nc"
if not os.path.exists(filename):
    pyart.io.write_cfradial(filename, radar)
else:
    print("Already present")
INFO:botocore.httpchecksum:Skipping checksum validation. Response did not contain one of the following algorithms: ['crc32', 'sha1', 'sha256'].
INFO:botocore.httpchecksum:Skipping checksum validation. Response did not contain one of the following algorithms: ['crc32', 'sha1', 'sha256'].
INFO:botocore.httpchecksum:Skipping checksum validation. Response did not contain one of the following algorithms: ['crc32', 'sha1', 'sha256'].
[4]:
tstart = datetime.now()
# 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=(31, 276, 276),
    grid_limits=(
        z_lims,
        y_lims,
        x_lims,
    ),
    fields=["reflectivity"],
)

xg = grid.to_xarray()
print("Py-ART gridding took:", datetime.now() - tstart)
display(xg)
del radar
Py-ART gridding took: 0:00:14.738293
<xarray.Dataset> Size: 20MB
Dimensions:                     (time: 1, z: 31, y: 276, x: 276, nradar: 1)
Coordinates: (12/16)
  * time                        (time) object 8B 2018-06-12 08:31:09.972000
  * z                           (z) float64 248B 0.0 500.0 ... 1.45e+04 1.5e+04
    lat                         (y, x) float64 609kB 34.94 34.94 ... 39.9 39.9
    lon                         (y, x) float64 609kB -96.69 -96.67 ... -90.47
  * y                           (y) float64 2kB -2.5e+05 -2.48e+05 ... 3e+05
  * x                           (x) float64 2kB -3e+05 -2.98e+05 ... 2.5e+05
    ...                          ...
    origin_altitude             (time) float64 8B 419.0
    radar_altitude              (nradar) float64 8B 419.0
    radar_latitude              (nradar) float64 8B 37.24
    radar_longitude             (nradar) float64 8B -93.4
    radar_time                  (nradar) float64 8B 0.972
    radar_name                  (nradar) <U4 16B 'KSGF'
Dimensions without coordinates: nradar
Data variables:
    reflectivity                (time, z, y, x) float32 9MB nan nan ... nan nan
    ROI                         (time, z, y, x) float32 9MB 6.816e+03 ... 6.8...
Attributes: (12/13)
    radar_name:          KSGF
    nradar:              1
    Conventions:         CF/Radial instrument_parameters
    version:             1.3
    title:
    institution:
    ...                  ...
    source:
    history:
    comment:
    instrument_name:     KSGF
    original_container:  NEXRAD Level II
    vcp_pattern:         212

Plot#

Py-ART#

[5]:
xg.squeeze().radarx.plot_max_cappi(
    data_var="reflectivity",
    vmin=-10,
    vmax=70,
    range_rings=True,
    add_map=True,
    projection=ccrs.PlateCarree(),
)
../_images/notebooks_gridding_rate_part1_9_0.png
[5]:
../_images/notebooks_gridding_rate_part1_9_1.png
[ ]: