Experimental Discovery Inputs¶
CWL example¶
cwlVersion: v1.2
class: CommandLineTool
label: "geo API - Discovery"
baseCommand: cat
requirements:
- class: InlineJavascriptRequirement
- class: SchemaDefRequirement
types:
- $import: https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml
- $import: https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml
- $import: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml
- $import: https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml
- class: InitialWorkDirRequirement
listing:
- entryname: inputs.yaml
entry: "$(inputs.api_endpoint.url.value)\n---\n$(inputs.search_request.collections[0])\n---\n${ \n const bbox = inputs.search_request?.bbox;\n if (bbox && Array.isArray(bbox) && bbox.length >= 4) {\n return \"--bbox \" + bbox.join(\" \");\n }\n return \"\";\n}"
inputs:
api_endpoint:
type: https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint
label: "STAC API endpoint"
doc: "STAC API endpoint for Landsat-9 data"
search_request:
type: https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings
label: "STAC API settings"
doc: "STAC API settings for Landsat-9 data"
arguments:
- inputs.yaml
outputs:
echo_output:
type: stdout
stdout: discovery-output.yaml
Input example¶
api_endpoint:
url:
value: https://planetarycomputer.microsoft.com/api/stac/v1
headers: []
search_request:
collections:
- landsat-c2-l2
datetime_interval:
start:
value: "2023-10-15T18:00:00"
end:
value: "2023-10-15T18:59:59"
bbox:
- -118.985
- 38.432
- -118.183
- 38.938
filter-lang: cql2-json
filter: {"op": "and", "args": [{"op": "<=", "args": [{"property": "eo:cloud_cover"}, 60]}, {"op": ">=", "args": [{"property": "eo:cloud_cover"}, 0]}]}
Execute the example¶
Run the example with:
cwltool examples/experimental/discovery.cwl examples/experimental/discovery.yaml
This produces the output:
INFO /opt/hostedtoolcache/Python/3.13.5/x64/bin/cwltool 3.1.20250715140722
INFO Resolved '../../examples/experimental/discovery.cwl' to 'file:///home/runner/work/schemas/schemas/examples/experimental/discovery.cwl'
DEBUG [job discovery.cwl] initializing from file:///home/runner/work/schemas/schemas/examples/experimental/discovery.cwl
DEBUG [job discovery.cwl] {
"api_endpoint": {
"url": {
"value": "https://planetarycomputer.microsoft.com/api/stac/v1"
},
"headers": []
},
"search_request": {
"collections": [
"landsat-c2-l2"
],
"datetime_interval": {
"start": {
"value": "2023-10-15T18:00:00"
},
"end": {
"value": "2023-10-15T18:59:59"
}
},
"bbox": [
-118.985,
38.432,
-118.183,
38.938
],
"filter-lang": "cql2-json",
"filter": {
"op": "and",
"args": [
{
"op": "<=",
"args": [
{
"property": "eo:cloud_cover"
},
60
]
},
{
"op": ">=",
"args": [
{
"property": "eo:cloud_cover"
},
0
]
}
]
},
"datetime": null,
"datetime-interval": null,
"intersects": null,
"ids": null,
"limit": null,
"fields": null,
"filter-crs": null,
"sortby": null
}
}
DEBUG [job discovery.cwl] path mappings is {}
DEBUG [job discovery.cwl] command line bindings is [
{
"position": [
-1000000,
0
],
"datum": "cat"
},
{
"position": [
0,
0
],
"datum": "inputs.yaml"
}
]
DEBUG [job discovery.cwl] initial work dir {
"_:935f6cf4-57c6-4418-bc74-65dac3667e78": [
"https://planetarycomputer.microsoft.com/api/stac/v1\n---\nlandsat-c2-l2\n---\n--bbox -118.985 38.432 -118.183 38.938",
"/tmp/xuclh0bf/inputs.yaml",
"CreateFile",
true
]
}
INFO [job discovery.cwl] /tmp/xuclh0bf$ cat \
inputs.yaml > /tmp/xuclh0bf/discovery-output.yaml
DEBUG Could not collect memory usage, job ended before monitoring began.
INFO [job discovery.cwl] completed success
DEBUG [job discovery.cwl] outputs {
"echo_output": {
"location": "file:///tmp/xuclh0bf/discovery-output.yaml",
"basename": "discovery-output.yaml",
"nameroot": "discovery-output",
"nameext": ".yaml",
"class": "File",
"checksum": "sha1$756a816a78cff2ac8d01cdd53654259016f36dc6",
"size": 112,
"http://commonwl.org/cwltool#generation": 0
}
}
DEBUG [job discovery.cwl] Removing input staging directory /tmp/2cuuaghf
DEBUG [job discovery.cwl] Removing temporary directory /tmp/f69ctyid
DEBUG Moving /tmp/xuclh0bf/discovery-output.yaml to /home/runner/work/schemas/schemas/docs/experimental/discovery-output.yaml
DEBUG Removing intermediate output directory /tmp/xuclh0bf
INFO Final process status is success
The content of the echo_output.txt
file is:
https://planetarycomputer.microsoft.com/api/stac/v1
---
landsat-c2-l2
---
--bbox -118.985 38.432 -118.183 38.938