Skip to main content

Asynchronous Python client for ZAMG weather data.

Project description

python-zamg

GitHub Release GitHub Activity License

pre-commit Black

Project Maintenance

Python library to read 10 min weather data from ZAMG

About

This package allows you to read the weather data from weather stations of ZAMG weather service. ZAMG is the Zentralanstalt für Meteorologie und Geodynamik in Austria.

Installation

pip install zamg

Usage

import asyncio

import src.zamg.zamg

async def main():
    """Sample of getting data for the closest station to the given coordinates"""
    async with src.zamg.zamg.ZamgData() as zamg:
        data = await zamg.closest_station(46.99, 15.499)
        zamg.set_default_station(data)
        print("closest_station = " + str(zamg.get_station_name) + " / " + str(data))
        await zamg.update()
        print(
            "---------- Weather for station %s (%s)",
            str(zamg.get_data("name", data)),
            str(data),
        )
        for param in zamg.get_all_parameters():
            print(
                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)

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


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.1.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

zamg-0.1.0-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

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