Skip to content

feat(weather): population-weighted multi-city index + degree-hours / apparent-temperature / dew-point features#345

Merged
bartzbeielstein merged 1 commit into
developfrom
feat/global-weather-features
Jun 8, 2026
Merged

feat(weather): population-weighted multi-city index + degree-hours / apparent-temperature / dew-point features#345
bartzbeielstein merged 1 commit into
developfrom
feat/global-weather-features

Conversation

@bartzbeielstein
Copy link
Copy Markdown
Collaborator

What

Adds the cheapest, most reliable load-forecasting accuracy levers as opt-in, fail-safe, deterministic weather features. All flags default off, so the pipeline stays byte-identical to the single-point baseline.

New weather/derived.py (pure functions)

  • Heating / cooling degree-hours (hdh/cdh) — split the U-shaped temperature–load response into its two arms (ruba23a).
  • Apparent temperature (Steadman) and dew point (Magnus) — fold in the humidity driver dry-bulb temperature misses (maia20a).
  • population_weighted_average — combine per-city frames into one demand-weighted national index (zimm25a).
  • add_derived_weather_features — deterministic orchestrator; raises on a missing source column rather than imputing.

New weather/locations.py

A fixed, deterministic registry of 13 German load centres, weighted by population and deliberately spread across all regions (N/S/E/W) so the national index is not dominated by one climate zone.

Wiring (opt-in, non-breaking)

  • get_weather_features gains locations / location_weights (multi-city population weighting) and derived_features / hdh_base / cdh_base / wind_speed_unit.
  • ConfigMulti gains use_population_weighted_weather, include_degree_hours, include_apparent_temperature, degree_hours_base_heating/cooling.
  • BaseTask.build_exogenous_features wires them through (getattr-guarded for configs predating the fields).

Why

Implements the lecture's "what to adopt next" priorities #1#2 (degree-hours + apparent temperature + dew point, then population-weighted multi-city temperature) from "Additional exogenous inputs beyond weather and holidays", and the global, population-weighted weather requested on the sf2 roadmap (current weather is a single Open-Meteo point at Dortmund).

Safety (sf2-safe contract)

Keyless (Open-Meteo), deterministic (fixed city list + fixed published weights, no RNG/wall-clock, stable column order), fail-safe (a missing source column / out-of-range humidity / mismatched index raises ValueError, never silent repair). No prohibited dependencies — numpy/pandas only.

Tests & QC

  • 46 new tests: pure functions, fail-safe paths, determinism, and the wired get_weather_features path via a monkeypatched Open-Meteo fetch (fully offline).
  • Full suite: 2399 passed, coverage 71.9% (gate 68%); weather/derived.py 98%.
  • ruff / black / isort clean; REUSE compliant; new modules ty-clean.
  • docs/reference/ regenerated (new symbols registered in _quarto.yml); docs-reference-sync gate satisfied.

🤖 Generated with Claude Code

…parent-temperature/dew-point features

Add the cheapest, most reliable load-forecasting accuracy levers — the
feature-matrix gains that live in x_t, not the model f(.) — as opt-in,
fail-safe, deterministic weather features. All default off, so the pipeline
stays byte-identical to the single-point baseline.

New module weather/derived.py (pure functions):
- heating/cooling degree-hours (hdh/cdh) — split the U-shaped temperature
  response into its two arms (ruba23a)
- apparent temperature (Steadman) and dew point (Magnus) — fold in the
  humidity driver dry-bulb temperature misses (maia20a)
- population_weighted_average — combine per-city frames into one demand-
  weighted national index (zimm25a)
- add_derived_weather_features — deterministic orchestrator, raises on a
  missing source column rather than imputing

New module weather/locations.py: a fixed, deterministic registry of 13
German load centres weighted by population and spread across all regions so
the national index is not dominated by one climate zone.

get_weather_features gains opt-in locations/location_weights (multi-city
population weighting) and derived_features/hdh_base/cdh_base/wind_speed_unit
parameters; ConfigMulti gains use_population_weighted_weather,
include_degree_hours, include_apparent_temperature, degree_hours_base_*; and
BaseTask.build_exogenous_features wires them through (getattr-guarded for
configs predating the fields).

Implements the "what to adopt next" priorities #1-#2 from the lecture's
"Additional exogenous inputs beyond weather and holidays" and the global
population-weighted weather requested for the sf2 roadmap. Stays within the
sf2-safe contract: keyless, deterministic, fail-safe, no prohibited deps.

Tests: 46 new (pure functions, fail-safe, determinism, monkeypatched wired
path). Docs reference regenerated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bartzbeielstein bartzbeielstein merged commit 8afcc77 into develop Jun 8, 2026
10 checks passed
@bartzbeielstein bartzbeielstein deleted the feat/global-weather-features branch June 8, 2026 16:07
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