feat: add precipitation forecast backtest tool for Adlershof, Berlin - #746
Draft
kaihowl wants to merge 5 commits into
Draft
feat: add precipitation forecast backtest tool for Adlershof, Berlin#746kaihowl wants to merge 5 commits into
kaihowl wants to merge 5 commits into
Conversation
Adds scripts/precip_backtest.py, a standalone CLI tool that backtests precipitation forecast accuracy (MAE, bias, CSI, ETS) per model and lead time (1-7 days) against ERA5 reanalysis, using Open-Meteo's Previous Runs and Historical Weather APIs. Results are cached in a local SQLite DB so repeated runs only fetch new/missing days, and output a metrics CSV plus a skill-degradation line chart. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01962HS1Be92ZPbMipafvkZB
Contributor
Performance ReportAudit ResultsMeasurement Storage SizeCreated by git-perf |
Adds meteofrance_arome_france_hd alongside the standard-resolution AROME model, since Open-Meteo exposes both as distinct model identifiers and the higher-resolution variant performs measurably better for Adlershof (lower MAE and bias, slightly higher CSI at day-1 lead). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01962HS1Be92ZPbMipafvkZB
Adds a location dimension to the SQLite cache (date, location, model, lead_time / date, location) so multiple locations can be backtested without one overwriting another's cached data, with a --location-name flag and a per-location output subdirectory. Existing single-location caches migrate in place, tagged as "adlershof", instead of being discarded. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01962HS1Be92ZPbMipafvkZB
Adds an optional second ground-truth reference (DWD station observations via wetterdienst, --dwd-station-ids) alongside ERA5, since ERA5 shares model physics with ecmwf_ifs025 and can make it look more skillful than it really is. metrics.csv gains a `reference` column (era5/station), and a new delta_skill.csv / delta_skill_ecmwf.png report ERA5 score minus station score per model and lead time to surface that verification bias directly. For Adlershof, station data comes from Berlin-Tempelhof (00433) and "Berlin Brandenburg" (00427) — DWD's current name for the long-running station at the former Berlin-Schönefeld site, renamed after the BER airport merger. The observed table gains a `source` column with an in-place migration for existing caches (tagged as era5). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01962HS1Be92ZPbMipafvkZB
Generalizes the independent station reference from DWD-only to a pluggable --station-provider (dwd, geosphere), since DWD only covers Germany and the Oetztal Alps location needs an Austrian reference. --dwd-station-ids is renamed to --station-ids to match. For the Oetztal Alps, uses GeoSphere Austria (ZAMG) stations Umhausen (1035m) and St. Leonhard im Pitztal (1454m), bracketing the target point's ERA5 grid-cell elevation (~1175m) from below and above, the same way Tempelhof/Berlin-Brandenburg bracket Adlershof. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01962HS1Be92ZPbMipafvkZB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a standalone Python CLI tool (
scripts/precip_backtest.py) that backtests precipitation forecast accuracy for Adlershof, Berlin (52.43°N, 13.53°E) across weather models and lead times, unrelated to the Rustgit-perf/cli_typescrates.Type of Change
feat: New featurefix: Bug fixdocs: Documentation updaterefactor: Code refactoring (no functional changes)test: Test additions or improvementschore: Maintenance tasks (dependencies, build, etc.)perf: Performance improvementci: CI/CD changesChanges
scripts/precip_backtest.py— CLI tool (run viauv run scripts/precip_backtest.py, PEP 723 inline deps:requests,pandas,matplotlib) that:icon_seamless,gfs_seamless,ecmwf_ifs025,meteofrance_arome_france, andukmo_seamless.metrics.csv.skill_degradation.png, MAE and CSI(>1mm) vs. lead time, one line per model).scripts/precip_backtest_README.md— usage notes..gitignore— ignore the tool's default cache DB and output directory.Related Issues
N/A — ad hoc tooling request, not tied to a tracked issue.
Testing
cargo nextest run -- --skip slow— N/A, no Rust code changedcli_types/git_perfwas touchedManual test results:
Ran the script end-to-end against the live Open-Meteo APIs for a small date range (
2025-06-01..2025-06-15, two models, three lead times):--end-dateonly fetched the new days (confirmed via log output), leaving previously cached days untouched.--skip-fetchrecomputesmetrics.csvandskill_degradation.pngfrom the cache with no network access.metrics.csvcontents and inspected the generated chart visually.ruff check/ formatted withruff format(clean).Documentation
scripts/precip_backtest_README.md)git-perfbinaryPre-Submission Checklist
cargo fmt— N/A, Python only; formatted withruff formatinsteadcargo clippy— N/A, Python only;ruff checkpasses insteadcargo nextest run -- --skip slow— N/A, no Rust code changedAdditional Context
Out of scope per the original request: UI/dashboard (CLI + CSV/PNG output only).
Generated by Claude Code