Architecture proposal β Adaptive short-range precipitation forecast for Amfor-Cast
NWP models (ICON, ECMWF, GFS etc.) are initialized every 6β12 hours and excel at forecasting weather 12hβ10 days ahead. But for the question "Will it rain at my location in the next 30β90 minutes?" they're fundamentally the wrong tool.
Current Amfor-Cast shows precipitation from NWP models only. This creates a gap: users can't get reliable "rain starting soon" alerts β exactly the information that's most actionable (close windows, bring laundry in, grab an umbrella).
| Range | Source | Method | Update freq |
|---|---|---|---|
| 0β2h | Radar nowcast | Extrapolate observed precipitation movement | Every 15 min |
| 2β6h | Hybrid blend | Weighted fusion of radar + NWP (ICON-D2/AROME) | Every 15 min |
| 6h+ | AMFOR blend | Existing multi-model system (unchanged) | Every 1h |
The core innovation: as lead time increases, trust shifts smoothly from radar to NWP.
| Lead time | Radar weight | NWP weight | Visual |
|---|---|---|---|
| +15 min | 95% | 5% | |
| +30 min | 90% | 10% | |
| +1h | 75% | 25% | |
| +2h | 50% | 50% | |
| +3h | 25% | 75% | |
| +6h | 5% | 95% |
The transition point between radar and NWP should be dynamic:
GET https://api.open-meteo.com/v1/forecast
?latitude=47.27&longitude=19.35
&minutely_15=precipitation,rain,snowfall,weather_code
&forecast_minutely_15=24 (next 24 intervals = 6h)
&timezone=auto
Response: 15-minute resolution precipitation data
β precipitation (mm per 15 min)
β rain vs. snowfall split
β weather_code (WMO standard)
Coverage: Central Europe is well-covered by DWD radar composites. Hungary (InΓ‘rcs, Budapest etc.) is within range.
Limitation: The API returns radar-extrapolated data for ~2h ahead, then transitions to model data. Perfect for our architecture.
CREATE TABLE forecasts_nowcast (
id INT AUTO_INCREMENT PRIMARY KEY,
city VARCHAR(50) NOT NULL,
issued_at DATETIME NOT NULL, -- when the nowcast was generated
valid_at DATETIME NOT NULL, -- what time it predicts
lead_minutes SMALLINT NOT NULL, -- 15, 30, 45, ..., 360
source ENUM('radar','nwp','blend') NOT NULL,
precip_mm DECIMAL(5,2) NOT NULL, -- predicted precipitation
precip_prob TINYINT UNSIGNED, -- 0-100 confidence
weather_code SMALLINT, -- WMO weather code
observed_mm DECIMAL(5,2) DEFAULT NULL, -- filled retroactively for verification
UNIQUE KEY uk_city_issued_valid_source (city, issued_at, valid_at, source),
INDEX idx_city_valid (city, valid_at),
INDEX idx_verify (city, issued_at, lead_minutes)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
scripts/nowcast/ βββ fetch_nowcast.py # Pull 15-min radar data from Open-Meteo βββ blend_nowcast.py # Merge radar + NWP with adaptive weights βββ verify_nowcast.py # Score past nowcasts vs observations βββ regime.py # Detect frontal vs convective (Phase 4) shared/ βββ nowcast_config.py # Blend weights, thresholds, timing tests/ βββ test_nowcast.py # Unit tests for blend logic + regime detection schema-nowcast.sql # Table creation + index
# Nowcast: every 15 minutes (fetch + deploy JSONs directly) */15 * * * * /opt/amfor-cast/venv/bin/python3 /opt/amfor-cast/repo/scripts/nowcast/fetch_nowcast.py --output-dir /opt/amfor-cast/site && rsync -q /opt/amfor-cast/site/nowcast-*.json amforcas@amfor-cast:~/public_html/ # Hourly: existing cron stays unchanged (AMFOR blend for 6h+) 0 * * * * /opt/amfor-cast/repo/run.sh --skip-validator # Verification: once per hour, score past nowcasts (Phase 3, add to run-and-publish.py)
The simple forecast page loads nowcast data from a small JSON endpoint (generated alongside the 15-min fetch):
// forecasts_nowcast_latest.json (per city, refreshed every 15 min)
{
"city": "inarcs",
"issued_at": "2026-08-22T13:15:00",
"rain_expected": true,
"rain_starts_min": 35,
"intensity": "moderate",
"confidence": 82,
"source_mix": {"radar": 85, "nwp": 15},
"timeline_15min": [
{"valid": "13:30", "precip_mm": 0.0},
{"valid": "13:45", "precip_mm": 0.2},
{"valid": "14:00", "precip_mm": 1.1},
{"valid": "14:15", "precip_mm": 0.8},
...
]
}
Same philosophy as AMFOR's model validator β but at 15-minute resolution:
observed_mm, compute hit/miss/false alarm per source| Metric | Definition | Target |
|---|---|---|
| POD (Probability of Detection) | % of actual rain events detected | > 85% at +30min |
| FAR (False Alarm Rate) | % of rain alerts that didn't verify | < 20% at +30min |
| MAE (Mean Absolute Error) | Average |predicted - observed| mm | < 0.5 mm at +1h |
| Timing error | Predicted start time vs actual start | < 15 min at +1h |
scripts/nowcast/fetch_nowcast.py β calls Open-Meteo minutely_15 endpointnowcast-{city}.json per city (no DB yet β file-based)*/15 * * * * (fetch + rsync JSONs to server)scripts/nowcast/blend_nowcast.pyscripts/nowcast/verify_nowcast.pyscripts/nowcast/regime.py| Component | Impact |
|---|---|
Hourly cron (run.sh) | Unchanged β continues generating 7-day AMFOR blend |
forecasts_live table | Unchanged β still holds full 72h AMFOR data |
| Simple forecast page | Gains rain alert banner (reads nowcast JSON) |
| 7-day forecast page | Unchanged |
| Model validator | Gains new "Nowcast accuracy" section (Phase 3) |
| Gardener weather widget | Can optionally show "rain soon" indicator (Phase 5) |
| Pi resource usage | Minimal β 9 API calls every 15 min (~5s total) |
| Risk | Impact | Mitigation |
|---|---|---|
| Open-Meteo minutely_15 doesn't cover Hungary well | Low accuracy, false alarms | Test with real data in Phase 1 before committing to UI. DWD radar extends to Hungary β should be OK. |
| 15-min cron overloads Pi | Delays in hourly run | Nowcast script is lightweight (~5s). Add timeout + skip if hourly cron is active. |
| DB grows too large | Slow queries | Prune raw data after 30 days, keep only aggregated verification stats. |
| False alarms erode user trust | Users ignore alerts | Only show alert above confidence threshold (start conservative at 80%). Lower as verification data improves. |
| Convective storms unpredictable at any range | Poor accuracy in summer | Regime detection (Phase 4) widens confidence intervals. Honest uncertainty messaging. |
What this adds: Radar-based "rain in X minutes" capability β something no multi-model NWP system can reliably provide for the 0β2h window.
Why it fits: Same adaptive blending philosophy as AMFOR. Same verification-driven learning. Same user-first simplicity. Different time scale.
Effort: Phase 1 (usable MVP) in 1β2 days. Full system with adaptive learning in 2β3 weeks.
Risk: Low β builds on existing infra, uses free API, minimal resource impact, can be disabled if quality is insufficient.