Skip to content

Implement GLOFAS dataset#498

Draft
StuberSimon wants to merge 3 commits intoPyPSA:masterfrom
StuberSimon:glofas-support
Draft

Implement GLOFAS dataset#498
StuberSimon wants to merge 3 commits intoPyPSA:masterfrom
StuberSimon:glofas-support

Conversation

@StuberSimon
Copy link
Copy Markdown

Refs #450

Changes proposed in this Pull Request

  • Implement GLOFAS dataset for hydro functionality
  • Add option to use glofas data for plant inflow

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@StuberSimon
Copy link
Copy Markdown
Author

Hey there, I'm still new to the github workflow, so please let me know how I can improve :)
This is part of my bachelors thesis supervised by @doneachh.
Thank you @ekatef and @euronion for offering your support.
This pr is a work in progress, next step for me is to make river discharge provided by glofas selectable in cutout.hydro()

Copy link
Copy Markdown
Contributor

@ekatef ekatef left a comment

Choose a reason for hiding this comment

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

Great @StuberSimon! Looks a very good progress, and happy to see GloFAS is being implemented. Have taken a liberty to do a preliminary code review and added a few comments hoping to assist you in getting used to github. My general impression that you are getting things perfectly right and the implementation looks quite neat in general.

Comment on lines +41 to +42
# Model and CRS Settings
crs = 4326
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand that this part is inherited from atlite itself but it would be great to cross-check it's applicable also for GloFAS

"dis24": "discharge",
}
)
# round coords since cds coords are float32 which would lead to mismatches
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it the case also for GloFAS data?

Comment on lines +146 to +151
coords_as_attributes=[
"surface",
"depthBelowLandLayer",
"entireAtmosphere",
"heightAboveGround",
"meanSea",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks the names of the variables must be updated

Comment on lines +176 to +181
rename_vars = {
"time": "forecast_reference_time",
"step": "forecast_period",
"isobaricInhPa": "pressure_level",
"hybrid": "model_level",
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A revision may be needed also here

Download data like Glofas from the Climate Data Store (CDS).

If you want to track the state of your request go to
https://cds-beta.climate.copernicus.eu/requests?tab=all
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess the link needs update to match EWDS server (btw, it looks the doc string may need in era5.py may require an update as well):

Suggested change
https://cds-beta.climate.copernicus.eu/requests?tab=all
https://ewds.climate.copernicus.eu/requests?tab=all

Comment on lines +298 to +302
If static is False, this function creates a query for each month and year
in the time axis in coords. This ensures not running into size query limits
of the cdsapi even with very (spatially) large cutouts.
If static is True, the function return only one set of parameters
for the very first time point.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have noticed that EWDS server doesn't favour download a dataset for periods more than one year even for really small spatial areas (like 2x2 degrees). So, it looks even more crucial to have temporal disaggregation for GloFAS retrieval as compared with ERA5

Comment on lines +308 to +311
monthly_requests : bool, optional
If True, the data is requested on a monthly basis. This is useful for
large cutouts, where the data is requested in smaller chunks. The
default is False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given EWDS limitations, I'd expect monthly_requests=True could be a more reasonable default. Could be good to test if monthly_requests=False actually works for GloFAS retrieval

Comment on lines +1053 to +1054
Get inflow time-series for `plants` by extracting the discharge time series for
the nearest grid points.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Completely agree that it's worth to make sure the naming reflects different nature of variables in ERA5 and GloFAS datasets.
It could be a good idea also to mention both datasets in docstrings of the respective functions (that is mention here that _hydro_from_discharge is intended for usage on GloFAS data)

@ekatef
Copy link
Copy Markdown
Contributor

ekatef commented Apr 8, 2026

Hey there, I'm still new to the github workflow, so please let me know how I can improve :) This is part of my bachelors thesis supervised by @doneachh. Thank you @ekatef and @euronion for offering your support. This pr is a work in progress, next step for me is to make river discharge provided by glofas selectable in cutout.hydro()

Thank you @StuberSimon, looks a great contribution! From my users' perspective, I strongly confirm that having GloFAS would be an amazing feature 🙂

Have added a few preliminary technical comments while leaving more in-depth analysis for @euronion who has much deeper understanding of atlite architecture.

For the next step, do you need any support?

@ValeMTo
Copy link
Copy Markdown

ValeMTo commented Apr 10, 2026

Hi @StuberSimon, @ekatef, and @euronion

First off, great work on this PR. I completely agree with @ekatef that having GloFAS natively integrated is a fantastic and much-needed feature for the community.

I'm jumping into this conversation since @Asdominet34 and I have worked on improving the hydromodeling in PyPSA-Eur, by firstly connecting it with GloFAS, "calibrating" it, and then validating it with the real hydro production in Europe. Before pushing the work, we would like to finalize the pumped-storage logic and the working paper we had in mind. I think that there is space for collaboration. What do you think about organising a call next week?

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