A Python client for DAB Terms API and O&M API
Project description
om_api
Python client for the WHOS API.
Installation
pip install om_api
Usage
import om_api
client = om_api.WHOSClient(token="your-token")
# 00: Define the bounding box
constraints = om_api.Constraints(
bbox=(60.347, 22.438, 60.714, 23.012)
)
# 01: Get features as Python objects
features = client.get_features(constraints)
for f in features:
print(f.id, f.name, f.coordinates, f.contact_name)
# 02: Get observations as Python objects
feature_id = features[4].id
observations = client.get_observations(feature_id)
for obs in observations:
print(obs.id, obs.observed_property, obs.uom)
# 03: Plot first observation
obs_with_data = client.get_observation_with_data(observations[0].id,
begin="2025-01-01T00:00:00Z",
end="2025-02-01T00:00:00Z")
if obs_with_data is not None:
client.plot_observation(obs_with_data)
else:
print("No observation data available for the requested time range.")
# Optional: only if want to print in the table
from tabulate import tabulate
# Optional: get feature and observations as DataFrame and print nicely
features_df = client.get_features_df(constraints)
print(tabulate(features_df, headers='keys', tablefmt='psql'))
observations_df = client.get_observations_df(feature_id)
print(tabulate(observations_df, headers='keys', tablefmt='psql'))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dab_py-0.2.0.tar.gz
(17.7 kB
view details)
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
dab_py-0.2.0-py3-none-any.whl
(18.3 kB
view details)
File details
Details for the file dab_py-0.2.0.tar.gz.
File metadata
- Download URL: dab_py-0.2.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68ea4073f5c02732f23c81199751ba445bff9b5e72ea1acfc73298b48f4ebe0e
|
|
| MD5 |
798a47f48ff1df4a812ff466a1ed13f4
|
|
| BLAKE2b-256 |
685c297537254a3fbbfdbdf55f97cc3dc1f85b24322673e2e42a8c6858a76cdb
|
File details
Details for the file dab_py-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dab_py-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65a810dad0684447605eec6f95f09b74e2cdb32ebcfccaf6ef62e92f5ed1bb4a
|
|
| MD5 |
c2f5640cc78e015081d497889766e2ad
|
|
| BLAKE2b-256 |
eb27a3dd92183178708e846e552e023205e00ec718b5e104d543dbf3dbc9601d
|