NEXRAD Level II archive (Unidata, AWS): sample notebook
A worked notebook for NEXRAD Level II archive (Unidata, AWS), with 5 code cells and the output each one printed. On Scigantic it opens in a hosted JupyterLab with the dataset already mounted, so nothing is downloaded first.
- Provider
- Unidata
- License
- Custom (see documentation)
- Stored at
- Amazon S3, s3://unidata-nexrad-level2 (us-east-1)
- Access
- Free and public. No account with the data provider is needed.
The notebook
# Start here: one full radar volume from the Utah radar, read off the mount.
# Change PLACE to any town within about 200 km of the radar.
import os, time
import numpy as np
import matplotlib.pyplot as plt
import pyart
%config InlineBackend.figure_formats = ["jpeg"]
%config InlineBackend.print_figure_kwargs = {"pil_kwargs": {"quality": 70}}
plt.rcParams["figure.dpi"] = 80
ROOT = os.environ.get("SCIGANTIC_MOUNT_PATH", "/mnt/archive")
SITE = "KMTX" # Promontory Point, Utah
VOLUME = "2026/08/31/KMTX/KMTX20260831_235948_V06"
PLACE = ("Ogden", 41.223, -111.973)
t = time.time()
radar = pyart.io.read_nexrad_archive(os.path.join(ROOT, VOLUME))
print(f"read {VOLUME} in {time.time() - t:.1f} s: {radar.nsweeps} sweeps, fields: {', '.join(sorted(radar.fields))}")
name, plat, plon = PLACE
display = pyart.graph.RadarDisplay(radar)
fig, ax = plt.subplots(figsize=(8, 7))
display.plot("reflectivity", 0, ax=ax, vmin=-10, vmax=65, cmap="ChaseSpectral",
title=f"{SITE} lowest sweep reflectivity, 2026-08-31 23:59 UTC", colorbar_label="dBZ")
display.set_limits(xlim=(-150, 150), ylim=(-150, 150), ax=ax)
# The place, in km east and north of the radar.
x, y = pyart.core.geographic_to_cartesian_aeqd(plon, plat, radar.longitude["data"][0], radar.latitude["data"][0])
ax.plot(x / 1000, y / 1000, "k^", ms=9)
ax.annotate(name, (x[0] / 1000, y[0] / 1000), xytext=(6, 6), textcoords="offset points", fontsize=11)
plt.show()
s = radar.get_slice(0)
dbz = radar.fields["reflectivity"]["data"][s]
glat, glon = radar.gate_latitude["data"][s], radar.gate_longitude["data"][s]
near = (np.hypot((glat - plat) * 111.2, (glon - plon) * 111.2 * np.cos(np.radians(plat))) < 15) & ~np.ma.getmaskarray(dbz)
print(f"within 15 km of {name}: max {dbz[near].max():.1f} dBZ, {int((dbz[near] > 30).sum()):,} gates above 30 dBZ (moderate rain)")
NEXRAD Level II: every sweep, every field, since 1991
The map above is one volume: a full set of sweeps the radar makes, starting at its lowest tilt and stepping up, in about five minutes. Level II is the radar's base data: every sweep at full resolution (250 m gates, 0.5 degree beams), with reflectivity, Doppler velocity, spectrum width and the three dual-polarisation fields. Level III, in the sister archive, is the National Weather Service's derived products (rain accumulation, storm totals, single-tilt images) made from these files. Use Level III to answer "how much did it rain". Use Level II to see the storm itself.
The bucket is unidata-nexrad-level2 on AWS Open Data, mounted read-only at /mnt/archive. It is laid out by date and radar:
YYYY/MM/DD/SITE/SITEYYYYMMDD_HHMMSS_V06
There are about 160 radars. On 2026-08-31 KMTX wrote 225 volumes, 2.1 GB, from 5 to 15 MB each depending on how much echo there was; the cell below measures that. List one folder at a time and never walk the mount. Files ending _MDM are small metadata messages, not volumes; skip them.
# One radar-day: how many volumes, how big, and how the cadence changes with weather.
day = "2026/08/31"
keys = sorted(k for k in os.listdir(os.path.join(ROOT, day, SITE)) if not k.endswith("_MDM"))
sizes = np.array([os.path.getsize(os.path.join(ROOT, day, SITE, k)) for k in keys]) / 1e6
hours = np.array([int(k[13:15]) + int(k[15:17]) / 60 for k in keys])
print(f"{SITE} on {day}: {len(keys)} volumes, {sizes.sum() / 1000:.1f} GB, {sizes.min():.1f} to {sizes.max():.1f} MB each")
print("first:", keys[0], " last:", keys[-1])
fig, ax = plt.subplots(figsize=(8, 2.6))
ax.plot(hours, sizes, ".", ms=4, color="#1d4ed8")
ax.set_xlabel("hour (UTC)"); ax.set_ylabel("volume size (MB)")
ax.set_title("File size tracks how much the radar sees: bigger volumes, more echo")
plt.tight_layout(); plt.show()
Output:
KMTX on 2026/08/31: 225 volumes, 2.1 GB, 4.9 to 14.5 MB each first: KMTX20260831_000020_V06 last: KMTX20260831_235948_V06
What Level II adds: velocity and dual polarisation
Each volume interleaves two kinds of sweep at the lowest tilts. One carries the dual-polarisation fields (the radar sends horizontally and vertically polarised pulses at once), and the next repeats the same tilt for Doppler velocity. On this volume sweep 0 is the dual-pol one and sweep 1 the Doppler one.
- Velocity (m/s) is motion toward (negative) or away from (positive) the radar. Couplets of strong inbound next to strong outbound are how forecasters find rotation.
- Differential reflectivity (ZDR), in dB, compares horizontal to vertical return. Large raindrops are flattened, so heavy rain reads positive; hail and dry snow read near zero.
- Correlation coefficient (rhoHV) measures how alike the two returns are. Rain and snow sit above about 0.95. Ground clutter, insects, smoke and hail read lower. It is the single most useful field for "is this rain".
panels = [
("reflectivity", 0, "Reflectivity (dBZ)", -10, 65, "ChaseSpectral"),
("velocity", 1, "Radial velocity (m/s)", -25, 25, "balance"),
("differential_reflectivity", 0, "ZDR (dB)", -2, 5, "RefDiff"),
("cross_correlation_ratio", 0, "Correlation coefficient", 0.7, 1.0, "HomeyerRainbow"),
]
fig, axes = plt.subplots(2, 2, figsize=(9.5, 8.6))
for ax, (field, sweep, label, lo, hi, cmap) in zip(axes.flat, panels):
display.plot(field, sweep, ax=ax, vmin=lo, vmax=hi, cmap=cmap, title=label, colorbar_label="")
display.set_limits(xlim=(-120, 120), ylim=(-120, 120), ax=ax)
ax.plot(x / 1000, y / 1000, "k^", ms=7)
plt.tight_layout(); plt.show()
Rain or not rain
Not every echo is weather. Mountains, the Great Salt Lake's shoreline, birds and insects all return energy. Reflectivity alone cannot tell them apart; correlation coefficient can. Py-ART's GateFilter keeps the gates you trust and masks the rest, and every Py-ART plot and gridding function accepts it.
The cell below counts echoes above 20 dBZ within 100 km of the radar, and how many of them pass a rhoHV of at least 0.95.
rng_km = radar.range["data"] / 1000
s = radar.get_slice(0)
dbz = radar.fields["reflectivity"]["data"][s]
rho = radar.fields["cross_correlation_ratio"]["data"][s]
inside = np.broadcast_to(rng_km < 100, dbz.shape)
echo = (dbz > 20).filled(False) & inside
weather = echo & (rho >= 0.95).filled(False)
print(f"echoes above 20 dBZ within 100 km: {int(echo.sum()):,} gates")
print(f" of which rhoHV >= 0.95 (weather): {int(weather.sum()):,} ({100 * weather.sum() / max(echo.sum(), 1):.0f}%)")
print(f" rejected as non-weather: {int((echo & ~weather).sum()):,}")
gf = pyart.filters.GateFilter(radar)
gf.exclude_below("cross_correlation_ratio", 0.95)
gf.exclude_below("reflectivity", 0)
fig, axes = plt.subplots(1, 2, figsize=(11, 5))
for ax, filt, title in [(axes[0], None, "All echoes"), (axes[1], gf, "rhoHV >= 0.95 only")]:
display.plot("reflectivity", 0, ax=ax, vmin=-10, vmax=65, cmap="ChaseSpectral", gatefilter=filt,
title=title, colorbar_label="dBZ")
display.set_limits(xlim=(-100, 100), ylim=(-100, 100), ax=ax)
plt.tight_layout(); plt.show()
Output:
echoes above 20 dBZ within 100 km: 29,933 gates of which rhoHV >= 0.95 (weather): 23,798 (80%) rejected as non-weather: 6,135
The newest volume
New volumes reach the bucket within a few minutes of the sweep, so the same code answers "what does the radar see right now". The output saved in this notebook is from when it was built; run the cell for the current one.
from datetime import datetime, timezone
now = datetime.now(timezone.utc)
today = os.path.join(ROOT, now.strftime("%Y/%m/%d"), SITE)
latest = sorted(k for k in os.listdir(today) if not k.endswith("_MDM"))[-1] if os.path.isdir(today) else None
if latest:
scan = datetime.strptime(latest[4:19], "%Y%m%d_%H%M%S").replace(tzinfo=timezone.utc)
print(f"newest {SITE} volume: {latest}, {(now - scan).total_seconds() / 60:.0f} minutes old")
print(f"read it with: pyart.io.read_nexrad_archive({os.path.join(today, latest)!r})")
else:
print(f"no {SITE} volumes yet for {now:%Y-%m-%d} (UTC); try yesterday's folder")
Output:
newest KMTX volume: KMTX20261113_134631_V06, 13 minutes old
read it with: pyart.io.read_nexrad_archive('/mnt/archive/2026/11/13/KMTX/KMTX20261113_134631_V06')
Where to go from here
- Another radar or storm. Change SITE and the date folder. Site IDs are the four-letter ICAO codes (KTLX Oklahoma City, KOKX New York, KATX Seattle). The archive goes back to 1991.
- Faster reads. pyart.io.read_nexrad_archive(path, scans=[0, 1]) reads only the sweeps you name.
- Grid it. pyart.map.grid_from_radars turns sweeps into a regular 3D grid you can slice by height or compare with satellite data.
- Ask the assistant. For example: "Find the KMTX volumes on 2026-08-31 with the most echo above 40 dBZ and animate the lowest sweep across them."
Run it
Open this notebook to run it, see the dataset page for the full description, or browse the full catalog.