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.
- 01_retrieve_process_precip.ipynb — Retrieve and load precipitation forecasts as an Xarray object, then process, analyze, and visualize the data using Python tools.
- 02_download_soil_temp.ipynb — Download forecast files to disk for offline storage, external tools, or advanced manual processing.
- 03_calculate_wind_speed.ipynb — Retrieve wind component forecasts as Xarray objects and derive the horizontal wind speed using the Python library meteodata-lab.
- 04_calculate_rel_humidity.ipynb — Retrieve specific humidity, temperature and pressure as Xarray objects and compute relative humidity.
- 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.
- 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 the notebook in Google Colab. The first code cell will install all dependencies automatically only in Colab.
Clone the repository and install all required packages. This project requires Python 3.11 and Poetry to manage dependencies and environments.
-
poetry install
-
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)"
You can run the notebooks using Visual Studio Code or JupyterLab — whichever you prefer.
Make sure you have the following VS Code extensions installed:
- Python (by Microsoft)
- Jupyter (by Microsoft)
Once installed:
- Open the project folder in VS Code.
- Open a Jupyter notebook file, for example
01_retrieve_process_precip.ipynb
. - 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.
If you don't have VS Code or prefer using JupyterLab:
-
Install JupyterLab using
pipx
:pipx install jupyterlab
Don’t have
pipx
yet? Get it here: https://pipx.pypa.io/stable/installation/ -
Launch JupyterLab:
jupyter lab
-
Open your notebook and select the kernel Python (notebooks-nwp-env) from the kernel menu.
For more context on the available numerical weather forecast data and how it’s structured, see:
🔗 MeteoSwiss Forecast Data Documentation
Feel free to open issues to suggest improvements or contribute new examples!