Examples¶
The following examples show how to use the loader APIs:
1.1 Parsing a Workflow¶
This sample shows how to read a CWL document from a remote public URL:
In [1]:
Copied!
from cwl_loader import load_cwl_from_location
# cwl_document = load_cwl_from_location('https://github.com/eoap/zarr-cloud-native-format/releases/download/0.3.0/app-water-bodies.0.3.0.cwl')
cwl_document = load_cwl_from_location("/home/stripodi/Downloads/hotspot.cwl")
from cwl_loader import load_cwl_from_location
# cwl_document = load_cwl_from_location('https://github.com/eoap/zarr-cloud-native-format/releases/download/0.3.0/app-water-bodies.0.3.0.cwl')
cwl_document = load_cwl_from_location("/home/stripodi/Downloads/hotspot.cwl")
2026-05-05 12:08:04.187 | DEBUG | cwl_loader:load_cwl_from_location:225 - Loading CWL document from /home/stripodi/Downloads/hotspot.cwl...
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[1], line 5 1 from cwl_loader import load_cwl_from_location 2 3 # cwl_document = load_cwl_from_location('https://github.com/eoap/zarr-cloud-native-format/releases/download/0.3.0/app-water-bodies.0.3.0.cwl') 4 ----> 5 cwl_document = load_cwl_from_location("/home/stripodi/Downloads/hotspot.cwl") File /opt/hostedtoolcache/Python/3.14.4/x64/lib/python3.14/site-packages/cwl_loader/__init__.py:263, in load_cwl_from_location(path, cwl_version, sort, session) 261 return _load_cwl_from_stream(f) 262 else: --> 263 raise ValueError(f"Invalid source {path}: not a URL or existing file path") ValueError: Invalid source /home/stripodi/Downloads/hotspot.cwl: not a URL or existing file path
1.2 Serializing¶
This sample shows how to write a CWL document to a stream (string, file, ...):
In [2]:
Copied!
from cwl_loader import dump_cwl
import sys
dump_cwl(process=cwl_document, stream=sys.stderr)
from cwl_loader import dump_cwl
import sys
dump_cwl(process=cwl_document, stream=sys.stderr)
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[2], line 4 1 from cwl_loader import dump_cwl 2 import sys 3 ----> 4 dump_cwl(process=cwl_document, stream=sys.stderr) NameError: name 'cwl_document' is not defined
2.1 Parsing a CommandLineTool¶
This sample shows how to read a CWL document from a remote public URL:
In [3]:
Copied!
cwl_document = load_cwl_from_location(
"https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/templates/stage-in-file.cwl"
)
cwl_document = load_cwl_from_location(
"https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/templates/stage-in-file.cwl"
)
2026-05-05 12:08:04.319 | DEBUG | cwl_loader:load_cwl_from_location:225 - Loading CWL document from https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/templates/stage-in-file.cwl...
2026-05-05 12:08:04.400 | DEBUG | cwl_loader:_load_cwl_from_stream:228 - Reading stream from https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/templates/stage-in-file.cwl...
2026-05-05 12:08:04.407 | DEBUG | cwl_loader:load_cwl_from_stream:195 - CWL data of type <class 'ruamel.yaml.comments.CommentedMap'> successfully loaded from stream
2026-05-05 12:08:04.408 | DEBUG | cwl_loader:load_cwl_from_yaml:115 - Updating the model from version 'v1.0' to version 'v1.2'...
2026-05-05 12:08:04.409 | DEBUG | cwl_loader:load_cwl_from_yaml:130 - Raw CWL document successfully updated to v1.2!
2026-05-05 12:08:04.410 | DEBUG | cwl_loader:load_cwl_from_yaml:136 - Parsing the raw CWL document to the CWL Utils DOM...
2026-05-05 12:08:04.793 | DEBUG | cwl_loader:load_cwl_from_yaml:145 - Raw CWL document successfully parsed to the CWL Utils DOM!
2026-05-05 12:08:04.793 | DEBUG | cwl_loader:load_cwl_from_yaml:147 - Dereferencing the steps[].run...
2026-05-05 12:08:04.794 | DEBUG | cwl_loader:load_cwl_from_yaml:151 - steps[].run successfully dereferenced! Dereferencing the FQNs...
2026-05-05 12:08:04.794 | DEBUG | cwl_loader:load_cwl_from_yaml:155 - CWL document successfully dereferenced! Now verifying steps[].run integrity...
2026-05-05 12:08:04.795 | DEBUG | cwl_loader:load_cwl_from_yaml:161 - All steps[].run link are resolvable!
2026-05-05 12:08:04.796 | DEBUG | cwl_loader:load_cwl_from_yaml:164 - Sorting Process instances by dependencies....
2026-05-05 12:08:04.796 | DEBUG | cwl_loader:load_cwl_from_yaml:166 - Sorting process is over.
2026-05-05 12:08:04.797 | DEBUG | cwl_loader:_load_cwl_from_stream:238 - Stream from https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/templates/stage-in-file.cwl successfully load!
2.2 Serializing¶
This sample shows how to write a CWL document to a stream (string, file, ...):
In [4]:
Copied!
dump_cwl(process=cwl_document, stream=sys.stderr)
dump_cwl(process=cwl_document, stream=sys.stderr)
id: my-asthonishing-stage-in-file
class: CommandLineTool
inputs:
- id: reference
label: Reference URL
doc: An URL to stage
type:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI
- id: another_input
label: Another Input
doc: An additional input for demonstration purposes
type: string
outputs:
- id: staged
type: File
outputBinding:
glob: staged
requirements:
- class: NetworkAccess
networkAccess: true
- class: SchemaDefRequirement
types:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Date
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Date/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Duration
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Duration/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Email
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Email/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Hostname
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Hostname/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNEmail
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNEmail/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNHostname
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNHostname/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv4
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv4/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv6
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv6/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRI
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRI/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRIReference
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRIReference/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#JsonPointer
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#JsonPointer/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Password
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Password/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#RelativeJsonPointer
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#RelativeJsonPointer/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#UUID
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#UUID/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URIReference
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URIReference/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URITemplate
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URITemplate/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Time
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Time/value
type: string
type: record
- class: DockerRequirement
dockerPull: ghcr.io/eoap/application-package-patterns/vegetation-indexes:0.1.1
- class: InlineJavascriptRequirement
- class: InitialWorkDirRequirement
listing:
- entryname: stage.py
entry: |-
import sys
import requests
import planetary_computer
href = sys.argv[1]
signed_url = planetary_computer.sign(href)
output_path = "staged"
response = requests.get(signed_url, stream=True)
response.raise_for_status() # Raise an error for bad status codes
with open(output_path, "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Downloaded to {output_path}")
empty_arg = sys.argv[2]
cwlVersion: v1.2
baseCommand:
- python
- stage.py
arguments:
- $( inputs.reference.value )
- $( inputs.another_input )
3. Parsing existing data structures¶
Users can load CWL Worflow(s) even from existing dictionaries:
In [5]:
Copied!
from cwl_loader import load_cwl_from_yaml
cwl_document = load_cwl_from_yaml(
raw_process={
"cwlVersion": "v1.2",
"inputs": {
"api_endpoint": {
"doc": "STAC API endpoint for Landsat-9 data",
"type": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint",
"label": "STAC API endpoint",
},
"search_request": {
"doc": "STAC API settings for Landsat-9 data",
"type": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings",
"label": "STAC API settings",
},
},
"requirements": [
{"class": "InlineJavascriptRequirement"},
{"class": "NetworkAccess", "networkAccess": True},
{
"class": "SchemaDefRequirement",
"types": [
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml"
},
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml"
},
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml"
},
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml"
},
],
},
],
"doc": "This tool uses the STAC Client to search for STAC items\n",
"class": "CommandLineTool",
"baseCommand": ["stac-client"],
"label": "STAC Client Tool",
"arguments": [
"search",
"$(inputs.api_endpoint.url.value)",
"${ const args = []; const collections = inputs.search_request.collections; args.push('--collections', collections.join(\",\")); return args; }",
"${ const args = []; const bbox = inputs.search_request?.bbox; if (Array.isArray(bbox) && bbox.length >= 4) { args.push('--bbox', ...bbox.map(String)); } return args; }",
'${ const args = []; const limit = inputs.search_request?.limit; args.push("--limit", (limit ?? 10).toString()); return args; }',
"${ const maxItems = 5; return ['--max-items', maxItems.toString()]; }",
"${ const args = []; const filter = inputs.search_request?.filter; const filterLang = inputs.search_request?.['filter-lang']; if (filterLang) { args.push('--filter-lang', filterLang); } if (filter) { args.push('--filter', JSON.stringify(filter)); } return args; }",
"${ const datetime = inputs.search_request?.datetime; const datetimeInterval = inputs.search_request?.datetime_interval; if (datetime) { return ['--datetime', datetime]; } else if (datetimeInterval) { const start = datetimeInterval.start?.value || '..'; const end = datetimeInterval.end?.value || '..'; return ['--datetime', `${start}/${end}`]; } return []; }",
"${ const ids = inputs.search_request?.ids; const args = []; if (Array.isArray(ids) && ids.length > 0) { args.push('--ids', ...ids.map(String)); } return args; }",
"${ const intersects = inputs.search_request?.intersects; if (intersects) { return ['--intersects', JSON.stringify(intersects)]; } return []; }",
"--save",
"discovery-output.json",
],
"outputs": {
"search_output": {
"outputBinding": {"glob": "discovery-output.json"},
"type": "File",
}
},
"id": "stac-client",
"hints": [
{
"dockerPull": "docker.io/library/stac-client",
"class": "DockerRequirement",
}
],
}
)
dump_cwl(process=cwl_document, stream=sys.stderr)
from cwl_loader import load_cwl_from_yaml
cwl_document = load_cwl_from_yaml(
raw_process={
"cwlVersion": "v1.2",
"inputs": {
"api_endpoint": {
"doc": "STAC API endpoint for Landsat-9 data",
"type": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint",
"label": "STAC API endpoint",
},
"search_request": {
"doc": "STAC API settings for Landsat-9 data",
"type": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings",
"label": "STAC API settings",
},
},
"requirements": [
{"class": "InlineJavascriptRequirement"},
{"class": "NetworkAccess", "networkAccess": True},
{
"class": "SchemaDefRequirement",
"types": [
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml"
},
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml"
},
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml"
},
{
"$import": "https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml"
},
],
},
],
"doc": "This tool uses the STAC Client to search for STAC items\n",
"class": "CommandLineTool",
"baseCommand": ["stac-client"],
"label": "STAC Client Tool",
"arguments": [
"search",
"$(inputs.api_endpoint.url.value)",
"${ const args = []; const collections = inputs.search_request.collections; args.push('--collections', collections.join(\",\")); return args; }",
"${ const args = []; const bbox = inputs.search_request?.bbox; if (Array.isArray(bbox) && bbox.length >= 4) { args.push('--bbox', ...bbox.map(String)); } return args; }",
'${ const args = []; const limit = inputs.search_request?.limit; args.push("--limit", (limit ?? 10).toString()); return args; }',
"${ const maxItems = 5; return ['--max-items', maxItems.toString()]; }",
"${ const args = []; const filter = inputs.search_request?.filter; const filterLang = inputs.search_request?.['filter-lang']; if (filterLang) { args.push('--filter-lang', filterLang); } if (filter) { args.push('--filter', JSON.stringify(filter)); } return args; }",
"${ const datetime = inputs.search_request?.datetime; const datetimeInterval = inputs.search_request?.datetime_interval; if (datetime) { return ['--datetime', datetime]; } else if (datetimeInterval) { const start = datetimeInterval.start?.value || '..'; const end = datetimeInterval.end?.value || '..'; return ['--datetime', `${start}/${end}`]; } return []; }",
"${ const ids = inputs.search_request?.ids; const args = []; if (Array.isArray(ids) && ids.length > 0) { args.push('--ids', ...ids.map(String)); } return args; }",
"${ const intersects = inputs.search_request?.intersects; if (intersects) { return ['--intersects', JSON.stringify(intersects)]; } return []; }",
"--save",
"discovery-output.json",
],
"outputs": {
"search_output": {
"outputBinding": {"glob": "discovery-output.json"},
"type": "File",
}
},
"id": "stac-client",
"hints": [
{
"dockerPull": "docker.io/library/stac-client",
"class": "DockerRequirement",
}
],
}
)
dump_cwl(process=cwl_document, stream=sys.stderr)
2026-05-05 12:08:04.830 | DEBUG | cwl_loader:load_cwl_from_yaml:132 - No needs to update the Raw CWL document since it targets already the v1.2
2026-05-05 12:08:04.830 | DEBUG | cwl_loader:load_cwl_from_yaml:136 - Parsing the raw CWL document to the CWL Utils DOM...
2026-05-05 12:08:05.960 | DEBUG | cwl_loader:load_cwl_from_yaml:145 - Raw CWL document successfully parsed to the CWL Utils DOM!
2026-05-05 12:08:05.961 | DEBUG | cwl_loader:load_cwl_from_yaml:147 - Dereferencing the steps[].run...
2026-05-05 12:08:05.962 | DEBUG | cwl_loader:load_cwl_from_yaml:151 - steps[].run successfully dereferenced! Dereferencing the FQNs...
2026-05-05 12:08:05.963 | DEBUG | cwl_loader:load_cwl_from_yaml:155 - CWL document successfully dereferenced! Now verifying steps[].run integrity...
2026-05-05 12:08:05.963 | DEBUG | cwl_loader:load_cwl_from_yaml:161 - All steps[].run link are resolvable!
2026-05-05 12:08:05.964 | DEBUG | cwl_loader:load_cwl_from_yaml:164 - Sorting Process instances by dependencies....
2026-05-05 12:08:05.965 | DEBUG | cwl_loader:load_cwl_from_yaml:166 - Sorting process is over.
id: stac-client
class: CommandLineTool
label: STAC Client Tool
doc: "This tool uses the STAC Client to search for STAC items\n"
inputs:
- id: api_endpoint
label: STAC API endpoint
doc: STAC API endpoint for Landsat-9 data
type:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint
- id: search_request
label: STAC API settings
doc: STAC API settings for Landsat-9 data
type:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings
outputs:
- id: search_output
type: File
outputBinding:
glob: discovery-output.json
requirements:
- class: InlineJavascriptRequirement
- class: NetworkAccess
networkAccess: true
- class: SchemaDefRequirement
types:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Date
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Date/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Duration
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Duration/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Email
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Email/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Hostname
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Hostname/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNEmail
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNEmail/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNHostname
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IDNHostname/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv4
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv4/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv6
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IPv6/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRI
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRI/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRIReference
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#IRIReference/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#JsonPointer
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#JsonPointer/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Password
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Password/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#RelativeJsonPointer
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#RelativeJsonPointer/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#UUID
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#UUID/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URIReference
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URIReference/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URITemplate
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URITemplate/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Time
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#Time/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#PointType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#PointType/Point
type: enum
- name: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#PointType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point/coordinates
type:
name: _:0ea77029-e0af-42cf-a0da-7b0869ed6a0d
items: double
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point/bbox
type:
name: _:901930d3-0ece-4681-9f54-00cdc0161ff1
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineStringType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineStringType/LineString
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineStringType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString/coordinates
type:
name: _:99c93b5b-23e2-46e2-8d4f-678e1bfa84cd
items: double
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString/bbox
type:
name: _:4a91883e-11da-4506-b818-93c3ece15a46
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#PolygonType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#PolygonType/Polygon
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#PolygonType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon/coordinates
type:
name: _:2c95c984-6df1-4515-ba80-a2dc5eab87ba
items:
name: _:b4d6e8a0-f666-4a2b-b53f-838aecb26973
items:
name: _:2ec25615-a1e0-4436-902e-b2fd9539a374
items: double
type: array
type: array
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon/bbox
type:
name: _:815f0543-32f6-48f9-a730-dd47cd8590d5
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPointType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPointType/MultiPoint
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPointType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint/coordinates
type:
name: _:36739456-ad07-4a2f-b679-adf6e8ab44df
items:
name: _:b5565d79-9971-4dbe-be9b-22ae007e3262
items: double
type: array
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint/bbox
type:
name: _:c4d785e3-7df3-4510-a91f-de46334bd308
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineStringType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineStringType/MultiLineString
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineStringType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString/coordinates
type:
name: _:a77cfb46-70e9-4d0b-a657-df8d51fd5fc6
items:
name: _:472ea23d-56af-41a8-ad0a-68096b87d61b
items:
name: _:db09400e-d2d0-47a3-9280-9ba5c1705dbc
items: double
type: array
type: array
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString/bbox
type:
name: _:4b1ab61a-9b6e-4c14-9114-b83cc8b2d4b8
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygonType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygonType/MultiPolygon
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygonType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon/coordinates
type:
name: _:7b003142-21e5-4495-8f00-a8799d9d3424
items:
name: _:dbd1da51-4ed1-4e35-b026-f8a8826598e3
items:
name: _:9deb13cf-9a66-48ff-9cbe-8ad2101c4901
items:
name: _:7a4e560e-6cc5-4897-ac5d-e05a6698f837
items: double
type: array
type: array
type: array
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon/bbox
type:
name: _:2229d209-c4bb-44ab-b6a6-ce5c73be12fa
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureType/Feature
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature/id
doc: "Identifier"
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature/geometry
type:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature/bbox
type:
name: _:9cc8fd15-70ba-430c-9126-fd03656e09e1
items: double
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollectionType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollectionType/GeometryCollection
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollection
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollection/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollectionType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollection/geometries
type:
name: _:1fa5338e-1ba8-4145-a8e4-e854e7ebf429
items:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollection/bbox
type:
name: _:794027a4-66e9-43e0-9b63-622868f66465
items: double
type: array
type: record
- name: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link/href
doc: "i.e. http://data.example.com/buildings/123"
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link/rel
doc: "i.e. alternate"
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link/type
doc: "i.e. application/geo+json"
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link/hreflang
doc: "i.e. en"
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link/title
doc: "i.e. Trierer Strasse 70, 53115 Bonn"
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link/length
type: int
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollectionType
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollectionType/FeatureCollection
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection/type
type:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollectionType
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection/features
type:
name: _:0d8f5478-6fb6-48e2-b8ee-c482b484d5cb
items:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection/links
type:
name: _:b7e5f282-4381-4236-bc97-7cdc0b0a2731
items:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Link
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection/timeStamp
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection/numberMatched
type: int
- name:
https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#FeatureCollection/numberReturned
type: int
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#KeyValuePair
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#KeyValuePair/key
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#KeyValuePair/value
type: string
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint/url
type:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint/headers
type:
- 'null'
- name: _:54f501c8-f1e4-49b9-a53a-4a521e710eb5
items:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#KeyValuePair
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#DatetimeInterval
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#DatetimeInterval/start
type:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#DatetimeInterval/end
type:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Fields
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Fields/include
type:
- 'null'
- name: _:868a671d-2ba0-4d6e-b88a-0c2e9feeb771
items: string
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Fields/exclude
type:
- 'null'
- name: _:49abdf4c-bb8b-47cd-937f-e8cbb2bdb418
items: string
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#FilterLang
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#FilterLang/cql2-text
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#FilterLang/cql2-json
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Direction
symbols:
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Direction/asc
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Direction/desc
type: enum
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#SortBy
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#SortBy/field
type: string
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#SortBy/direction
type:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Direction
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/bbox
type:
- 'null'
- name: _:73b73b7f-218c-41e3-b784-6951cb5f2c40
items: double
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/datetime
type:
- 'null'
- https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#DateTime
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/datetime-interval
type:
- 'null'
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#DatetimeInterval
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/intersects
type:
- 'null'
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPoint
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#LineString
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiLineString
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Polygon
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#MultiPolygon
- https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#GeometryCollection
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/collections
type:
- 'null'
- name: _:bb7996c4-1752-480c-b431-0e212738ac43
items: string
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/ids
type:
- 'null'
- name: _:345bd2e6-87dd-4326-b7f9-fac0648d271d
items: string
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/limit
type:
- 'null'
- int
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/max-items
type:
- 'null'
- int
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/fields
type:
- 'null'
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#Fields
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/filter
type:
- 'null'
- Any
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/filter-lang
type:
- 'null'
- https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#FilterLang
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/filter-crs
type:
- 'null'
- name: _:eebaf334-32f3-4ed2-bc97-17e7a1dce5b2
items:
https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml#URI
type: array
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings/sortby
type:
- 'null'
- name: _:628de77d-227b-4486-8ca8-a9128a2e5d8e
items:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#SortBy
type: array
type: record
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACAPI
fields:
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACAPI/api_endpoint
type:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/api-endpoint.yaml#APIEndpoint
- name:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACAPI/search_request
type:
https://raw.githubusercontent.com/eoap/schemas/main/experimental/discovery.yaml#STACSearchSettings
type: record
hints:
- class: DockerRequirement
dockerPull: docker.io/library/stac-client
cwlVersion: v1.2
baseCommand:
- stac-client
arguments:
- search
- $(inputs.api_endpoint.url.value)
- ${ const args = []; const collections = inputs.search_request.collections;
args.push('--collections', collections.join(",")); return args; }
- ${ const args = []; const bbox = inputs.search_request?.bbox; if
(Array.isArray(bbox) && bbox.length >= 4) { args.push('--bbox',
...bbox.map(String)); } return args; }
- ${ const args = []; const limit = inputs.search_request?.limit;
args.push("--limit", (limit ?? 10).toString()); return args; }
- ${ const maxItems = 5; return ['--max-items', maxItems.toString()]; }
- ${ const args = []; const filter = inputs.search_request?.filter; const
filterLang = inputs.search_request?.['filter-lang']; if (filterLang) {
args.push('--filter-lang', filterLang); } if (filter) { args.push('--filter',
JSON.stringify(filter)); } return args; }
- ${ const datetime = inputs.search_request?.datetime; const datetimeInterval =
inputs.search_request?.datetime_interval; if (datetime) { return
['--datetime', datetime]; } else if (datetimeInterval) { const start =
datetimeInterval.start?.value || '..'; const end = datetimeInterval.end?.value
|| '..'; return ['--datetime', `${start}/${end}`]; } return []; }
- ${ const ids = inputs.search_request?.ids; const args = []; if
(Array.isArray(ids) && ids.length > 0) { args.push('--ids',
...ids.map(String)); } return args; }
- ${ const intersects = inputs.search_request?.intersects; if (intersects) {
return ['--intersects', JSON.stringify(intersects)]; } return []; }
- --save
- discovery-output.json
4. Parsing conditional Workflow¶
In [6]:
Copied!
cwl_document = load_cwl_from_location(
"https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl"
)
dump_cwl(process=cwl_document, stream=sys.stderr)
cwl_document = load_cwl_from_location(
"https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl"
)
dump_cwl(process=cwl_document, stream=sys.stderr)
2026-05-05 12:08:06.042 | DEBUG | cwl_loader:load_cwl_from_location:225 - Loading CWL document from https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl...
2026-05-05 12:08:06.104 | DEBUG | cwl_loader:_load_cwl_from_stream:228 - Reading stream from https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl...
2026-05-05 12:08:06.125 | DEBUG | cwl_loader:load_cwl_from_stream:195 - CWL data of type <class 'ruamel.yaml.comments.CommentedMap'> successfully loaded from stream
2026-05-05 12:08:06.126 | DEBUG | cwl_loader:load_cwl_from_yaml:132 - No needs to update the Raw CWL document since it targets already the v1.2
2026-05-05 12:08:06.126 | DEBUG | cwl_loader:load_cwl_from_yaml:136 - Parsing the raw CWL document to the CWL Utils DOM...
2026-05-05 12:08:06.383 | DEBUG | cwl_loader:load_cwl_from_yaml:145 - Raw CWL document successfully parsed to the CWL Utils DOM!
2026-05-05 12:08:06.384 | DEBUG | cwl_loader:load_cwl_from_yaml:147 - Dereferencing the steps[].run...
2026-05-05 12:08:06.384 | DEBUG | cwl_loader:_on_process:54 - Checking if https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl#stac must be externally imported...
2026-05-05 12:08:06.385 | DEBUG | cwl_loader:_on_process:58 - run_url: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl - uri: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl
2026-05-05 12:08:06.386 | DEBUG | cwl_loader:_on_process:54 - Checking if https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl#rio_stack must be externally imported...
2026-05-05 12:08:06.386 | DEBUG | cwl_loader:_on_process:58 - run_url: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl - uri: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl
2026-05-05 12:08:06.387 | DEBUG | cwl_loader:_on_process:54 - Checking if https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl#rio_warp_stack must be externally imported...
2026-05-05 12:08:06.387 | DEBUG | cwl_loader:_on_process:58 - run_url: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl - uri: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl
2026-05-05 12:08:06.388 | DEBUG | cwl_loader:_on_process:54 - Checking if https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl#rio_color must be externally imported...
2026-05-05 12:08:06.388 | DEBUG | cwl_loader:_on_process:58 - run_url: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl - uri: https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl
2026-05-05 12:08:06.389 | DEBUG | cwl_loader:load_cwl_from_yaml:151 - steps[].run successfully dereferenced! Dereferencing the FQNs...
2026-05-05 12:08:06.389 | DEBUG | cwl_loader:load_cwl_from_yaml:155 - CWL document successfully dereferenced! Now verifying steps[].run integrity...
2026-05-05 12:08:06.390 | DEBUG | cwl_loader:load_cwl_from_yaml:161 - All steps[].run link are resolvable!
2026-05-05 12:08:06.391 | DEBUG | cwl_loader:load_cwl_from_yaml:164 - Sorting Process instances by dependencies....
2026-05-05 12:08:06.391 | DEBUG | cwl_loader:load_cwl_from_yaml:166 - Sorting process is over.
2026-05-05 12:08:06.392 | DEBUG | cwl_loader:_load_cwl_from_stream:238 - Stream from https://raw.githubusercontent.com/eoap/how-to/refs/heads/main/cwl-workflows/conditional-workflows.cwl successfully load!
cwlVersion: v1.2
$graph:
- id: main
class: Workflow
inputs:
- id: stac-item
type: string
- id: epsg_code
default: native
type: string
- id: bands
type:
name: _:93f03b73-a136-4864-bcd7-aa83c992c43b
items: string
type: array
outputs:
- id: rgb-tif
outputSource: step_color/rgb
type: File
- id: stack
outputSource:
- step_stack/stacked
- step_warp_stack/stacked
pickValue: the_only_non_null
type: File
requirements:
- class: InlineJavascriptRequirement
- class: NetworkAccess
networkAccess: true
- class: ScatterFeatureRequirement
- class: MultipleInputFeatureRequirement
cwlVersion: v1.2
steps:
- id: step_curl
in:
- id: stac_item
source: stac-item
- id: common_band_name
source: bands
out:
- hrefs
run: '#stac'
scatter: step_curl/common_band_name
scatterMethod: dotproduct
- id: step_stack
in:
- id: tiffs
source: step_curl/hrefs
- id: epsg_code
source: epsg_code
out:
- stacked
run: '#rio_stack'
when: $( inputs.epsg_code == "native")
- id: step_warp_stack
in:
- id: tiffs
source: step_curl/hrefs
- id: epsg_code
source: epsg_code
out:
- stacked
run: '#rio_warp_stack'
when: $( inputs.epsg_code != "native")
- id: step_color
in:
- id: stacked
source:
- step_stack/stacked
- step_warp_stack/stacked
pickValue: the_only_non_null
out:
- rgb
run: '#rio_color'
- id: rio_stack
class: CommandLineTool
inputs:
- id: tiffs
type:
name: _:3ea285dd-63b9-4b30-ba24-11f9d0d6d55d
items: string
type: array
outputs:
- id: stacked
type: File
outputBinding:
glob: stacked.tif
requirements:
- class: DockerRequirement
dockerPull: ghcr.io/eoap/how-to/rio:1.0.0
- class: EnvVarRequirement
envDef:
- envName: GDAL_TIFF_INTERNAL_MASK
envValue: YES
- envName: GDAL_HTTP_MERGE_CONSECUTIVE_RANGES
envValue: YES
- envName: CPL_VSIL_CURL_ALLOWED_EXTENSIONS
envValue: .tif
- class: InitialWorkDirRequirement
listing:
- entryname: run.sh
entry: |-
#!/bin/bash
rio stack $@
cwlVersion: v1.2
baseCommand:
- /bin/bash
- run.sh
arguments:
- valueFrom: |
${
var arr = [];
for(var i=0; i<inputs.tiffs.length; i++) {
arr.push(inputs.tiffs[i]);
}
return arr;
}
- stacked.tif
- id: stac
class: CommandLineTool
inputs:
- id: stac_item
type: string
- id: common_band_name
type: string
outputs:
- id: hrefs
type: string
outputBinding:
loadContents: true
glob: message
outputEval: |
${
const assets = JSON.parse(self[0].contents).assets;
const bandKey = Object.keys(assets).find(key =>
assets[key]['eo:bands'] &&
assets[key]['eo:bands'].length === 1 &&
assets[key]['eo:bands'].some(band => band.common_name === inputs.common_band_name)
);
if (!bandKey) {
throw new Error(`No valid asset found for band: ${inputs.common_band_name}`);
}
return assets[bandKey].href;
}
requirements:
- class: DockerRequirement
dockerPull: docker.io/curlimages/curl:latest
cwlVersion: v1.2
baseCommand: curl
arguments:
- $( inputs.stac_item )
stdout: message
- id: rio_color
class: CommandLineTool
inputs:
- id: stacked
type: File
outputs:
- id: rgb
type: File
outputBinding:
glob: rgb.tif
requirements:
- class: DockerRequirement
dockerPull: ghcr.io/eoap/how-to/rio:1.0.0
- class: InitialWorkDirRequirement
listing:
- entryname: run.sh
entry: |-
#!/bin/bash
rio color -j -1 --out-dtype uint8 $1 rgb.tif "gamma 3 0.95, sigmoidal rgb 35 0.13"
cwlVersion: v1.2
baseCommand:
- /bin/bash
- run.sh
arguments:
- $( inputs.stacked.path )
- id: rio_warp_stack
class: CommandLineTool
inputs:
- id: tiffs
type:
name: _:cda377ed-7851-4899-9e0b-aba08522ccb1
items: string
type: array
- id: epsg_code
type: string
outputs:
- id: stacked
type: File
outputBinding:
glob: warped.tif
requirements:
- class: DockerRequirement
dockerPull: ghcr.io/eoap/how-to/rio:1.0.0
- class: EnvVarRequirement
envDef:
- envName: GDAL_TIFF_INTERNAL_MASK
envValue: YES
- envName: GDAL_HTTP_MERGE_CONSECUTIVE_RANGES
envValue: YES
- envName: CPL_VSIL_CURL_ALLOWED_EXTENSIONS
envValue: .tif
- class: InitialWorkDirRequirement
listing:
- entryname: run.sh
entry: |-
#!/bin/bash
rio stack $@
rio warp --dst-crs $(inputs.epsg_code) stacked.tif warped.tif
cwlVersion: v1.2
baseCommand:
- /bin/bash
- run.sh
arguments:
- valueFrom: |
${
var arr = [];
for(var i=0; i<inputs.tiffs.length; i++) {
arr.push(inputs.tiffs[i]);
}
return arr;
}
- stacked.tif