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

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

The existing ZamgData.get_forecast() API remains available unchanged while its NWP v2 compatibility behavior is finalized.

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.5.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.5.0
File Size Uploaded Provenance Actions
zamg-0.5.0.tar.gz 17.9 kB With provenance Details for zamg-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 33.9 kB

Release files / zamg-0.5.0.tar.gz

Download URL zamg-0.5.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
655a0ade8e4ca4ef6556c78ede4e5ea5211b346aad3f59c92e18c87d5f63d383
BLAKE2b-256 checksum
How to use checksums
7df02ae79d33e9b2b969db27aaab0c407142336e454e244adf7fb49e5cf25849
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 8, 2026.

Transparency log

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

Download URL zamg-0.5.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8824a117c3da475a328c7396b27933697e454698f531538ccbca56e58cea9e92
BLAKE2b-256 checksum
How to use checksums
dd54205775fd60eac70cdd99058688ff5d5f5c671e089df7ce257105d987bd62
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 8, 2026.

Transparency log

Security for zamg 0.5.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.5.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 8, 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