← Back to Amfor-Cast

🌧️ Nowcast Plan: Radar-Based Precipitation Forecasting

Architecture proposal β€” Adaptive short-range precipitation forecast for Amfor-Cast

1. The Problem

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.

Key insight: For 0–2 hours ahead, what's actually happening right now (radar observations) is far more predictive than what a model simulated 6 hours ago.

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).

2. Three-Range Architecture

TIME ───────────────────────────────────────────────────────────▢ NOW +30min +1h +2h +4h +6h +24h +7d β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”‚ β”‚ RADAR NOWCAST (primary) β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ extrapolate observed precip β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”‚ HYBRID BLEND (radar fades, NWP grows) β”‚ β”‚ β”‚ β”‚ β”‚ adaptive weights by regime β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”‚ β”‚ AMFOR MULTI-MODEL BLEND β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ (existing system, unchanged) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
RangeSourceMethodUpdate freq
0–2hRadar nowcastExtrapolate observed precipitation movementEvery 15 min
2–6hHybrid blendWeighted fusion of radar + NWP (ICON-D2/AROME)Every 15 min
6h+AMFOR blendExisting multi-model system (unchanged)Every 1h

3. Blending Weights

The core innovation: as lead time increases, trust shifts smoothly from radar to NWP.

Lead timeRadar weightNWP weightVisual
+15 min95%5%
radar
+30 min90%10%
radar
+1h75%25%
radar
NWP
+2h50%50%
radar
NWP
+3h25%75%
NWP
+6h5%95%
NWP models
Adaptive twist: These weights are starting values. Over time, the verification system learns the optimal blend per city, per regime (frontal vs. convective), per lead time. The same philosophy as AMFOR's existing model weighting β€” but at 15-minute resolution.

Regime detection (Phase 4)

The transition point between radar and NWP should be dynamic:

4. Data Source: Open-Meteo Nowcast API

Good news: We don't need to process raw radar images. Open-Meteo provides a ready-made nowcast endpoint based on DWD radar composites β€” free, no API key, same interface as existing forecast calls.
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.

5. Database Schema

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;

Storage estimate

6. File Structure

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

7. Cron Integration

# 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)
Resource note: The 15-min cron is very lightweight β€” one API call per city (9 calls, 0.5s delay each = 5s total). No HTML generation, just DB writes. Pi can handle this easily alongside existing workload.

8. User Interface

Simple forecast page β€” rain alert banner

🌧️
Rain expected in ~35 minutes
Moderate intensity β€’ 82% confidence
85% radar nowcast + 15% ICON-D2

When no rain is approaching

β˜€οΈ No precipitation expected in the next 2 hours

Active rain

🌧️
Rain ongoing β€” expected to stop in ~45 min
Light intensity β€’ decreasing

How it reads nowcast data

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},
    ...
  ]
}

9. Verification & Learning

Same philosophy as AMFOR's model validator β€” but at 15-minute resolution:

Issue nowcast β€” store predicted precip_mm for each 15-min slot
Wait β€” let the predicted time pass
Observe β€” fetch actual measured precipitation (Open-Meteo archive, 15-min)
Score β€” fill observed_mm, compute hit/miss/false alarm per source
Learn β€” adjust blend weights based on rolling accuracy

Metrics tracked

MetricDefinitionTarget
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 errorPredicted start time vs actual start< 15 min at +1h

What we can learn over time

10. Implementation Phases

1

Radar Nowcast Fetch + Display

βœ… DONE
2

Blend with NWP

1–2 days
3

Verification Pipeline

2–3 days
4

Adaptive Weights + Regime Detection

3–5 days
5

Notifications + Gardener Integration

2–3 days

11. Compatibility with Existing System

ComponentImpact
Hourly cron (run.sh)Unchanged β€” continues generating 7-day AMFOR blend
forecasts_live tableUnchanged β€” still holds full 72h AMFOR data
Simple forecast pageGains rain alert banner (reads nowcast JSON)
7-day forecast pageUnchanged
Model validatorGains new "Nowcast accuracy" section (Phase 3)
Gardener weather widgetCan optionally show "rain soon" indicator (Phase 5)
Pi resource usageMinimal β€” 9 API calls every 15 min (~5s total)

12. Risks & Mitigations

RiskImpactMitigation
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.

13. Summary

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.

Amfor-Cast Nowcast Plan β€” August 2026