Skip to main content

python-zamg

GitHub Release GitHub Activity License

pre-commit Black Code Coverage

Project Maintenance

Python library for GeoSphere Austria station observations and coordinate-based numerical weather prediction forecasts.

About

This package reads weather-station observations and independent NWP forecasts from the GeoSphere Austria weather service. GeoSphere Austria joins Zentralanstalt für Meteorologie und Geodynamik (ZAMG) and the Geologische Bundesanstalt (GBA) since 1st January 2023.

Installation

pip install zamg

Python 3.10–3.15 is supported (Python 3.9 support was dropped in 0.6.0; use zamg<0.6 if you are still on 3.9). Request timeouts use asyncio.timeout on Python 3.11 and newer; async-timeout is only required on Python 3.10.

Usage

NWP v2 forecast

Use NwpClient for an independent coordinate-based hourly forecast. It uses GeoSphere Austria's nwp-v2-1h-1km model and does not select or request a weather station.

import asyncio

from zamg import NwpClient


async def main():
    async with NwpClient() as client:
        forecast = await client.get_forecast(
            latitude=48.2082,
            longitude=16.3738,
        )

    print(forecast.reference_time)
    print(forecast.resolved_latitude, forecast.resolved_longitude)
    for record in forecast.records:
        print(record.valid_time, record.temperature, record.symbol)


if __name__ == "__main__":
    asyncio.run(main())

Every request includes all 16 parameters currently exposed by the dataset. Typed records preserve each raw value independently in GeoSphere API native units:

API parameter Record field Native unit/meaning
10fg wind_gust m/s, maximum in the forecast interval
10u wind_u m/s, eastward component
10v wind_v m/s, northward component
2r relative_humidity percent
2t temperature degrees Celsius
cape convective_available_potential_energy m²/s²
msl mean_sea_level_pressure Pa
pt severe_precipitation_type raw dimensionless provider code
rain rainfall kg/m² in the forecast interval
sf snowfall kg/m² in the forecast interval
snowlmt snow_limit m above ground
ssrd surface_global_radiation W/m²
sund sunshine_duration seconds in the forecast interval
sy symbol raw dimensionless GeoSphere weather-symbol code
tcc cloud_cover percent
tp precipitation kg/m², total liquid and solid precipitation per interval

The client does not combine precipitation values, calculate wind speed or bearing, or interpret provider codes. Consumers can choose which raw fields to use.

Meteorological values may be None when the API reports missing data. Both the requested coordinates and the resolved model-grid coordinates are available on NwpForecast. Forecast timestamps and the model reference time are timezone-aware.

NwpClient performs no polling, retries, or caching. Applications should set their own update policy and should respect GeoSphere Austria's published rate limits. A rate-limit response is raised as ZamgApiError and includes the reset duration when supplied by the API. HTTP failures expose their integer status as ZamgApiError.status_code. For a 429 response with a valid non-negative integer ratelimit-reset header, ZamgApiError.rate_limit_reset contains that delay in seconds; otherwise it is None. Both attributes are None for transport and timeout failures.

Station observations

Simple usage example to fetch specific data from the closest station.

"""Asynchronous Python client for GeoSphere Austria weather data."""

import asyncio

import zamg.zamg
from zamg.exceptions import ZamgError


async def main():
    """Sample of getting data"""
    try:
        async with zamg.ZamgData() as zamg_instance:
            # option to disable verify of ssl check
            zamg_instance.verify_ssl = False
            # trying to read GeoSphere Austria station id of the closest station
            data = await zamg_instance.closest_station(46.99, 15.499)
            # set closest station as default one to read
            zamg_instance.set_default_station(data)
            # print station location of the closest station
            print("get_station_location = " + str(zamg_instance.get_station_location))
            print("closest_station = " + str(zamg_instance.get_station_name) + " / " + str(data))
            # print list with all possible parameters
            print(f"Possible station parameters: {zamg_instance.get_all_parameters()}")
            # set parameters directly
            zamg_instance.station_parameters = "TL,SO"
            # or set parameters as list
            zamg_instance.set_parameters(("TL", "SO"))
            # if none of the above parameters are set, all possible parameters are read
            # do an update
            await zamg_instance.update()

            print(f"---------- Weather for station {zamg_instance.get_station_name} ({data})")
            for param in zamg_instance.get_parameters():
                print(
                    str(param)
                    + " -> "
                    + str(zamg_instance.get_data(parameter=param, data_type="name"))
                    + " -> "
                    + str(zamg_instance.get_data(parameter=param))
                    + " "
                    + str(zamg_instance.get_data(parameter=param, data_type="unit"))
                )
            print(f"last update: {zamg_instance.last_update}")
    except ZamgError as exc:
        print(exc)


if __name__ == "__main__":
    asyncio.run(main())

Legacy forecast API

GeoSphere Austria discontinued the NWP v1 dataset on 2026-11-04. ZamgData.get_forecast() keeps its signature and NWP v1 response shape, but reads the data from NWP v2 (nwp-v2-1h-1km) with NwpClient. New code should use NwpClient directly.

NWP v1 parameter NWP v2 source Conversion
t2m, rh2m, u10m, v10m, sy, cape, snowlmt 2t, 2r, 10u, 10v, sy, cape, snowlmt none
tcc tcc percent to fraction
rr_acc, rain_acc, snow_acc, sundur_acc tp, rain, sf, sund summed up from the first returned step

The NWP v1 parameters cin, grad, mnt2m, mxt2m, sp, ugust, and vgust have no NWP v2 equivalent and are left out. The values come from a different model grid (1 km), so they differ from the former NWP v1 values.

Simple usage example to fetch weather forecast for a specific location.

"""Asynchronous Python client for GeoSphere Austria forecast weather data."""

import asyncio

import zamg.zamg
from zamg.exceptions import ZamgError


async def main():
    """Sample of getting data"""
    try:
        async with zamg.zamg.ZamgData() as zamg_instance:
            # option to disable verify of ssl check
            zamg_instance.verify_ssl = False
            # trying to read GeoSphere Austria station id of the closest station
            data = await zamg_instance.closest_station(46.99, 15.499)
            # set closest station as default one to read
            zamg_instance.set_default_station(data)
            # print(f"forecast_metadata: {zamg_instance.forecast_metadata}")
            # print(f"get_forecast_all_parameters: {zamg_instance.get_forecast_all_parameters()}")

            data = await zamg_instance.get_forecast("46.99,15.499", current_only=True)
            print(f"get_forecast(current_only=True): {data}")
            # get forecast for the default station (closest station) with all parameters
            data = await zamg_instance.get_forecast(current_only=False)
            print(f"get_forecast(current_only=False): {data}")

    except ZamgError as exc:
        print(exc)


if __name__ == "__main__":
    asyncio.run(main())

The forecast contains the GeoSphere Austria weather symbol (sy parameter) as a numeric code. It is automatically translated into a textual description (sy_text) and a Home Assistant weather condition (condition). The translation helpers can also be used directly:

from zamg import symbol_to_condition, symbol_to_text

print(symbol_to_text(3))  # "Partly cloudy"
print(symbol_to_text(3, lang="de"))  # "Wolkig"
print(symbol_to_condition(3))  # "partlycloudy"

The official (German) symbol code list is documented in Geosphere-Austria/dataset-api-docs#30.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Contributors

Thanks to everyone who has contributed to this project:

See the full list on the contributors page.

Credits

Code template to read dataset API was mainly taken from @LuisTheOne's zamg-api-cli-client

Dataset API Dokumentation


Metadata

Release files for zamg 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zamg 0.6.0
File Size Uploaded Provenance Actions
zamg-0.6.0.tar.gz 19.8 kB With provenance Details for zamg-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zamg 0.6.0
File Interpreter ABI Platform Actions
zamg-0.6.0-py3-none-any.whl Python 3 none any Details for zamg-0.6.0-py3-none-any.whl

Total release size: 37.5 kB

Release files / zamg-0.6.0.tar.gz

Download URL zamg-0.6.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
27929a3df586317ca97331e7082913dcc77af766965b7bd384e53a82747377bb
BLAKE2b-256 checksum
How to use checksums
e3ecafbdf053c694d0405ccdbee7e6dd66eea3e4516dbb1873415c651f45828f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / zamg-0.6.0-py3-none-any.whl

Download URL zamg-0.6.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7666147a221559b728b7aa8484a88e7b2d763d46dbc0207789af2d638a51018a
BLAKE2b-256 checksum
How to use checksums
4674715c414d2d998877ea0a82a7eb3a915b1509e96d8b764907aa58419c1934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for zamg 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zamg-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page