Client package for the DDC API.
Project description
DDC Utility
This is the Danube Data Cube Utility library, for interacting with the DDC API service.
Installation
pip install ddc-utility
Usage
Users must have a valid DDC registration.
Example #1 (using DdcClient with client ID and secret)
This example walks you through the process of creating and opening an AOI cube.
$ python
# Importing packages
>>> import os
>>> from ddc_utility.client import DdcClient
# Setting DDC credentials
>>> os.environ['DDC_CLIENT_ID'] = "<client id>"
>>> os.environ['DDC_CLIENT_SECRET'] = "<client secret>"
# Initialize DDC client
>>> client = DdcClient()
# List available data layers
>>> client.get_data_layers()
# List user's AOIs
>>> client.get_all_aoi()
# Create an AOI
>>> res = client.create_aoi(name="My AOI",
geometry="POLYGON ((19.021454 47.507925, 19.043941 47.489601, 19.047031 47.490181, 19.039478 47.506997, 19.021454 47.507925))",
time_range=("2023-06-01", "2023-07-01"),
layer_ids=[4, 8, 15, 48])
>>> id = res.iloc[0]['id']
# Check if AOI is 'ready'
>>> info = client.get_aoi_by_id(id)
>>> print(f"AOI status is: {info.iloc[0]['status']}")
# If status is 'ready', open cube
>>> ds = client.open_aoi_cube(aoi_id=id)
Example #2 (using IntegrationClient with bearer token)
This example shows how you can retrieve the dataset associated with a growing season if you have a valid OAuth2 bearer token.
$ python
# Importing packages
>>> from ddc_utility.client import IntegrationClient
# Initialize Integration client
>>> client = IntegrationClient(
bearer_token="...",
expires_in=86400,
)
# Retrieve xarray Dataset for the specified growing season
>>> ds = client.open_growing_season_cube(1234)
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 ddc_utility-1.8.0.tar.gz.
File metadata
- Download URL: ddc_utility-1.8.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e09820491de023af0dd43adfafe6f8bf1d530ca1abee906c79c0f1b6c500aa7
|
|
| MD5 |
daef226b8cb76ac186e0d4d0536394b8
|
|
| BLAKE2b-256 |
167aa923b7ebde2b49b711fa9474d6ac6f86d17924a235f45d035dcf7264954f
|
File details
Details for the file ddc_utility-1.8.0-py3-none-any.whl.
File metadata
- Download URL: ddc_utility-1.8.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e49961c044b4fde5c818f2652f02cc190e4b7a0f5a0f38a2581a2c7ae87beaa0
|
|
| MD5 |
8c5e5efd452dcd81739b39073f008f46
|
|
| BLAKE2b-256 |
cc0986a1c3040eeeeb32309cf195c7ce66b1fb45c72fd6697103b9c67aae45d5
|