This package is meant to facilitate the download of meteorological data from the Geosphere (formerly ZAMG) Austria data hub. The data is made freely available under the CC BY 4.0 license.
Note
The package relies on asyncio and aiohttp for querying the data and currently can only run successfully in regular python scripts, i.e., it does unfortunately not work when used in jupyter notebooks.
Downloading data
Here is an example on how to download data for the station in Obergurgl. Batch download funtionality is described here):
from datetime import datetimefrom loguru import loggerfrom geospheredl import GeosphereClientgclient = GeosphereClient()# pick a datasetds ="/station/historical/klima-v2-1h"# set a datasetgclient.set_dataset(ds)variables = ["tl", "cglo", "ff", "rr", "rf", "sh"]params = {"parameters": variables,"start_date": datetime(1995, 1, 1),"end_date": datetime(2025, 1, 1),"station_id": 66,}df = gclient.download_station(**params)df.to_csv("obergurgl.csv")
Visualization
Here is a visualization of the annual temperature distribution based on the downloaded data. The visualization is a slightly adapted version of the seaborn ridgeplot example.
Annual air temperature distribution in Obergurgl (Austria) based on 1-hourly measurements
Caveats for downloading a lot of data
The geosphere data hub has a limit for the size (i.e., data points) of individual requests and a rate limit for the number of requests. This means it is impossible to download long time series for many different variables in a single request if it exceeds the size limit. Therefore geospheredl tries to detect such cases and splits them temporally in a way such that individual requests do not exceed the size limit. Afterwards, the individual pieces of a timeseries are merged again. If geospheredl hits the rate limit for requests, it sleeps for the time until the rate limit is reset, which is indicated in the response from the data hub. Generally speaking, this means that downloading a lot of data via geospheredl can potentially take a lot of time.