python-zamg
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 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())
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())
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zamg-0.4.1.tar.gz.
File metadata
- Download URL: zamg-0.4.1.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4153e77929de05c01f42a160d81408fb327ef22ab1aa5fb02ed4bf97901d8ecc
|
|
| MD5 |
774ebd4058c837a051c99e7e8c69d952
|
|
| BLAKE2b-256 |
634f19d791a4bcf4f06424904a67bbc0e19d89d2a93d7fef167e4ea7df178c50
|
Provenance
The following attestation bundles were made for zamg-0.4.1.tar.gz:
Publisher:
python-publish.yml on killer0071234/python-zamg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zamg-0.4.1.tar.gz -
Subject digest:
4153e77929de05c01f42a160d81408fb327ef22ab1aa5fb02ed4bf97901d8ecc - Sigstore transparency entry: 2206547545
- Sigstore integration time:
-
Permalink:
killer0071234/python-zamg@759a5beb8b236eaddf595bdc25e329a10dd735f8 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/killer0071234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@759a5beb8b236eaddf595bdc25e329a10dd735f8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zamg-0.4.1-py3-none-any.whl.
File metadata
- Download URL: zamg-0.4.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa2fef296b801962e4aac808f8d7a67e195805b485049cd67706ab14d409e9e7
|
|
| MD5 |
0851ad86eacba2b63b0696506c5f71ef
|
|
| BLAKE2b-256 |
669033130e0dfc345228202213096d06f75d8457aa5d3d4b0d2888ef8be95f42
|
Provenance
The following attestation bundles were made for zamg-0.4.1-py3-none-any.whl:
Publisher:
python-publish.yml on killer0071234/python-zamg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zamg-0.4.1-py3-none-any.whl -
Subject digest:
fa2fef296b801962e4aac808f8d7a67e195805b485049cd67706ab14d409e9e7 - Sigstore transparency entry: 2206547557
- Sigstore integration time:
-
Permalink:
killer0071234/python-zamg@759a5beb8b236eaddf595bdc25e329a10dd735f8 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/killer0071234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@759a5beb8b236eaddf595bdc25e329a10dd735f8 -
Trigger Event:
release
-
Statement type: