Expand hourly Energy-Charts zones onto the 15-minute grid - #107
Merged
Conversation
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.
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.
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=CHreturns 24 points at 60-min spacing, and the Energy-Charts parser — unlikeomie_parser/aemo_parser/comed_parser— does not callconvert_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
test_energy_charts_unix_timestamp_input): its 3 hourly points now expand to 12 (3 × 4) — reflecting the intended expansion, not masking a regression.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.