-
-
Notifications
You must be signed in to change notification settings - Fork 28
Add 5-year German solar data backfilling support with a CSV export #94
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
base: main
Are you sure you want to change the base?
Add 5-year German solar data backfilling support with a CSV export #94
Conversation
|
Completed a few extra minor corrections for the PR. If there's any further changes you'd like me to make @peterdudfield , please let me know. |
|
@peterdudfield Would appreciate a review when you're free. |
|
Updates: Code
Tests
|
| @@ -0,0 +1 @@ | |||
| target_datetime_utc,solar_generation_kw,tso_zone | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you remove this csv, its only the headings, and I think its more confusion. The code should add headings if needed
| from solar_consumer.data.fetch_de_data import fetch_de_data_range | ||
|
|
||
|
|
||
| def main(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you move this to a scripts folder please
|
Thanks, im gona ask @zakwatts to have a look at this |
|
Thanks @Shohail-Ismail, I've just requested an API key from ENTSOE so I can test this out. It might take a day or two for them to get back to me so I'll update you in due course. |
|
All good @zakwatts, just pushed the changes you requested. Let me know of any updates. |
|
Hi @Shohail-Ismail, I've had another review and think what you have written might be quite tricky for others to maintain. Instead of creating an xml passer, we could use an existing one from This library handles the chunking, XML parsing and mapping quite well and it well maintained from what I can tell. It should allow us to go from around 300 lines of code to ~30 in the pull data function. |
|
You could do something like: Might need to modify the final formats, and check the country code, but I think this could help simplify things quite a bit! |
…ts client, replacing ENTSOE HTTP/XML parsing
…ingly (UTC normalisation check + sub-hourly resolution fetch test)
|
Thanks for your review and suggestions @zakwatts. I've replaced Additionally, the format is normalised to UTC, kW, tso_zone, with corresponding tests updated and 2 new tests added:
Regarding the CI failure - as far as I can tell, this is due to a live integration test against the Elia API (Belgium) causing an intermittent failure - fix for this seems relatively simple (add a skip guard to Would appreciate a review and any further thoughts when you have some time @zakwatts, thanks. |
Description
Adds support for backfilling German solar generation data from ENTSOE for the last 5 years and saving the results to a CSV.
Key changes:
_fetch_de_windowfor fetching arbitrary time windows from ENTSOEfetch_de_data_range(start, end, chunk_hours)to handle multi-year ranges via chunked requests__main__entrypoint infetch_de_data.pyto run a 5-year backfill directly as a scriptB16andA-10Y1001A1001A83Hpsr codes, covering both live API and test fixturesdata/de_solar/germany_solar_generation.csvThis PR keeps the existing 24-hour
fetch_de_data()API intact (used elsewhere) while adding range support as a separate function.Tests
ENTSOE_API_KEYand session calls in tests to avoid real network callsChecklist:
Closes #88