Skip to main content

An API to easily download open access weather recordings from MeteoSwiss

Project description

Overview

This package provides a set of convenience tools to seamlessly download meteorological data collected and made available to the public as Open Government Data (OGD) by the Federal Office for Meteorology and Climatology MeteoSwiss. More information about the Open Data from MeteoSwiss is available here.

Currently, the data available through this interface concerns ground-base measurements (gbm) coming from

  1. the automatic weather stations network SwissMetNet (SMN)

  2. the swiss national basic climatological network (NBCN).

Important notice:

This package was not developed and is not suppported by MeteoSwiss. It however relies on the MeteoSwiss Open Data API which allows public access to meteorological data provided by the Federal Office for Meteorology and Climatology, and which can be used independently of this package.

Installation

pip install swiss-weatherdata

Usage

Import all functions at once:

import swiss_weatherdata.gbm as gbm

Information about weather stations and meteorological parameters

Get information about all SwissMetNet (SMN) weather stations in a pd.DataFrame:

gbm.get_stations_info(network='smn')

Look for a meteorological parameter:

gbm.get_meteo_parameters_info(network='smn')

The lookup argument allows to filter meteorological parameters by category, e.g., the following lists all parameters related to Wind:

gbm.get_meteo_parameters_info(lookup='wind', language='en', network='smn')

Same output but in french:

gbm.get_meteo_parameters_info(lookup='vent', language='fr', network='smn')

Currently, meteorological parameters are grouped into the following categories:

language='en' language='fr'
Wind Vent
Evaporation évaporation
Radiation Rayonnement
Snow neige
Pressure Pression
Humidity Humidité
Precipitation Précipitations
Sunshine Ensoleillement
Temperature Température

Get the parameter description from its shortname:

gbm.get_param_description(shortname='rre150d0', language='fr', network='smn')

Get the list of available parameters for a given weather station. For example, at Genève-Cointrin (GVE):

gbm.get_parameters_by_station('GVE', network='smn')

N.B. To get information about stations/parameters belonging to the Swiss National Basic Climatological Network, change the network to 'nbcn'.

Time-granularity of recordings

Recordings are generally available at different time granularities: 10 minutes, hourly, daily, monthly or yearly.

Each parameter has its own granularity, as specified in the output of get_meteo_parameters_info(), for instance:

parameter_shortname parameter_description_en
tre200s0 'Air temperature 2 m above ground; current value'
tre200h0 'Air temperature 2 m above ground; hourly mean'
tre200d0 'Air temperature 2 m above ground; daily mean'
tre200m0 'Air temperature 2 m above ground; monthly mean'
tre200y0 'Air temperature 2 m above ground; annual mean'

Download recordings from a given weather station:

The function get_smn_measures() downloads data recorded at a given weather station for several meteorological parameters and for a specified period. It returns data organized in a Pandas pd.DataFrame.

Example 1: get daily maximum temperature and daily sum of precipitation recorded at Genève-Cointrin from May 15. 2025 and to the latest available record:

df = gbm.get_smn_measures(
    sta='GVE',
    parameters=['tre200dx', 'rka150d0'],
    beg='202405150000'
)

Example 2: get hourly mean temperature and hourly sum of precipitation recorded at Payerne from January 15. 2010 at 06:00 UTC to March 1. 2010 at 18:00 UTC:

df = gbm.get_smn_measures(
    sta='PAY',
    parameters=['tre200h0', 'rre150h0'],
    beg='201001150600',
    end='201003011800'
)

Example 3: get monthly temperature deviation from the climatological mean (1991-2020) at Genève-Cointrin from January 1983 to December 2025:

df = gbm.get_nbcn_measures(
    sta='GVE',
    parameters=['th9120mv'],
    beg='198301010000',
    end='202512310000'
)

Examples

All previous examples are available in a Jupyter Notebook on GitHub.

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

swiss_weatherdata-0.0.5.tar.gz (3.5 MB view details)

Uploaded Source

Built Distribution

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

swiss_weatherdata-0.0.5-py3-none-any.whl (3.4 MB view details)

Uploaded Python 3

File details

Details for the file swiss_weatherdata-0.0.5.tar.gz.

File metadata

  • Download URL: swiss_weatherdata-0.0.5.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for swiss_weatherdata-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9b183a44c9cab1c2fe710aabca7a3013adb098ad03b6caad159f8221b58ba327
MD5 2c0f8c2ab2742f1f5a95a9f560bab84f
BLAKE2b-256 c583d8755eaa1077ffa5a93b848b96743e2376f84a1ed3aade91a4f9a8a18b02

See more details on using hashes here.

File details

Details for the file swiss_weatherdata-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for swiss_weatherdata-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eb817e008e325ca935cf0145d3f61a695a684551b530227039321a3c3b7feebc
MD5 d4690a8c879486c680488c80c3b86121
BLAKE2b-256 74affb7073218b0ca9e80d5e0888af4a0cf9278683566f2316908520ada96ab8

See more details on using hashes here.

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