A Python client for DAB Terms API and O&M API
Project description
DAB Pythonic Client (dab-py)
A Python client for DAB functionalities, including DAB Terms API and WHOS API.
Installation (0.3.0)
Install the core package (lightweight, it includes Pandas):
pip install dab-py
DAB Terms API
This repository contains a minimal client for retrieving controlled vocabulary terms (e.g., instruments) from the Blue-Cloud/GeoDAB service using a token and view.
Features
- Retrieve terms from the DAB Terms API with a single call.
- Simple object model: Term and Terms containers.
- Small dependency footprint (requests).
Usage
from dabpy import TermsAPI
def main():
# Blue-Cloud/GeoDAB provided credentials for the public terms view
token = "my-token"
view = "blue-cloud-terms"
# Desired parameters
term_type = "instrument"
max_terms = 10
# Call the API. The implementation prints:
# - Number of terms received from API: <n>
# - A header line and up to `max_terms` items
api = TermsAPI(token=token, view=view)
api.get_terms(type=term_type, max=max_terms)
if __name__ == "__main__":
main()
WHOS API om_api
This notebook and module are used to programmatically access WHOS DAB functionalities through the OGC OM-JSON based API, which is documented and available for testing here: https://whos.geodab.eu/gs-service/om-api.
Features
- Pythonic, object-oriented access via
FeatureandObservationclasses. - Retrieve features and observations as Python objects.
- Convert API responses to Pandas DataFrames for analysis.
- Support for bounding box constraints.
Usage
from dabpy import *
# Replace with your WHOS API token and optional view
token = "my-token"
view = "whos"
client = WHOSClient(token=token, view=view)
# 00: Define the bounding box (Finland Example Area)
south, west, north, east = 60.347, 22.438, 60.714, 23.012
constraints = Constraints(bbox=(south, west, north, east))
# 01: Get Features as Python objects
features = client.get_features(constraints)
# 01b: (optinal: Convert Features to DataFrame if needed)
features_df = client.features_to_df(features)
print("\n=== Features Table ===")
print(features_df)
# 02: Get Observations as Python objects
feature_id = features[4].id
observations = client.get_observations(feature_id)
# 02b: (optinal: Convert Observations to DataFrame if needed)
observations_df = client.observations_to_df(observations)
print("\n=== Observations Table ===")
print(observations_df)
# 03: Get first observation with data points
obs_with_data = client.get_observation_with_data(observations[0].id, begin="2025-01-01T00:00:00Z", end="2025-02-01T00:00:00Z")
# 03b: (optinal: Convert Observation Points to DataFrame if needed)
if obs_with_data:
obs_points_df = client.points_to_df(obs_with_data)
print("\n=== Observation Points Table ===")
print(obs_points_df)
else:
print("No observation data available for the requested time range.")
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
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 dab_py-0.3.0.tar.gz.
File metadata
- Download URL: dab_py-0.3.0.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd277232540fd6a44f63cf649d06e8a233806aa198e997b7f8fea1d5c9405d23
|
|
| MD5 |
d69715c1f25c537109b4643b36a51a21
|
|
| BLAKE2b-256 |
b18eafd133ac2942021f9ce816667b0295af0c619d0d1a217722bd415fedd531
|
File details
Details for the file dab_py-0.3.0-py3-none-any.whl.
File metadata
- Download URL: dab_py-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.7 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 |
7530a5734c83d6de51d4b71279d2cfb6ca09ca478d9fc73ee41e351d405b5938
|
|
| MD5 |
6e682e9bd1447ca98e624b4d01a9cea6
|
|
| BLAKE2b-256 |
cb1f6a237e15a0c48c972562d2abe3fdad9d80510d985358f9a6d1c4ff6a1a40
|