GUI usage¶
The GUI client extends the Python API client by adding dedicated GUI-widgets for specific features:
client.show(): execute a given process execution request,client.show_jobs(): show all jobs resulting from process execution,client.show_job(): show the details of a specific job.
Apart from that, they share the same interface. In the following, we visit all the features by example.
The client expects a running server that conforms to the OGC API - Process: Part 1, Version 1.0. If you don't have one available, you can also run the project's server with a test configuration:
wraptile run -- wraptile.services.local.testing:service
In [1]:
Copied!
from cuiman.gui import Client
from cuiman.gui import Client
In [2]:
Copied!
client = Client()
client
client = Client()
client
Out[2]:
{
"access_token": "1234",
"server_url": "http://127.0.0.1:8008",
"user_name": "bibo"
}
In [3]:
Copied!
client.get_processes()
client.get_processes()
Out[3]:
{
"links": [
{
"href": "http://127.0.0.1:8008/processes",
"hreflang": "en",
"rel": "self",
"title": "get_processes",
"type": "application/json"
}
],
"processes": [
{
"description": "Sleeps for `duration` seconds. Fails on purpose if `fail` is `True`. Returns the effective amount of sleep in seconds.",
"id": "sleep_a_while",
"title": "Sleep Processor",
"version": "0.0.0"
},
{
"description": "Returns the list of prime numbers between a `min_val` and `max_val`.",
"id": "primes_between",
"title": "Prime Processor",
"version": "0.0.0"
},
{
"description": "Simulate a set scene images slices for testing. Creates an xarray dataset with `periodicity` time slices and writes it as Zarr into a temporary location. Requires installed `dask`, `xarray`, and `zarr` packages.",
"id": "simulate_scene",
"title": "Generate scene for testing",
"version": "0.0.0"
},
{
"id": "return_base_model",
"title": "BaseModel Test",
"version": "0.0.0"
}
]
}
In [4]:
Copied!
client.get_process("sleep_a_while")
client.get_process("sleep_a_while")
Out[4]:
{
"description": "Sleeps for `duration` seconds. Fails on purpose if `fail` is `True`. Returns the effective amount of sleep in seconds.",
"id": "sleep_a_while",
"inputs": {
"duration": {
"minOccurs": 0,
"schema": {
"default": 10,
"type": "number"
},
"title": "Duration"
},
"fail": {
"minOccurs": 0,
"schema": {
"default": false,
"type": "boolean"
},
"title": "Fail"
}
},
"outputs": {
"return_value": {
"schema": {
"type": "number"
},
"title": "Return Value"
}
},
"title": "Sleep Processor",
"version": "0.0.0"
}
In [5]:
Copied!
client.show()
client.show()
Out[5]:
In [10]:
Copied!
_request
_request
Out[10]:
{
"dotpath": true,
"inputs": {
"bbox": [
4.923339,
50.584166,
8.834472,
52.923034
],
"end_date": "2025-02-01",
"output_path": "test.zarr",
"periodicity": 4,
"resolution": 0.5,
"start_date": "2025-01-01",
"var_names": "a, b, c"
},
"process_id": "simulate_scene"
}
In [ ]:
Copied!
# client.stop_updating()
# client.stop_updating()
In [11]:
Copied!
client.show_jobs()
client.show_jobs()
Out[11]:
In [13]:
Copied!
client.show_job("job_2")
client.show_job("job_2")
Out[13]:
In [16]:
Copied!
_results
_results
Out[16]:
{
"return_value": {
"href": "file:///C:/Users/Clara/eozilla/test.zarr",
"hreflang": null,
"rel": null,
"title": null,
"type": "application/zarr"
}
}
In [17]:
Copied!
import xarray as xr
xr.open_dataset(_results["return_value"]["href"])
import xarray as xr
xr.open_dataset(_results["return_value"]["href"])
Out[17]:
<xarray.Dataset> Size: 8kB
Dimensions: (time: 8, lat: 5, lon: 8)
Coordinates:
* lon (lon) float64 64B 5.173 5.661 6.148 6.635 7.123 7.61 8.097 8.584
* lat (lat) float64 40B 50.83 51.29 51.75 52.21 52.67
* time (time) datetime64[ns] 64B 2025-01-01 2025-01-02 ... 2025-01-08
Data variables:
c (time, lat, lon) float64 3kB ...
a (time, lat, lon) float64 3kB ...
b (time, lat, lon) float64 3kB ...In [ ]:
Copied!
#client.get_process("create_datacube")
#client.get_process("create_datacube")
In [ ]:
Copied!