Skip to content

feat(power_forecast): stitched day-ahead timeseries with date-range support#78

Merged
mroberto166 merged 7 commits into
mainfrom
preview2/day-ahead-stitched-timeseries-cb2e
Jun 3, 2026
Merged

feat(power_forecast): stitched day-ahead timeseries with date-range support#78
mroberto166 merged 7 commits into
mainfrom
preview2/day-ahead-stitched-timeseries-cb2e

Conversation

@mroberto166

@mroberto166 mroberto166 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds PowerForecast.get_day_ahead_timeseries() — a helper that stitches a continuous day-ahead time series from the forecast runs at a given init hour, plus a date-range mode for plotting arbitrarily long histories.

  • Day-ahead stitching: selects runs whose local init-hour matches init_hour (in time_zone), takes each run's day-ahead window [(24-init_hour), (24-init_hour)+24) h, and concatenates into one continuous time axis.
  • Date-range mode (start_date/end_date): constructs the daily init runs directly and fetches them in a single request, bypassing the init-times listing cap (server limits limit to 1000 ≈ 11 days). Enables stitching a full year. Result is clipped to the requested valid-time window (UTC-normalized).
  • Latest mode (no dates): discovers recent matching runs via the init-times endpoint (bounded by max_init_times), backward compatible.
  • Overlap dedup: when sub-hourly runs share a target hour (e.g. GB 07:00 & 07:30), their windows overlap; we keep the most recent init per (zone_key, psr_type, time) to avoid a non-unique-index crash.

Test plan

  • Unit tests: stitch-across-days, overlapping-run dedup, date-range build/clip (get_init_times not called in date-range mode).
  • Full unit suite green (159 passed).
  • Live functional power-forecast tests green (15 passed).
  • Verified live for DE/GB across UTC and Europe/Berlin, 3-month and 1-year ranges (continuous, unique 15-min series).
  • Cross-checked apparent gaps against production.power_forecast_predictions — confirmed real upstream data outages, not stitching bugs.

cursoragent and others added 6 commits June 3, 2026 10:09
…ead window by init-hour; include unit test covering 09:00 -> 15..39h selection

Co-authored-by: mroberto166 <mroberto166@users.noreply.github.com>
… naive-time comparison to avoid TZ coercion differences

Co-authored-by: mroberto166 <mroberto166@users.noreply.github.com>
Co-authored-by: mroberto166 <mroberto166@users.noreply.github.com>
Co-authored-by: mroberto166 <mroberto166@users.noreply.github.com>
Construct daily init runs directly from start_date/end_date and fetch in
a single request, bypassing the init-times listing limit so arbitrarily
long histories can be stitched. Also dedupe overlapping windows from
sub-hourly runs (keeping the most recent init) to avoid a non-unique
index crash.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@mroberto166 mroberto166 force-pushed the preview2/day-ahead-stitched-timeseries-cb2e branch from e112660 to 240f0c7 Compare June 3, 2026 11:12
@mroberto166 mroberto166 changed the title Add stitched day-ahead timeseries helper to PowerForecast feat(power_forecast): stitched day-ahead timeseries with date-range support Jun 3, 2026
… clip

Co-authored-by: Cursor <cursoragent@cursor.com>
@mroberto166 mroberto166 marked this pull request as ready for review June 3, 2026 11:57
@mroberto166 mroberto166 requested a review from a team as a code owner June 3, 2026 11:57
@mroberto166 mroberto166 merged commit e8877a7 into main Jun 3, 2026
45 checks passed
@mroberto166 mroberto166 deleted the preview2/day-ahead-stitched-timeseries-cb2e branch June 3, 2026 12:39
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.

3 participants