Client GUI Usage¶
The following is a step-by-step guide that demonstrates how to use the Sen4CAP GUI in a Jupyter notebook.
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.
Important: Make sure you have already configured the client to run with the TAO Process API server. In a command shell run sen4cap-client configure and enter your credentials given that they differ from the provided default values.
In [1]:
Copied!
from sen4cap_client.gui import Client
from sen4cap_client.gui import Client
In [2]:
Copied!
import warnings
warnings.filterwarnings("always")
import warnings
warnings.filterwarnings("always")
In [3]:
Copied!
client = Client()
client
client = Client()
client
Out[3]:
{
"api_key": null,
"api_key_header": "X-API-Key",
"api_url": "http://localhost:8080/process/",
"auth_type": "token",
"auth_url": "http://localhost:8080/auth/login",
"password": null,
"token": "13cd8418-0b76-4346-b89b-2f5d7f5a5959",
"token_header": "X-Auth-Token",
"use_bearer": false,
"username": null
}
In [4]:
Copied!
client.get_processes()
client.get_processes()
Out[4]:
{
"links": [
{
"href": "/process/processes",
"rel": "self",
"type": "application/json"
},
{
"href": "/process/processes/3",
"rel": "self",
"title": "Process description",
"type": "application/json"
},
{
"href": "/process/processes/3/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Process execution",
"type": "application/json"
},
{
"href": "/process/processes/2",
"rel": "self",
"title": "Process description",
"type": "application/json"
},
{
"href": "/process/processes/2/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Process execution",
"type": "application/json"
},
{
"href": "/process/processes/1",
"rel": "self",
"title": "Process description",
"type": "application/json"
},
{
"href": "/process/processes/1/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Process execution",
"type": "application/json"
},
{
"href": "/process/processes/71",
"rel": "self",
"title": "Process description",
"type": "application/json"
},
{
"href": "/process/processes/71/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Process execution",
"type": "application/json"
},
{
"href": "/process/processes/6",
"rel": "self",
"title": "Process description",
"type": "application/json"
},
{
"href": "/process/processes/6/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Process execution",
"type": "application/json"
},
{
"href": "/process/processes/5",
"rel": "self",
"title": "Process description",
"type": "application/json"
},
{
"href": "/process/processes/5/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Process execution",
"type": "application/json"
}
],
"processes": [
{
"id": "3",
"jobControlOptions": [
"async-execute"
],
"outputTransmission": [
"value"
],
"title": "Sentinel-2 Vegetation Indices",
"version": "1.0"
},
{
"id": "2",
"jobControlOptions": [
"async-execute"
],
"outputTransmission": [
"value"
],
"title": "Sentinel-1 Flood Detection",
"version": "1.0"
},
{
"id": "1",
"jobControlOptions": [
"async-execute"
],
"outputTransmission": [
"value"
],
"title": "Sentinel-2 Water Indices",
"version": "1.0"
},
{
"description": "Sen4CAP L3B NDVI Processor",
"id": "71",
"jobControlOptions": [
"async-execute"
],
"outputTransmission": [
"value"
],
"title": "L3B NDVI Processor 5.0",
"version": "1.0"
},
{
"description": "Sen4CAP L3B LAI Processor ",
"id": "6",
"jobControlOptions": [
"async-execute"
],
"outputTransmission": [
"value"
],
"title": "L3BProcessor - LAI",
"version": "1.0"
},
{
"description": "Sen4CAP L3B NDVI Processor ",
"id": "5",
"jobControlOptions": [
"async-execute"
],
"outputTransmission": [
"value"
],
"title": "L3BProcessor - NDVI",
"version": "1.0"
}
]
}
In [5]:
Copied!
client.get_process("71")
client.get_process("71")
Out[5]:
{
"description": "Sen4CAP L3B NDVI Processor",
"id": "71",
"inputs": {
"0fcb398b-f720-4a0e-b98a-b68934a6c581": {
"description": "Site ID",
"schema": {
"default": "0",
"description": "Site ID",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "siteid",
"x-uiLevel": "advanced"
},
"28bc4311-28ff-4c9f-b5d4-51c0657a465d": {
"description": "Product type",
"schema": {
"default": "l3b",
"description": "Product type",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "prdtype",
"x-uiLevel": "advanced"
},
"4fc70075-e3f4-4055-88eb-3295099b3d8b": {
"description": "Product Level",
"schema": {
"default": "L3B",
"description": "Product Level",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "level",
"x-uiLevel": "advanced"
},
"96e687c8-9190-464d-8ddf-65d63d118ec8": {
"description": "Destination mounted root directory",
"schema": {
"default": "/SEN4CAP_L3B",
"description": "Destination mounted root directory",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "prddestroot",
"x-uiLevel": "advanced"
},
"a5c21752-e0c5-4108-b042-5af3e9ec9f39": {
"description": "Processor short name",
"schema": {
"default": "l3b",
"description": "Processor short name",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "processor",
"x-uiLevel": "advanced"
},
"a8df8129-544a-41ec-bdf4-107d18a9bd2b": {
"description": "Product baseline",
"schema": {
"default": "01.00",
"description": "Product baseline",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "baseline",
"x-uiLevel": "advanced"
},
"ac6c6b6d-e6f4-4371-88ce-e3070b8408cb": {
"description": "File class",
"schema": {
"default": "OPER",
"description": "File class",
"maxLength": 255,
"minLength": 1,
"nullable": true,
"title": "Parameter Schema",
"type": "string"
},
"title": "fileclass",
"x-uiLevel": "advanced"
},
"pass-through-component-input": {
"description": "input",
"metadata": [
{
"title": "cardinality"
},
{
"title": "format"
}
],
"schema": {
"properties": {
"href": {
"format": "uri-reference",
"type": "string"
},
"type": {
"default": "application/xml",
"type": "string"
}
},
"required": [
"href"
],
"type": "string"
},
"title": "input"
}
},
"outputs": {
"fb6d917a-8942-4de4-8e1f-d729ebe347b7": {
"description": "stacitemsfile",
"metadata": [
{
"title": "cardinality"
},
{
"title": "format"
},
{
"title": "sensor"
}
],
"schema": {
"maxLength": 0,
"type": "string"
},
"title": "stacitemsfile"
}
},
"title": "L3B NDVI Processor 5.0",
"version": "1.0"
}
In [6]:
Copied!
client.show()
client.show()
Out[6]:
In [10]:
Copied!
_request
_request
Out[10]:
{
"dotpath": true,
"inputs": {
"0fcb398b-f720-4a0e-b98a-b68934a6c581": "0",
"28bc4311-28ff-4c9f-b5d4-51c0657a465d": "l3b",
"4fc70075-e3f4-4055-88eb-3295099b3d8b": "L3B",
"96e687c8-9190-464d-8ddf-65d63d118ec8": "/SEN4CAP_L3B",
"a5c21752-e0c5-4108-b042-5af3e9ec9f39": "l3b",
"a8df8129-544a-41ec-bdf4-107d18a9bd2b": "01.00",
"ac6c6b6d-e6f4-4371-88ce-e3070b8408cb": "OPER",
"pass-through-component-input": ""
},
"process_id": "71"
}
In [ ]:
Copied!
# client.stop_updating()
# client.stop_updating()
In [ ]:
Copied!
client.show_jobs()
client.show_jobs()
In [ ]:
Copied!
client.show_job("job_6")
client.show_job("job_6")
In [ ]:
Copied!
_results
_results
In [ ]:
Copied!
import xarray as xr
xr.open_dataset(_results["return_value"]["href"])
import xarray as xr
xr.open_dataset(_results["return_value"]["href"])
In [ ]:
Copied!