Skip to content

Download SARAH data via API - #539

Open
jome1 wants to merge 7 commits into
PyPSA:masterfrom
jome1:sarah_api
Open

jome1 wants to merge 7 commits into
PyPSA:masterfrom
jome1:sarah_api

Conversation

@jome1

@jome1 jome1 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Closes #447. Assisted by AI.

Changes proposed in this Pull Request

Download SARAH data via API (EUMDAC).

Details:

  • Adds parallel product downloads, ZIP extraction, retries, and cleanup of temporary files in sarah.py.
    max. 15 parallel connections (see here
  • Adds the sarah_from_api and sarah_api_workers options to the cutout documentation in cutout.py.
  • Calls module cleanup after preparation, including when preparation raises an error, in data.py.
  • Adds the optional sarah-api dependency, mocked API tests, and a release-note entry in pyproject.toml, test_sarah_api.py, and RELEASE_NOTES.rst.
    I have no experience with test. The tests were completely created by AI.

How to use:

  1. Install additional dependency: conda install -c conda-forge eumdac
  2. create an EUMETSAT user account here. Find API credentials here. Setup the API credentials in Terminal using the following command: eumdac set-credentials ConsumerKey ConsumerSecret
    (more info here)
  3. use sarah_from_api=True in atlite.Cutout() when specifying cutout. For example:
cutout = atlite.Cutout(
    path="sarah_test.nc",
    module=["sarah"],
    sarah_from_api=True,
    sarah_api_workers=15,
    x=slice(31.6, 33.3),
    y=slice(28.3, 29.5),
    time=slice("2019-01-01", "2019-01-05"),
)

cutout.prepare()

ToDo

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.

@jome1

jome1 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

I think we should have an option to not delete the raw SARAH files, in case someone want to create cutouts for multiple countries.

This branch has not been deployed

No deployments
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.

Use API to download SARAH data

1 participant