Earthkit-data plugin for accessing NWP MeteoSwiss Open Data.
Project description
Getting Started
earthkit-data-meteoswiss-opendata is an earthkit-data source plugin for accessing MeteoSwiss numerical weather prediction data through the MeteoSwiss Open Data STAC API.
Installation
Install the released package with pip:
$ pip install earthkit-data-meteoswiss-opendata
With Poetry:
$ poetry add earthkit-data-meteoswiss-opendata
Installing the package also installs earthkit-data and automatically registers the meteoswiss-opendata source plugin. No additional plugin configuration is required.
Using the Library
Load the latest deterministic ICON-CH2-EPS forecast +0h, +1h & +2h for total precipitation:
import datetime as dt
import earthkit.data as ekd
forecast = ekd.from_source(
"meteoswiss-opendata",
collection="ogd-forecasting-icon-ch2",
variable="TOT_PREC",
perturbed=False,
ref_time="latest",
lead_time=[
dt.timedelta(hours=0),
dt.timedelta(hours=1),
dt.timedelta(hours=2),
],
)
dataset = forecast.to_xarray(profile="grib")
print(dataset)
For ref_time="latest", the plugin selects the newest forecast run that contains all requested lead times. An exact reference time can be provided as a timezone-aware datetime.datetime:
forecast = ekd.from_source(
"meteoswiss-opendata",
collection="ogd-forecasting-icon-ch2",
variable="TOT_PREC",
perturbed=False,
ref_time=dt.datetime(
2026,
7,
20,
6,
tzinfo=dt.timezone.utc,
),
lead_time=dt.timedelta(hours=1),
)
ISO 8601 strings such as "2026-07-20T06:00:00Z" and "PT1H" are also accepted.
Parameters
- collection
MeteoSwiss Open Data collection, for example ogd-forecasting-icon-ch2.
- variable
Forecast variable name, for example TOT_PREC.
- perturbed
False for deterministic data or True for perturbed data.
- ref_time
"latest", a timezone-aware datetime.datetime, an ISO 8601 datetime string, or an ISO 8601 datetime interval.
- lead_time
A datetime.timedelta, an ISO 8601 duration string, or a list of either. Examples include datetime.timedelta(hours=1), "PT1H", and ["PT0H", "PT1H", "PT2H"].
Development Setup with Poetry
Building the Project
$ cd earthkit-data-meteoswiss-opendata
$ poetry install
Run Tests
Run the offline unit tests:
$ poetry run pytest
Run the optional live integration test:
$ RUN_INTEGRATION=1 poetry run pytest -m integration
Run Quality Tools
$ poetry run pylint earthkit_data_meteoswiss_opendata
$ poetry run mypy earthkit_data_meteoswiss_opendata
$ poetry run ruff format --check
$ poetry run ruff check
Generate Documentation
$ poetry run sphinx-build doc doc/_build
Then open doc/_build/index.html.
Build Wheels
$ poetry build
Release the Project
The project follows the GitOps concept: releases are triggered whenever a Git tag is created.
The tag must follow Semantic Versioning and PEP 440. Otherwise, the release task will fail.
Follow these steps to create a release:
Update CHANGELOG.rst with the release information.
Update doc/_static/switcher_config.json with the new documentation URL.
Create a new release and matching tag in the GitHub project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file earthkit_data_meteoswiss_opendata-0.1.0.tar.gz.
File metadata
- Download URL: earthkit_data_meteoswiss_opendata-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6339f7be13a2b96960f4df45216287cd8d4fda2fdd99c735919a5678e66a01a
|
|
| MD5 |
f8e30c00927e7339bc22ad163d11afec
|
|
| BLAKE2b-256 |
abdbeb260383ec1adae9a48d5a853e898f0d182659d1f5e4c5f60ae0f4fc4be8
|
Provenance
The following attestation bundles were made for earthkit_data_meteoswiss_opendata-0.1.0.tar.gz:
Publisher:
CI_publish.yaml on MeteoSwiss/earthkit-data-meteoswiss-opendata
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
earthkit_data_meteoswiss_opendata-0.1.0.tar.gz -
Subject digest:
b6339f7be13a2b96960f4df45216287cd8d4fda2fdd99c735919a5678e66a01a - Sigstore transparency entry: 2257392414
- Sigstore integration time:
-
Permalink:
MeteoSwiss/earthkit-data-meteoswiss-opendata@46ef247be313d1c2fd1d4da2d5ac537ac7e51881 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/MeteoSwiss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CI_publish.yaml@46ef247be313d1c2fd1d4da2d5ac537ac7e51881 -
Trigger Event:
push
-
Statement type:
File details
Details for the file earthkit_data_meteoswiss_opendata-0.1.0-py3-none-any.whl.
File metadata
- Download URL: earthkit_data_meteoswiss_opendata-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c636fbde6998ba040246aa7d337b47a91e6d423949e7dd1ab2d81877ce8630f6
|
|
| MD5 |
3eb812db2ed2dbf439a78b2b151f6d7b
|
|
| BLAKE2b-256 |
337d0d010478988a1eafd825af8cb351d847585a3b9b84526260e89107cff01e
|
Provenance
The following attestation bundles were made for earthkit_data_meteoswiss_opendata-0.1.0-py3-none-any.whl:
Publisher:
CI_publish.yaml on MeteoSwiss/earthkit-data-meteoswiss-opendata
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
earthkit_data_meteoswiss_opendata-0.1.0-py3-none-any.whl -
Subject digest:
c636fbde6998ba040246aa7d337b47a91e6d423949e7dd1ab2d81877ce8630f6 - Sigstore transparency entry: 2257392428
- Sigstore integration time:
-
Permalink:
MeteoSwiss/earthkit-data-meteoswiss-opendata@46ef247be313d1c2fd1d4da2d5ac537ac7e51881 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/MeteoSwiss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CI_publish.yaml@46ef247be313d1c2fd1d4da2d5ac537ac7e51881 -
Trigger Event:
push
-
Statement type: