Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ENTSOE.py): Parse and combine both kinds of exchange forecasts #6577

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

VIKTORVAV99
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 commented Mar 23, 2024

Issue

Currently we are only parsing the Total forecasts which are the most accurate but this means we are missing out on the day ahead forecasts which are available further into the future than the total forecasts are.

Description

This PR duplicates some functionality for the sake of simple logic in order to parse the day_ahead forecasts and then update them with the total forecasts so we get benefits of the longer day_ahead forecasts while retaining the shorter term accuracy of the total forecasts.

TODO:

  • Add new snapshot features that matches the current lookup periods to ensure the new code work as expected.

Preview

Latest value on master

 {'datetime': datetime.datetime(2024, 3, 23, 22, 0, tzinfo=datetime.timezone.utc),
  'netFlow': 0.0,
  'sortedZoneKeys': 'EE->FI',
  'source': 'entsoe.eu',
  'sourceType': <EventSourceType.forecasted: 'forecasted'>}

Latest value on this branch

 {'datetime': datetime.datetime(2024, 3, 24, 22, 0, tzinfo=datetime.timezone.utc),
  'netFlow': -358.0,
  'sortedZoneKeys': 'EE->FI',
  'source': 'entsoe.eu',
  'sourceType': <EventSourceType.forecasted: 'forecasted'>}

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier@2 --write . and poetry run format in the top level directory to format my changes.

@github-actions github-actions bot added parser python Pull requests that update Python code labels Mar 23, 2024
@github-actions github-actions bot added the tests label Mar 25, 2024
@VIKTORVAV99 VIKTORVAV99 marked this pull request as ready for review March 25, 2024 19:04
@VIKTORVAV99 VIKTORVAV99 changed the title Updated ENTSO-E forecasts feat(ENTSOE.py): Parse and combine both kinds of exchange forecasts Mar 25, 2024
@@ -926,13 +936,45 @@ def parse_exchange(
datetime_start = datetime.fromisoformat(
zulu_to_utc(timeseries.find_all("start")[0].contents[0])
)
# Only use contract_marketagreement.type == A01 (Total to avoid double counting some columns)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this? Are we not risking the double counting if we start ingesting the other forecasts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both kinds are returned in the same API call so in order to parse it we need to make this dynamic.

Right now it calls the parser function twice, first for the day-ahead values and a second time for the total values to then combine them.

Functionally it should do the same but just use a dynamic config instead of a static value.


return ExchangeList(logger).merge_exchanges(raw_exchange_lists, logger)
if raw_exchange is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we separate more clearly the forecast and non forecasts cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can but it would likely result in more code duplication, if that's okay I can do right ahead and split them apart further.

marketAgreementType = timeseries.find("contract_marketagreement.type").contents[
0
]
if marketAgreementType and marketAgreementType != market_type.value:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pierresegonne here is the functional equivalent of the previous check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser python Pull requests that update Python code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants