The diurnal cycle of summer rainfall over the United States¶
GPM IMERG Final (half-hourly) estimates precipitation over the globe at 0.1° resolution every 30 minutes, from June 2000 to October 2025. It comes from GPM, the Global Precipitation Measurement mission, and IMERG (Integrated Multi-satellitE Retrievals for GPM), which blends microwave and infrared satellite observations into a single precipitation field.
Half-hourly data can show something monthly and daily averages cannot: when during the day it rains. In summer, rainfall over much of the United States follows a daily rhythm set by the Sun — afternoon thunderstorms over the Southeast and the mountains, sea-breeze storms over Florida, and a night-time maximum over the Great Plains, where storm systems that form over the Rockies in the afternoon travel east overnight.
In this notebook we
select the summer months (June–August) of 2023–2025 over the contiguous US,
average each of the 48 half-hour slots of the day across those ~275 days to build a mean summer day of rainfall, then
animate the 48 frames to watch rainfall rise and fall through the day.
For the long-term spatial picture, see the companion monthly and daily IMERG notebooks.
import os
import shutil
import datetime
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import cartopy.crs as ccrs
import cartopy.feature as cfeature
# Dask
from dask_jobqueue import PBSCluster
from dask.distributed import Client, LocalClusterOpen the dataset¶
IMERG half-hourly is distributed as one NetCDF granule per half hour — more than 440,000
files. GDEX adds kerchunk references so a single xr.open_dataset(..., engine="kerchunk")
call exposes the whole record as one virtual xarray.Dataset. Because the record is so long,
GDEX publishes one reference per variable, stored as Parquet
so it is read lazily; we only need precipitation.
# POSIX reference where the GDEX data mount is present (NCAR HPC), otherwise the
# OSDF-routed reference over the network.
posix_ref = "/gdex/data/d731000/kerchunk/precipitation_GPM_3IMERGHH_v07.parq"
osdf_ref = "https://data.gdex.ucar.edu/d731000/kerchunk/precipitation_GPM_3IMERGHH_v07-remote-osdf.parq"
kerchunk_ref = posix_ref if os.path.exists(posix_ref) else osdf_ref
print(f"Access: {'POSIX mount' if kerchunk_ref == posix_ref else 'OSDF (remote)'}")
print(kerchunk_ref)Access: POSIX mount
/gdex/data/d731000/kerchunk/precipitation_GPM_3IMERGHH_v07.parq
Set up a Dask cluster¶
Building the composite reads every half-hourly field for three summers over the US, so we spread the work across a Dask cluster. As in the other GDEX examples, the cluster is chosen automatically:
Casper / Derecho (a PBS scheduler is present) → a
PBSClusterof batch workers.Laptop / CIRRUS Binder (no PBS) → a
LocalClusteron the local cores.
N_WORKERS = 10
def get_pbs_cluster(n_workers=N_WORKERS):
"""PBSCluster on NCAR HPC (Casper/Derecho)."""
scratch = f"/glade/derecho/scratch/{os.environ.get('USER', '')}"
cluster = PBSCluster(
job_name = "imerg-halfhourly",
cores = 1,
memory = "8GiB",
processes = 1,
local_directory = f"{scratch}/dask/spill/",
log_directory = f"{scratch}/dask/logs/",
resource_spec = "select=1:ncpus=1:mem=8GB",
queue = "casper",
walltime = "2:00:00",
interface = "ext",
)
cluster.scale(n_workers)
return cluster
def get_local_cluster():
"""LocalCluster for a laptop or a CIRRUS Binder pod (no PBS scheduler)."""
return LocalCluster()on_hpc = bool(shutil.which("qsub"))
cluster = get_pbs_cluster() if on_hpc else get_local_cluster()
client = Client(cluster)
if on_hpc:
client.wait_for_workers(n_workers=N_WORKERS)
print(f"Detected {'NCAR HPC -> PBSCluster' if on_hpc else 'no PBS -> LocalCluster'}")
cluster/glade/u/home/harshah/.conda/envs/zarr3/lib/python3.11/site-packages/distributed/node.py:188: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 39415 instead
warnings.warn(
Detected NCAR HPC -> PBSCluster
Subset to summers over the contiguous US¶
We keep a box around the contiguous US (125°W–66°W, 24°N–50°N) and the June–August (JJA) period of 2023, 2024 and 2025 — 92 days × 48 half-hours × 3 summers = 13,248 fields.
ds = xr.open_dataset(kerchunk_ref, engine="kerchunk",
open_dataset_options={"chunks": None}, # plain lazy arrays, no hidden Dask layer
drop_variables=["lat_bnds", "lon_bnds", "time_bnds"])
precip = ds["precipitation"] # (time, lon, lat), mm/hr
# Contiguous US, June-August of 2023-2025; chunk only the selection (96 = 2 days)
conus = dict(lon=slice(-125, -66), lat=slice(24, 50))
summers = [precip.sel(time=slice(f"{y}-06-01", f"{y}-08-31"), **conus).chunk({"time": 96})
for y in (2023, 2024, 2025)]
precip_jja = xr.concat(summers, dim="time")
precip_jja = precip_jja.where(precip_jja >= 0) # mask fill values
print("half-hourly steps:", precip_jja.sizes["time"],
"| dask chunks:", precip_jja.data.npartitions,
"| tasks in graph:", len(precip_jja.__dask_graph__()))
precip_jjahalf-hourly steps: 13248 | dask chunks: 138 | tasks in graph: 555
Build the mean summer day¶
Each half-hourly field is labeled with its slot of the day — 0 for 00:00 UTC, 1 for 00:30, … 47 for 23:30 — and all 276 summer days are averaged slot by slot. The result is 48 maps: the average rain rate at each half hour of a typical summer day. Times are in UTC; the contiguous US is 4–7 hours behind (e.g. 18:00 UTC is 1 p.m. Central Daylight Time).
%%time
# Sanity checks: whole days only, and slots run 0..47 in order every day
t = precip_jja["time"]
nslot = 48
assert precip_jja.sizes["time"] % nslot == 0
slots = (t.dt.hour * 2 + t.dt.minute // 30).values
assert (slots == np.tile(np.arange(nslot), len(slots) // nslot)).all()
# Fold time -> (day, halfhour) and average over days
days = (precip_jja.coarsen(time=nslot)
.construct(time=("day", "halfhour"))
.drop_vars("time")) # (day, halfhour, lon, lat)
diurnal = days.mean("day").transpose("halfhour", "lat", "lon").compute()
diurnal = diurnal.assign_coords(halfhour=np.arange(nslot))
diurnal.attrs["units"] = "mm/hr"
print("shape:", diurnal.shape,
"| range:", round(float(diurnal.min()), 3), "-", round(float(diurnal.max()), 3), "mm/hr")
diurnalshape: (48, 260, 590) | range: 0.0 - 1.294 mm/hr
CPU times: user 3.77 s, sys: 250 ms, total: 4.02 s
Wall time: 58.9 s
Animate the mean summer day¶
We play the 48 half-hourly maps from midnight to midnight Central Daylight Time (CDT = UTC − 5 h), so the animation reads like a single summer day over the middle of the country. Each frame is labeled in both UTC and CDT. Look for:
afternoon thunderstorms building over Florida, the Southeast and the Rocky Mountains;
rain over the Great Plains that peaks overnight, as storm systems that form over the Rockies in the afternoon travel east after dark.
As in the daily notebook, cooler colors are drier and warmer colors are wetter (mm/hr).
%%time
# Frame order: midnight -> midnight CDT (slot 10 = 05:00 UTC = 00:00 CDT)
start = 10
order = [(start + k) % 48 for k in range(48)]
def clock(slot):
"""Label a half-hour slot of the UTC day as 'HH:MM UTC (h:MM AM/PM CDT)'."""
utc = datetime.datetime(2024, 7, 1) + datetime.timedelta(minutes=30 * int(slot))
cdt = utc - datetime.timedelta(hours=5)
return f"{utc:%H:%M} UTC ({cdt:%-I:%M %p} CDT)"
# Flat map whose extent matches the data box exactly, so the field fills the frame
pc = ccrs.PlateCarree()
extent = [float(diurnal.lon.min()), float(diurnal.lon.max()),
float(diurnal.lat.min()), float(diurnal.lat.max())]
fig, ax = plt.subplots(figsize=(10, 5), subplot_kw={"projection": pc},
constrained_layout=True)
ax.set_extent(extent, crs=pc)
mesh = ax.pcolormesh(diurnal["lon"], diurnal["lat"], diurnal.isel(halfhour=order[0]),
transform=pc, cmap="turbo", vmin=0, vmax=0.8,
shading="auto", rasterized=True)
# Crisp white outlines drawn on top of the data (visible on dark and bright colors)
lines = dict(facecolor="none", edgecolor="white", zorder=3)
ax.add_feature(cfeature.STATES.with_scale("50m"), linewidth=0.4, alpha=0.7, **lines)
ax.add_feature(cfeature.LAKES.with_scale("50m"), linewidth=0.5, **lines)
ax.add_feature(cfeature.BORDERS.with_scale("50m"), linewidth=0.8, **lines)
ax.coastlines("50m", color="white", linewidth=0.8, zorder=3)
cb = plt.colorbar(mesh, ax=ax, orientation="horizontal", shrink=0.6, pad=0.04, extend="max")
cb.set_label("Mean rain rate (mm/hr)")
title = ax.set_title("")
def update(i):
slot = order[i]
mesh.set_array(diurnal.isel(halfhour=slot).values.ravel())
title.set_text(f"IMERG mean summer rain rate, JJA 2023–2025 — {clock(slot)}")
return mesh, title
anim = animation.FuncAnimation(fig, update, frames=48, interval=150)
anim.save("imerg_halfhourly_diurnal.gif", writer=animation.PillowWriter(fps=6), dpi=80)
plt.close(fig)
from IPython.display import Image
Image("imerg_halfhourly_diurnal.gif")CPU times: user 12.9 s, sys: 987 ms, total: 13.9 s
Wall time: 13.7 s

Citation¶
If you use this data or workflow, please cite:
Data (GDEX copy used in this notebook) Huffman, G. J., E. F. Stocker, D. T. Bolvin, E. J. Nelkin, and J. Tan. 2024, updated irregularly. GPM IMERG Final Precipitation L3 Half Hourly 0.1 degree x 0.1 degree V07. NSF National Center for Atmospheric Research. Huffman et al. (2024). Accessed† dd mmm yyyy.
† Replace dd mmm yyyy with the date you last accessed the data (e.g. 5 Aug 2011).
Original data product Huffman, G. J., E. F. Stocker, D. T. Bolvin, E. J. Nelkin, and J. Tan, 2023: GPM IMERG Final Precipitation L3 Half Hourly 0.1 degree x 0.1 degree V07. NASA Goddard Earth Sciences Data and Information Services Center (GES DISC). Huffman et al. (2023)
Visualization reproduced here
NASA’s Goddard Space Flight Center Scientific Visualization Studio, 2019: Precipitation
Diurnal Cycles. SVS #13346. Visualizers: J. B. S. Tan and A. Kekesi; producers:
R. Fitzgibbons and J. Ng. https://
This notebook NCAR GDEX Examples (all versions). Hampapura et al. (2026)
- Huffman, G., Stocker, E., Bolvin, D., Nelkin, E., & Tan, J. (2024). GPM IMERG Final Precipitation L3 Half Hourly 0.1 degree x 0.1 degree V07. NSF National Center for Atmospheric Research. 10.5065/SRTD-0R12
- Huffman, G. J., Stocker, E. F., Bolvin, D. T., Nelkin, E. J., & Tan, J. (2023). GPM IMERG Final Precipitation L3 Half Hourly 0.1 degree x 0.1 degree V07. NASA Goddard Earth Sciences Data. 10.5067/GPM/IMERG/3B-HH/07
- Hampapura, H. R., Hsu, C.-W., Sears, M., Cha, T.-Y., & del Moral Méndez, A. (2026). GDEX Examples: geoscientific workflows using NCAR’s Geoscience Data Exchange. Zenodo. 10.5281/ZENODO.20330479