Skip to main content

Asynchronous Python client for GeoSphere Austria (ZAMG) weather data.

Project description

python-zamg

GitHub Release GitHub Activity License

pre-commit Black Code Coverage

Project Maintenance

Python library to read 10 min weather data from GeoSphere Austria former ZAMG

About

This package allows you to read the weather data from weather stations of 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

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

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

import src.zamg.zamg
from src.zamg.exceptions import ZamgError


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

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


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

Contributions are welcome!

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

Credits

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

Dataset API Dokumentation


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

zamg-0.3.6.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

zamg-0.3.6-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file zamg-0.3.6.tar.gz.

File metadata

  • Download URL: zamg-0.3.6.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for zamg-0.3.6.tar.gz
Algorithm Hash digest
SHA256 6715066e8806860ae1bcacf47f79289ec438eba5cd774fb5e20ce4b9e2cfd996
MD5 284acaa8b89dfcbdf0d244310f15340a
BLAKE2b-256 6b4572488830d7bcbb4290666f3300bd2a2e87ea54abba6b6d698a17a6d9a87a

See more details on using hashes here.

File details

Details for the file zamg-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: zamg-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for zamg-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9b102bb05aa48a6ee4ab5f717319d0b8692476ab20ec3d7ee674e942e7fe1869
MD5 e5b88580de37a7a38b97caa08ea02780
BLAKE2b-256 7510e9574a670ce8a3a3e31b43d708c7178afb63469617e893e927628fe9334c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page