Nowcast: sample a pixel neighborhood and say when forecast frames are missing (#162) #164

Merged
claude-bot merged 2 commits from fix/nowcast-sampling into main 2026-08-01 02:50:52 +00:00
Contributor

Closes #162.

Problem

During the 2026-08-01 tornado-warned MO event, every location's dashboard nowcast line read "no precip in the area now" while precip cells covered 20% of the sampled radar tile (reproduced with the app's exact tile math for Rolla). Two compounding causes:

  1. Bare point sampling (smoothing off): the single pixel at the location's coordinates sat in a gap between convective cells and read alpha 0.
  2. RainViewer served zero radar.nowcast frames (intermittent upstream outage): with horizon 0 the fallback string implied a forecast had been made when none existed.

Change

  • _sample_frame samples a ±2 px (~±1 km at zoom 8) window and takes the max alpha, so a cell a few hundred meters away still counts as precip, without claiming precip that is genuinely elsewhere. Still one tile fetch per frame.
  • Honest degraded phrasing: with no forward frames the summary is now "rain/no precip near this location now (no forecast frames available)", and the result dict carries a nowcast_available flag for the UI.
  • "in the area" copy in the horizon-0 case became "near this location", which the ~±1 km window actually supports.
  • README caveat updated; module docstring updated.

Tests

  • Kernel: opaque pixel inside the window with a dry center → precip; just outside the window → dry.
  • End-to-end: past frames present + empty nowcast list → available: True, nowcast_available: False, the new honest phrasing.
  • Updated the horizon-0 string assertions; all other summary strings ("rain starting in ~X min", "no precip expected in the next hour", …) are unchanged, as are the endpoint contract and fail-soft None paths.

🤖 Generated with Claude Code

Closes #162. ## Problem During the 2026-08-01 tornado-warned MO event, every location's dashboard nowcast line read "no precip in the area now" while precip cells covered 20% of the sampled radar tile (reproduced with the app's exact tile math for Rolla). Two compounding causes: 1. **Bare point sampling** (smoothing off): the single pixel at the location's coordinates sat in a gap between convective cells and read alpha 0. 2. **RainViewer served zero `radar.nowcast` frames** (intermittent upstream outage): with horizon 0 the fallback string implied a forecast had been made when none existed. ## Change - **`_sample_frame` samples a ±2 px (~±1 km at zoom 8) window** and takes the max alpha, so a cell a few hundred meters away still counts as precip, without claiming precip that is genuinely elsewhere. Still one tile fetch per frame. - **Honest degraded phrasing**: with no forward frames the summary is now "rain/no precip near this location now **(no forecast frames available)**", and the result dict carries a `nowcast_available` flag for the UI. - "in the area" copy in the horizon-0 case became "near this location", which the ~±1 km window actually supports. - README caveat updated; module docstring updated. ## Tests - Kernel: opaque pixel *inside* the window with a dry center → precip; *just outside* the window → dry. - End-to-end: past frames present + empty `nowcast` list → `available: True`, `nowcast_available: False`, the new honest phrasing. - Updated the horizon-0 string assertions; all other summary strings ("rain starting in ~X min", "no precip expected in the next hour", …) are unchanged, as are the endpoint contract and fail-soft `None` paths. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Nowcast: sample a pixel neighborhood and say when forecast frames are missing (#162)
Some checks failed
CI / test (pull_request) Failing after 4m52s
1c6f6217c5
During the 2026-08-01 tornado-warned event, every location's nowcast line
read "no precip in the area now" while cells covered 20% of the sampled
tile. Two causes:

- A bare point sample (smoothing off) sat in the gaps between convective
  cells. _sample_frame now takes the max alpha over a ±2 px (~±1 km)
  window, so a cell a few hundred meters away still counts, without
  claiming precip that is genuinely elsewhere.
- RainViewer intermittently serves zero radar.nowcast frames; the
  horizon-0 fallback string implied a forecast had been made. The summary
  now says "(no forecast frames available)" and the result carries a
  nowcast_available flag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ci: rerun (empty) — prior run overlapped a concurrent CI run
All checks were successful
CI / test (pull_request) Successful in 5m51s
f28b278e30
claude-bot deleted branch fix/nowcast-sampling 2026-08-01 02:50:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/WeatherBot!164
No description provided.