Skip to content

Expand hourly Energy-Charts zones onto the 15-minute grid - #107

Merged
enoch85 merged 1 commit into
mainfrom
fix/energy-charts-expand-hourly
Jun 28, 2026
Merged

Expand hourly Energy-Charts zones onto the 15-minute grid#107
enoch85 merged 1 commit into
mainfrom
fix/energy-charts-expand-hourly

Conversation

@enoch85

@enoch85 enoch85 commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Problem

Energy-Charts returns hourly data for some zones (e.g. CH) and 15-min for others (e.g. SE4), but the parser kept whatever resolution the API returned. An hourly zone therefore parsed as 24/96 intervals → no price for the current 15-min interval (has_current=False).

Found live: during an ENTSO-E upstream outage, CH (entsoe primary) fell back to Energy-Charts and showed today=24, has_current=False. Verified: api.energy-charts.info/price?bzn=CH returns 24 points at 60-min spacing, and the Energy-Charts parser — unlike omie_parser/aemo_parser/comed_parser — does not call convert_to_target_intervals.

Fix

Detect the source step from the first two parsed interval keys and expand a coarser-than-target resolution onto the 15-min grid via the existing interval_expander (same pattern the OMIE/AEMO/ComEd parsers already use). A 15-min source is a no-op. Step detection reads the parsed ISO keys, not the raw input, so invalid/missing timestamps can't break it.

Tests

  • New: hourly (24 points) → 96; native 15-min (96) unchanged.
  • Updated one existing test (test_energy_charts_unix_timestamp_input): its 3 hourly points now expand to 12 (3 × 4) — reflecting the intended expansion, not masking a regression.
  • Full suite 495 pass / 3 skip; black clean; pylint 9.70.

Scope / reviewer note

This changes Energy-Charts parsing for all hourly zones (no-op for 15-min zones, which are the common case). Not deployed here yet — flagged for review since Energy-Charts is a common primary/fallback source.

Energy-Charts returns hourly data for some zones (e.g. CH) and 15-min for
others (e.g. SE4), but the Energy-Charts parser kept whatever resolution the
API gave. So an hourly zone parsed as 24/96 intervals, which leaves no price
for the current 15-min interval (has_current=False). This surfaces when an
ENTSO-E outage forces such a zone onto the Energy-Charts fallback.

Detect the source step from the first two parsed interval keys and expand a
coarser-than-target resolution onto the integration's interval grid via the
existing interval_expander (the same approach OMIE/AEMO/ComEd already use). A
15-min source is a no-op. Detection reads the parsed ISO keys (not the raw
input) so invalid/missing entries can't break it.

Tests: hourly (24 points) -> 96; native 15-min (96) unchanged; the existing
unix-timestamp test (3 hourly points) now expects 12 (3 x 4), reflecting the
expansion.
@enoch85
enoch85 merged commit e6fc650 into main Jun 28, 2026
9 checks passed
@enoch85
enoch85 deleted the fix/energy-charts-expand-hourly branch June 28, 2026 12:57
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