STAC Catalog¶
CWL example¶
cwlVersion: v1.2
class: CommandLineTool
label: "Echo STAC Catalog"
baseCommand: echo
requirements:
- class: InlineJavascriptRequirement
- class: SchemaDefRequirement
types:
- $import: https://raw.githubusercontent.com/eoap/schemas/main/stac.yaml
inputs:
stac_catalog:
type: https://raw.githubusercontent.com/eoap/schemas/main/stac.yaml#Catalog
label: "STAC Catalog"
doc: "STAC Catalog defined in STAC format"
inputBinding:
valueFrom: |
${
// Validate if type is 'Feature'
if ('Catalog' !== inputs.stac_catalog.type) {
throw "Invalid STAC type: expected 'Catalog', got '" + inputs.stac_catalog.type + "'";
}
// get the STAC Catalog description
return "STAC Catalog description: " + inputs.stac_catalog.description;
}
outputs:
echo_output:
type: stdout
stdout: echo_output.txt
Input example¶
stac_catalog:
class: "https://raw.githubusercontent.com/eoap/schemas/main/stac.yaml#Catalog"
id: "stac-catalog"
type: "Catalog"
title: "STAC Catalog Example"
description: "An example STAC catalog"
stac_version: "1.0.0"
stac_extensions:
- "https://raw.githubusercontent.com/radiantearth/stac-api-spec/refs/tags/v1.0.0/extensions/eo/v1.0.0/schema.json"
links:
- rel: "self"
href: "http://example.com/catalog.json"
type: "application/json"
title: "This catalog"
- rel: item
href: "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2A_10TFK_20220524_0_L2A"
type: "application/json"
title: "This is the input item"
Execute the example¶
Run the example with:
cwltool examples/stac/catalog.cwl examples/stac/catalog.yaml
This produces the output:
INFO /opt/hostedtoolcache/Python/3.13.5/x64/bin/cwltool 3.1.20250715140722
INFO Resolved '../../examples/stac/catalog.cwl' to 'file:///home/runner/work/schemas/schemas/examples/stac/catalog.cwl'
INFO [job catalog.cwl] /tmp/7didi995$ echo \
'STAC Catalog description: An example STAC catalog' > /tmp/7didi995/echo_output.txt
INFO [job catalog.cwl] completed success
INFO Final process status is success
The content of the echo_output.txt
file is:
STAC Catalog description: An example STAC catalog