DTC Query API
Project description
DTC-IS Query Client
This package provides a Python client for the DTC Ice Sheets Query API.
DTC Ice Sheets is a Digital Twin Component designed to provide an integrated, interactive, and holistic representation of the Greenland and Antarctic ice sheet systems and their two-way interaction with the Earth system: ocean, atmosphere and solid Earth. By combining Earth Observation data, numerical models, and data science and machine learning methods into a modular, executable framework, it enables users to analyse past and present conditions, simulate future scenarios, and explore the sensitivity, response, and impact of ice-sheets under different conditions. Developed under ESA's Digital Twin Earth programme, the platform delivers these capabilities as trusted, API-first services.
Queries require authentication via an API token, which can be obtained at https://query.dtc-ice-sheets.org/auth/get-token
Refer to the API documentation for a complete list of available endpoints and their parameters.
For more information about the project, please visit https://dtc-ice-sheets.org/.
Installation
Install this package from PyPI:
pip install dtc-query-client
Getting Started
Start by importing the dtc_query_client and creating a Configuration object, passing in your authentication token:
import dtc_query_client
configuration = dtc_query_client.Configuration(
host="https://query.dtc-ice-sheets.org",
access_token="[your private token here]"
)
API requests are made inside an async with block. For example, this snippet retrieves a list of available datasets:
async with dtc_query_client.ApiClient(configuration) as client:
datasets = await dtc_query_client.GenericApi(client).dataset_overviews()
print(datasets)
Some endpoints start a long-running job and return a job ID. This job ID can be used to track how the job is progressing, and to obtain results once the job completes. It is recommended to use the wait_for_job() or iterate_job() helper functions to handle these endpoints gracefully.
The example snippet below uses the simpler wait_for_job(), which waits for the job to complete and returns the completed job state:
async with dtc_query_client.ApiClient(configuration) as client:
# Start a job and get the job ID
response = await dtc_query_client.StateAndFateApi(client).run_summary_zarr_to_json(
ice_shelf_id="thwaites",
)
job_id = response.job_id
print(f"Started job with ID {job_id}")
# Wait for job to complete
try:
job_state = await dtc_query_client.wait_for_job(client, job_id)
except RuntimeError as e:
# Failed jobs will raise a RuntimeError
print("Job has failed!")
raise e
# Job has completed! Print results
print(f"Job completed successfully with status {job_state.status}.")
output_url = job_state.outputs["timeseries-zarr-to-json-module"]["output_json"]
print(f"Results URL: {output_url}")
Alternatively, the example snippet below uses the more advanced iterate_job(), which does the same thing but additionally provides live updates on job progress while it is running:
async with dtc_query_client.ApiClient(configuration) as client:
# Start a job and get the job ID
response = await dtc_query_client.StateAndFateApi(client).run_summary_zarr_to_json(
ice_shelf_id="thwaites",
)
job_id = response.job_id
print(f"Started job with ID {job_id}")
# Wait for job to complete, printing information on the job state as it progresses
try:
async for job_state in dtc_query_client.iterate_job(client, job_id):
print(
f"Job has status {job_state.status}.\n"
f"It has completed {job_state.progress_done} steps out of {job_state.progress_total}."
)
except RuntimeError as e:
# Failed jobs will raise a RuntimeError
print("Job has failed!")
raise e
# Job has completed! Print results
print(f"Job completed successfully with status {job_state.status}.")
output_url = job_state.outputs["timeseries-zarr-to-json-module"]["output_json"]
print(f"Results URL: {output_url}")
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 dtc_query_client-1.0.4.tar.gz.
File metadata
- Download URL: dtc_query_client-1.0.4.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c3bc5e0e15633fa97b4480cca984aa8214f123ccbb6dbc9c3ccc3bf081ce85b
|
|
| MD5 |
60a1914437a2a52b6dbe5edcd165ff4b
|
|
| BLAKE2b-256 |
2a9e9b68b86b6d331d72c7286df3fb90b7bdd95422ab6dad892d35a7cfd8f8f2
|
Provenance
The following attestation bundles were made for dtc_query_client-1.0.4.tar.gz:
Publisher:
dtc_query_api_deploy.yml on DTC-Ice-Sheets/dtc_query_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtc_query_client-1.0.4.tar.gz -
Subject digest:
4c3bc5e0e15633fa97b4480cca984aa8214f123ccbb6dbc9c3ccc3bf081ce85b - Sigstore transparency entry: 1852369203
- Sigstore integration time:
-
Permalink:
DTC-Ice-Sheets/dtc_query_api@06ca0971589dfeccf848297b32b57e05cc638d04 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DTC-Ice-Sheets
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
dtc_query_api_deploy.yml@06ca0971589dfeccf848297b32b57e05cc638d04 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dtc_query_client-1.0.4-py3-none-any.whl.
File metadata
- Download URL: dtc_query_client-1.0.4-py3-none-any.whl
- Upload date:
- Size: 86.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a40f2654513adfff1d11f861f458a6f1bd123d38a8341d1bbf80a7e63fcd75e3
|
|
| MD5 |
3176d18b1f19ccfd181f55c45e0df9b5
|
|
| BLAKE2b-256 |
9bf817f33412c2456ce90f0828fa2810d8219a82f7ed52af0254a67b44e35e70
|
Provenance
The following attestation bundles were made for dtc_query_client-1.0.4-py3-none-any.whl:
Publisher:
dtc_query_api_deploy.yml on DTC-Ice-Sheets/dtc_query_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtc_query_client-1.0.4-py3-none-any.whl -
Subject digest:
a40f2654513adfff1d11f861f458a6f1bd123d38a8341d1bbf80a7e63fcd75e3 - Sigstore transparency entry: 1852369281
- Sigstore integration time:
-
Permalink:
DTC-Ice-Sheets/dtc_query_api@06ca0971589dfeccf848297b32b57e05cc638d04 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DTC-Ice-Sheets
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
dtc_query_api_deploy.yml@06ca0971589dfeccf848297b32b57e05cc638d04 -
Trigger Event:
push
-
Statement type: