Skip to content

MeteoSwiss/opendata-nwp-demos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OGD Model Data Access & Processing

Jupyter Notebook Examples Using MeteoSwiss NWP Data

MCH Logo              Open Data Logo

This repository provides Jupyter notebook examples for accessing and processing numerical weather prediction (NWP) model data from MeteoSwiss, released through Switzerland’s Open Government Data (OGD) initiative.


📓 Notebooks

  • 01_retrieve_process_precip.ipynb — Retrieve and load precipitation forecasts as an Xarray object, then process, analyze, and visualize the data using Python tools. Open In Colab
  • 02_download_soil_temp.ipynb — Download forecast files to disk for offline storage, external tools, or advanced manual processing. Open In Colab
  • 03_calculate_wind_speed.ipynb — Retrieve wind component forecasts as Xarray objects and derive the horizontal wind speed using the Python library meteodata-lab. Open In Colab
  • 04_calculate_rel_humidity.ipynb — Retrieve specific humidity, temperature and pressure as Xarray objects and compute relative humidity. Open In Colab
  • 05_interpolate_vertically.ipynb — Retrieve temperature forecasts as an Xarray object and perform two types of vertical interpolation: from model levels to pressure levels, and from model levels to a target altitude. Open In Colab
  • 06_calculate_global_rad_flux.ipynb — Retrieve direct and diffuse shortwave radiation fluxes from ICON-CH1-EPS forecasts and compute the Global Radiation Flux (GLOB) using meteodata-lab. Includes a de-aggregation step to convert cumulative flux values into hourly averages. Open In Colab

🚀 Getting Started

Option 1: Run in Google Colab

Open the notebook in Google Colab. The first code cell will install all dependencies automatically only in Colab.

Option 2: Run locally

Clone the repository and install all required packages. This project requires Python 3.11 and Poetry to manage dependencies and environments.

  1. Install Python dependencies using Poetry

    poetry install
  2. Install the Jupyter kernel

    Activate the Poetry environment and register it as a Jupyter kernel so it can be used within notebooks:

    poetry run python -m ipykernel install --user --name=notebooks-nwp-env --display-name "Python (notebooks-nwp-env)"

Open and Run Notebooks

You can run the notebooks using Visual Studio Code or JupyterLab — whichever you prefer.

Option A: Using Visual Studio Code

Make sure you have the following VS Code extensions installed:

  • Python (by Microsoft)
  • Jupyter (by Microsoft)

Once installed:

  1. Open the project folder in VS Code.
  2. Open a Jupyter notebook file, for example 01_retrieve_process_precip.ipynb.
  3. When prompted (or from the top-right kernel picker), select the kernel: Python (notebooks-nwp-env).

💡 If you don't see the environment, restart VS Code after running the kernel installation step.


Option B: Using JupyterLab

If you don't have VS Code or prefer using JupyterLab:

  1. Install JupyterLab using pipx:

    pipx install jupyterlab

    Don’t have pipx yet? Get it here: https://pipx.pypa.io/stable/installation/

  2. Launch JupyterLab:

    jupyter lab
  3. Open your notebook and select the kernel Python (notebooks-nwp-env) from the kernel menu.

📚 Related Documentation

For more context on the available numerical weather forecast data and how it’s structured, see:

🔗 MeteoSwiss Forecast Data Documentation

💬 Feedbacks

Feel free to open issues to suggest improvements or contribute new examples!