Getting Started
earthkit-data-meteoswiss-opendata provides earthkit-data source plugins 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 and meteoswiss-opendata-constants source plugins. 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(time_dims=["forecast_reference_time", "step"], squeeze=False)
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"].
Model Constants
Load the horizontal or vertical constants associated with a model collection:
horizontal = ekd.from_source(
"meteoswiss-opendata-constants",
collection="ogd-forecasting-icon-ch2",
asset="horizontal",
)
vertical = ekd.from_source(
"meteoswiss-opendata-constants",
collection="ogd-forecasting-icon-ch2",
asset="vertical",
)
The asset parameter accepts "horizontal" or "vertical". The returned data can be handled with the standard earthkit methods e.g. to_xarray() or to_target(), for example:
horizontal.to_target(
"file",
"horizontal_constants_icon-ch2-eps.grib2",
)
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.
Metadata
Release files for earthkit-data-meteoswiss-opendata 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| earthkit_data_meteoswiss_opendata-0.2.0.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| earthkit_data_meteoswiss_opendata-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / earthkit_data_meteoswiss_opendata-0.2.0.tar.gz
| Download URL | earthkit_data_meteoswiss_opendata-0.2.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75d8d577657c3edb3ececa6f7ef2d583d1195fea85e210ee9262b2efc4433e12
|
|
BLAKE2b-256 checksum How to use checksums |
a8ee93685896d367364dff196d0fd4676b163794d34b58a68e57e1e8214a6739
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / earthkit_data_meteoswiss_opendata-0.2.0-py3-none-any.whl
| Download URL | earthkit_data_meteoswiss_opendata-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24ecac4019a44de6ad44b97c2570e30eb2b083dc442afcb155eaeda0b6170463
|
|
BLAKE2b-256 checksum How to use checksums |
7583878b79f65fff663becdc86be3f249e9177eae4c813ec25629a414f6890ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency log