8000 GitHub - pachterlab/larain: LA Rain: live rain and flood map for Los Angeles · GitHub
[go: up one dir, main page]

Skip to content
pachterlabPublic

About

LA Rain: live rain and flood map for Los Angeles

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

LA Rain

Live site: pachterlab.github.io/larain

A live map of rain and flooding across the Los Angeles area, inspired by tinysfo.com. OpenStreetMap basemap (OpenFreeMap tiles) with every public live rain and flood feed I could find layered on top.

./run.sh            # first run creates .venv and installs numpy + pygrib
open http://localhost:8787

What's on the map

Layer Source Resolution / latency
Rain rate "Now" + drifting raindrops NOAA MRMS PrecipRate ~1 km, every 2 min, ~2–4 min behind
Past totals, any window up to 7 days 2-min MRMS frames (last 3 h) + hourly gauge-corrected MRMS Pass2 (7 days, cached in cache/) ~1 km, rolling
Forecast 0–2 h (nowcast) Latest radar advected along the storm motion estimated from radar frames (phase correlation, larger 4°×7° box) ~1 km, every 2 min
Forecast 2–18 h NOAA HRRR model, 15-min rain fields (byte-range fetched), blended with the nowcast from 30–120 min 3 km, hourly runs
7d / Season LA County gauges —
Flash-flood index MRMS FLASH: rain return period, rain ÷ flash-flood guidance, CREST modeled flow ~1 km, 2–10 min
Rain gauges (~130) LA County Public Works ALERT network, all durations + per-tip history point, ~15 min
River gauges w/ flood category (84) NOAA National Water Prediction Service point, ~15–60 min
Stream gauges (37) USGS Water Services, 24 h hydrographs point, 5–15 min
County stream flow (41) LA County Public Works point
Flood alerts (+ other alerts) National Weather Service, with zone shapes live
Burn scars + debris-flow screening NIFC WFIGS perimeters (last 3 yr) × 15-min radar intensity live
Road flooding / closures CHP live incident feed (LA, Ventura, OC, Inland) ~2 min
Storm reports NWS local storm reports via Iowa Environmental Mesonet live
Airports ASOS via IEM (rain last hour / today, wind) ~hourly
Click anywhere All windows at that cell, rarity, nearest gauge, NWS 12-h rain chances —
Forecaster tab NWS LA Area Forecast Discussion ~2×/day
FEMA flood zones, wide-area radar FEMA NFHL, RainViewer static / 10 min

Controls

  • Time slider (bottom): one continuous axis from 7 days ago → Now → +18 h forecast (non-linear, so recent minutes get more room). Drag it, or use ←/→ (jump between ticks) and Shift+←/→ (fine). The bubble shows how far back or ahead you are.
  • Total / Moment (M): Total = rain between that time and now (past) or from now until then (forecast); Moment = rain rate at that instant. Season shows gauge season totals.
  • ▶ / Space: play through time from where you are (or −3 h) into the forecast; tick pile up to accumulate. N jumps to now.
  • T: TV mode, which tours the heaviest rain, top gauges, flooding rivers and road flooding.
  • U: inches/mm. P: panel. ◐: light/dark.
  • Shareable views: /?t=-1440#11/34.05/-118.25 (past day), /?t=180 (next 3 h), /?t=420&mode=moment, /?flash=ari, /?units=mm&theme=light.

How it works

server.py (stdlib HTTP + numpy/pygrib) polls each feed on its own schedule, crops MRMS CONUS GRIB2 grids to the greater-LA box (33.25–34.95°N, 119.95–116.8°W, 316×171 cells), packs them as uint16 and serves small gzipped JSON at /api/*. GRIB decoding runs in worker processes. /api/status reports each feed's health. The frontend (docs/, also served by GitHub Pages) is plain JS + MapLibre GL. It renders the rain field itself into a canvas, so hovering and clicking read actual values.

Caveats

Radar-only totals can over- or under-estimate (especially behind mountains); gauges are the ground truth. The debris-flow highlight is a rough screen against typical USGS thresholds (~0.3–0.5 in/h 15-min intensity). Always follow official NWS warnings.

Deployment

  • Site: https://pachterlab.github.io/larain/ — GitHub Pages serves docs/ from main. docs/config.js points the Pages copy at the data server.
  • Data server: https://api.larain.info — Hetzner Cloud (Hillsboro, OR; must be in the US, CHP blocks non-US addresses), Ubuntu, server.py as systemd service larain, Caddy for HTTPS. Set up with deploy/setup.sh api.larain.info.
  • CDN: Cloudflare (proxied DNS, SSL Full (strict), cache rule "eligible for cache, respect origin Cache-Control" on api.larain.info). Frames are immutable (cached 1 year); manifest/feeds s-maxage=15.
  • Update the server: scp server.py root@<ip>:/opt/larain/ && ssh root@<ip> 'systemctl restart larain'.

Research archive

The server keeps full-precision copies of everything it ingests in /opt/larain/archive/ (capped at 9 GB, and it pauses before the disk gets low), for later analysis such as spatial or contrastive PCA: 2-minute MRMS rain rate (analysis grid and a wider domain), hourly gauge-corrected totals, FLASH flash-flood products, our nowcasts, HRRR forecasts, and every change of the gauge, CHP, alert, river, USGS, storm-report and airport feeds. Layout and units: archive/grid.json; all times UTC.

rsync -a root@<server>:/opt/larain/archive/ ~/larain-archive/

tools/larain_archive.py loads it into numpy arrays / AnnData; tools/backfill_archive.py fills 2-minute radar for a past period from NOAA's AWS archive.

License

BSD 2-Clause — see LICENSE. Data belongs to its respective providers (see above).

About

LA Rain: live rain and flood map for Los Angeles

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0