Skip to content

feat(weather-recon): Phase 2a — observations pipeline, 19k METARs loaded (#184)#193

Merged
robbiebyrd merged 7 commits into
mainfrom
feat/weather-recon-obs
Jul 12, 2026
Merged

feat(weather-recon): Phase 2a — observations pipeline, 19k METARs loaded (#184)#193
robbiebyrd merged 7 commits into
mainfrom
feat/weather-recon-obs

Conversation

@robbiebyrd

Copy link
Copy Markdown
Collaborator

Phase 2a of the Weather app (#184): the observations pipeline. Real hourly METAR/SPECI conditions for 2001-09-09..12 are now loaded in production Directus — 19,176 observations across 187/188 stations.

What's in here

  • weather_recon/obs.py — ISD global-hourly field parsers (WND/TMP/DEW/SLP/VIS/GF1/MW1/OC1/REM → typed columns) + row shaping: METAR/SPECI filter, per-timestamp dedupe (FM-15 wins), raw METAR extraction. Test fixtures are real captured KORD Sept-2001 values.
  • weather_recon/fetch_ncei.py — per-station subset fetch from NCEI's data service (endDate-inclusive, dynamic columns) with per-(station, window) disk cache — retries and re-runs replay from disk.
  • weather_recon/flow_observations.pyload-weather-observations flow: fetch 188 stations → shape → idempotent delete_all + insert.
  • ISD_OVERRIDES in scripts/build_stations.py — 9 stations (CYUL, KBGR, KCXY, KDAL, KMHT, KMRY, KOAK, KSMF, MMUN) had isd-history ids with no 2001-09 data (placeholder-USAF rows); each override was validated against live NCEI before acceptance. KFLG genuinely has no Sept-2001 ISD data and stays as a dataless station.
  • Phase-1 final-review nits: PK-derived insert_many fields param, fail-fast env checks in _client, doc fixes.

Verification

  • 50/50 pytest, ruff clean.
  • Live-verified in prod: 19,176 rows; KORD = 110 exactly; KJFK's 9/11 morning shows the historically clear sky (FEW/SCT, ~16 km vis, 17.8→22.8 °C) and the 13:51Z METAR carries FU PLUME DSNT NW DRFTG SE — the WTC smoke plume in the real record. Idempotent reload confirmed.
  • Final review independently re-derived the full dataset from the raw cached NCEI responses: exact prod count, sane distributions (temps −3.0..42.2 °C, pressure 995.5..1030.2 hPa).

Follow-ups (Phase 2b)

README refresh (stale layout section), decide whether observations gets a work-pool deployment registration, header sanity-check on cached fetches.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W179bqEPFP92a3JrsPkD5c

Robbie Byrd and others added 7 commits July 12, 2026 20:25
Implements parse_tenths, parse_wnd, parse_gust, parse_vis_km, sky_from_gf1,
weather_from_mw1, and raw_metar_from_rem parsers for NCEI ISD CSV fields.
All 14 tests pass with fixtures from real KORD 2001-09 data.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W179bqEPFP92a3JrsPkD5c
WMO ww code 47 genuinely means fog (fog, sky invisible), so the WW_CODES
entry was correct and the test fixture was wrong. Restore "47": "fog" and
exercise the unknown-code path with 39 (blowing snow band) instead.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W179bqEPFP92a3JrsPkD5c
…ad identifiers

pick_station_rows() picks the isd-history row that exactly matches a curated
ICAO and nominally covers 2001-09-09..12, but for 10 stations that row was a
dead end against the live NCEI global-hourly API (placeholder USAF, or a file
with zero FM-15/METAR rows for the window). Add an ISD_OVERRIDES map, verified
against the live API, that repoints 9 of them at a working USAF-WBAN for the
same airport; KFLG has no working alternate and stays empty. Reloaded
weather_stations (188) and weather_observations (18315 -> 19176).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W179bqEPFP92a3JrsPkD5c
@github-actions

Copy link
Copy Markdown

Playwright E2E — 1 passed · 0 failed · 0 flaky · 0 skipped

Full report

@robbiebyrd robbiebyrd merged commit a34cb57 into main Jul 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant