Skip to main content

Python toolkit for Swiss weather data — download, query, and analyse MeteoSwiss Open Government Data

Project description

foehn

MeteoSwiss Open Data — Python API, CLI & MCP server · tabular as DataFrames/Parquet, gridded as xarray/Zarr

PyPI Latest Release Python Versions MIT License OpenSSF Scorecard Monthly Downloads


foehn downloads every MeteoSwiss OGD collection via the STAC API, converts CSV/TXT station data to Parquet with Polars, and opens gridded collections — NetCDF climate grids, GRIB2 forecasts, and ODIM radar composites — as xarray Datasets or Zarr stores. It can optionally ingest everything into Databricks Unity Catalog Delta tables on a daily schedule, and ships an MCP server so LLMs can query Swiss weather data directly.

Daily weather in Bern, powered by foehn

Daily weather in Bern, powered by foehn's MCP server and MeteoSwiss open data.

Why foehn?

  • 20+ collections in one command — weather stations, radar, hail maps, forecasts, climate scenarios, and more
  • Tabular and gridded — CSV station data as Polars DataFrames or Parquet; NetCDF, GRIB2 and ODIM radar grids as xarray Datasets or Zarr stores
  • MCP server for LLMs — give your favorite LLM live access to MeteoSwiss data with the MCP server
  • Significantly smaller on disk — columnar Parquet with Zstandard compression vs. raw CSVs
  • Incremental by default — only re-downloads files that changed since your last run, tracked via _last_run.json
  • No Spark required locally — download + conversion uses Polars only; Spark is optional for Delta ingestion
  • Ships a Declarative Automation Bundle — ready-to-deploy daily job and historical backfill, no pipeline config needed

Quick start

pip install foehn
foehn download

Recent data (Jan 1 to yesterday) is downloaded and converted to Parquet under ./data/meteoswiss/.

foehn CLI demo

Installation

From PyPI:

pip install foehn

From source:

git clone https://github.com/kayhendriksen/foehn
cd foehn
pip install -e .

With extras:

pip install "foehn[databricks]"   # PySpark + Delta
pip install "foehn[mcp]"          # MCP server
pip install "foehn[grids]"        # xarray + Zarr for all gridded data (NetCDF, GRIB2, radar)

Requires Python 3.11 or later.


Python API

import foehn

df = foehn.load("smn", station="BER", frequency="d")

Load data directly into Polars DataFrames, explore metadata, download to disk, and convert to Parquet — all from Python. See the full Python API documentation.


CLI

foehn download smn pollen
foehn load smn --station BER --frequency d

The CLI mirrors the Python API with subcommands for downloading, converting, loading, and inspecting metadata. See the full CLI documentation.


Gridded data

ds = foehn.open_dataset("surface_derived_grid", match="rhiresd")  # NetCDF climate grid
ds = foehn.open_dataset("forecast_icon_ch1", match="202605231500-0-t_2m-ctrl")  # one GRIB2 field
ds = foehn.open_dataset("radar_precip", match="cpc2613000000")    # one radar composite
foehn.to_zarr("surface_derived_grid", match="rhiresd")            # Zarr store

NetCDF climate grids/normals/scenarios, GRIB2 forecasts (ICON-CH1/CH2, KENDA), and HDF5/ODIM radar composites all open as xarray Datasets instead of DataFrames. One extra covers them: pip install "foehn[grids]". See the gridded data documentation.


MCP server

{
  "mcpServers": {
    "foehn": {
      "command": "foehn",
      "args": ["mcp"]
    }
  }
}

Give any MCP-compatible LLM live access to MeteoSwiss data. See the full MCP server documentation.


Documentation

Collections All 20+ MeteoSwiss datasets, categories, and time slice conventions
Python API Loading data, metadata, downloading, and Parquet conversion
Gridded data NetCDF grids as xarray Datasets and Zarr stores
CLI All subcommands, flags, and environment variables
MCP Server Setup, configuration, and available tools
Databricks Pipeline Declarative Automation Bundle deployment

Data sources

STAC API https://data.geo.admin.ch/api/stac/v1
Documentation https://opendatadocs.meteoswiss.ch
MeteoSwiss OGD https://github.com/MeteoSwiss/opendata

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foehn-0.3.3.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

foehn-0.3.3-py3-none-any.whl (60.0 kB view details)

Uploaded Python 3

File details

Details for the file foehn-0.3.3.tar.gz.

File metadata

  • Download URL: foehn-0.3.3.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for foehn-0.3.3.tar.gz
Algorithm Hash digest
SHA256 4de1291092804e88228403f5e6c44f8f02e98cc2ad23fe38ef98ec7aec2d1de6
MD5 22967eb81ce0271740a94a773e422c8b
BLAKE2b-256 4f3c2c3baa4d7f25df0c436d2705570c28d2b08b1add7b68958e548e488a7f87

See more details on using hashes here.

Provenance

The following attestation bundles were made for foehn-0.3.3.tar.gz:

Publisher: publish.yml on kayhendriksen/foehn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file foehn-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: foehn-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 60.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for foehn-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4057ace2c0f6ebc81a94bb5ca5d213742bf00d33ebfbed225c18b9cc21d40fbd
MD5 193a88e1d64c6125a428196b9c907499
BLAKE2b-256 1b7e05a4cfa1d2893d2eea91d15c666471eb4afc078de9f7c5d67b9b69182b19

See more details on using hashes here.

Provenance

The following attestation bundles were made for foehn-0.3.3-py3-none-any.whl:

Publisher: publish.yml on kayhendriksen/foehn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page