Read-only mirror of https://github.com/MeteoSwiss/opendata-localforecast-demos — MeteoSwiss. Issues & pull requests at the source.
  • Jupyter Notebook 98.2%
  • Python 1.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-26 08:04:31 +02:00
.github/workflows refactor: move check script to scripts/, fix metadata_monitor workflow 2026-06-30 18:49:29 +02:00
images docs: streamline Quick Start renku instructions 2026-07-28 16:58:13 +02:00
notebooks fix: select latest forecast run's asset instead of first match 2026-08-26 08:04:31 +02:00
scripts refactor: move check script to scripts/, fix metadata_monitor workflow 2026-06-30 18:49:29 +02:00
.gitignore chore: stop tracking notebook-generated PNGs 2026-07-06 12:06:58 +02:00
AUTHORS.txt Update AUTHORS.txt 2026-05-13 14:00:33 +02:00
LICENSE.txt Add licence file 2026-05-13 13:46:29 +02:00
poetry.lock feat: model SolarProduction with pvlib instead of a flat radiation ratio 2026-07-07 09:04:20 +02:00
pyproject.toml feat: model SolarProduction with pvlib instead of a flat radiation ratio 2026-07-07 09:04:20 +02:00
README.md docs: fix Jupyter documentation link 2026-07-28 17:11:41 +02:00

🌤️ MeteoSwiss Open Data: Local Forecast Demos

License: BSD-3-Clause

This repository provides Jupyter notebook examples for accessing and visualizing local weather forecasts from MeteoSwiss, released through Switzerland's Open Government Data (OGD) initiative.

Access high-resolution forecasts for ~5,600 points across Switzerland — including weather stations, towns, and postal code areas (PLZ).


🌤️ The Meteogram Notebook

notebooks/Meteogram.ipynb walks you through the full workflow of accessing MeteoSwiss OGD forecast data, from location discovery to visualization. It is structured as a story with one concept per section:

Section What you learn
1 · Choose your location How forecast data is organised by point of interest (POI)
2 · Explore parameters What MeteoSwiss publishes and how parameters are grouped
3 · Download the data How to query the STAC API and parse the CSV files
4 · Visualise How to render a 9-day meteogram
5 · Daily summary How pictogram codes map to weather descriptions

Key features:

  • Integrated POI search — find your location by name or ZIP code directly in the notebook
  • 9-day forecast horizon — hourly data combined with daily summaries
  • Metadata-driven — units, labels, and panel groupings resolved automatically from OGD metadata
  • Accurate day/night shading — sunrise and sunset computed per location using astronomical calculations

What the meteogram shows

The chart is divided into up to six panels, each covering a different aspect of the forecast:

Panel What is shown
Temperature Hourly median temperature at 2 m (°C) with a Q10Q90 uncertainty band; daily minimum and maximum markers; freezing-level altitude (m a.s.l.) on a secondary axis
Precipitation (hourly) Hourly precipitation amounts (mm) as bars with a Q10Q90 uncertainty band; precipitation probability (%) as a dashed line on a secondary axis
Precipitation (daily) Daily total precipitation (mm) as bars with Q10Q90 whiskers
Wind 10-minute mean wind speed and gusts (km/h) with Q10Q90 uncertainty bands; wind direction shown as arrows every 3 hours
Sunshine Hourly sunshine duration (min)
Radiation Global and diffuse solar radiation (W/m²)
Clouds Low, mid, and high cloud cover (%) as a stacked area chart

All hourly panels share the same time axis with day/night shading. You can display any subset of panels by setting PANELS = ["Temperature", "Wind"] in the configuration cell.

The plotting code lives in meteogram_plot.py, alongside the notebook. The notebook itself focuses on the data and the API; open the module only if you want to customise the chart.

MeteoSwiss Local Forecast Meteogram

Daily Weather Summary Table (example output):

Date Weather T min (°C) T max (°C) Precip. (mm)
Mon 19.05 partly sunny, thick passing clouds 12.3 22.1 02
Tue 20.05 very cloudy, light rain 10.8 19.5 315
Wed 21.05 high clouds 11.1 21.3 0
Thu 22.05 mostly sunny, some clouds 12.5 23.0 0
Fri 23.05 overcast, some rain showers 11.0 18.7 520
Sat 24.05 sunny 10.2 24.1 0
Sun 25.05 mostly sunny, some clouds 11.8 25.3 0
Mon 26.05 partly sunny, thick passing clouds 12.0 22.8 03
Tue 27.05 mostly sunny, some clouds 13.0 24.2 0

☀️ The Solar Production Notebook

notebooks/SolarProduction.ipynb shows a practical downstream use case for the same OGD data: estimating expected PV (solar panel) output from the 9-day radiation forecast. It reuses the fetch/parse pipeline from the Meteogram notebook, then feeds gre000h0 (global radiation), ods000h0 (diffuse radiation), and tre200h0 (2m temperature) into a pvlib-based model: solar position and panel tilt/azimuth determine plane-of-array irradiance, panel temperature derates the output, and pvlib.pvsystem.pvwatts_dc() converts that into DC power for an illustrative rooftop system.

Note: the system itself is illustrative (a generic capacity/tilt/azimuth, not a real module datasheet), but the underlying physics — solar position, irradiance transposition onto the panel plane, and temperature-dependent PVWatts output — is handled by pvlib rather than a flat radiation-ratio approximation.

The plotting code lives in notebooks/solar_plot.py, following the same notebook/plotting-module split as the Meteogram demo.

MeteoSwiss Solar Production Estimate


🚀 Quick Start

Try it instantly — no installation needed

  1. Click the badge launch - renku (ctrl/cmd-click to open it in a new tab) to open the notebook in a ready-to-use cloud environment. Wait for the session to start (15 minutes).

  2. In the file browser on the left, navigate to opendata-local-weatherforecast-demos/notebooks/

    Navigate to the project folder Navigate to the notebooks folder

  3. Open Meteogram.ipynb (or SolarProduction.ipynb for the PV output demo)

    Open a notebook

  4. Follow the steps in the notebook you chose.

New to Jupyter notebooks? See the Jupyter documentation for an introduction.


🛠️ Technical Details

Data source

Forecast data is fetched directly from the Federal Geodata Infrastructure STAC API.

  • Collection: ch.meteoschweiz.ogd-local-forecasting
  • Update cycle: Updated hourly
  • Horizon: 9 days (D+0 to D+8)

Repository structure

notebooks/
  Meteogram.ipynb       # Main notebook — data access and API walkthrough
  meteogram_plot.py     # Plotting module — all matplotlib code lives here
  SolarProduction.ipynb # Downstream demo — PV output estimate from the radiation forecast
  solar_plot.py         # Plotting module for the Solar Production notebook

Architecture

The notebook is metadata-driven: it reads the OGD parameter CSV at runtime to resolve parameter units, panel groupings, and hourly vs. daily granularity — no hardcoded labels.

The plotting module (meteogram_plot.py) is intentionally separate so the notebook stays focused on explaining the data. It exposes a single entry point:

from meteogram_plot import plot_meteogram
plot_meteogram(df_hourly, df_daily, ...)

💻 Local Installation

git clone https://github.com/MeteoSwiss/opendata-localforecast-demos.git
cd opendata-localforecast-demos
python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install poetry
poetry install
poetry run jupyter lab