Writing the Tool Wrappers
Each identified tool is converted to a CWL CommandLineTool.
curl and yq
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: terradue/jq
ShellCommandRequirement: {}
InlineJavascriptRequirement: {}
baseCommand: curl
arguments:
- -s
- $(inputs.stac_item)
- "|"
- jq
- .assets.$(inputs.asset).href
- "|"
- tr
- -d
- '\"' #\""
stdout: message
inputs:
stac_item:
type: string
asset:
type: string
outputs:
asset_href:
type: string
outputBinding:
glob: message
loadContents: true
outputEval: $( self[0].contents.split("\n").join("") )
cwlVersion: v1.0
gdal_translate
class: CommandLineTool
requirements:
InlineJavascriptRequirement: {}
DockerRequirement:
dockerPull: osgeo/gdal
baseCommand: gdal_translate
arguments:
- -projwin
- valueFrom: ${ return inputs.bbox.split(",")[0]; }
- valueFrom: ${ return inputs.bbox.split(",")[3]; }
- valueFrom: ${ return inputs.bbox.split(",")[2]; }
- valueFrom: ${ return inputs.bbox.split(",")[1]; }
- -projwin_srs
- valueFrom: ${ return inputs.epsg; }
- valueFrom: |
${ if (inputs.asset.startsWith("http")) {
return "/vsicurl/" + inputs.asset;
} else {
return inputs.asset;
}
}
- valueFrom: ${ return inputs.asset.split("/").slice(-1)[0].replace("TIF", "tif"); }
inputs:
asset:
type: string
bbox:
type: string
epsg:
type: string
default: "EPSG:4326"
outputs:
tifs:
outputBinding:
glob: '*.tif'
type: File
stderr: stderr
stdout: stdout
cwlVersion: v1.0
otbcli_ConcatenateImages
class: CommandLineTool
requirements:
InlineJavascriptRequirement: {}
DockerRequirement:
dockerPull: terradue/otb-7.2.0
baseCommand: otbcli_ConcatenateImages
arguments:
- -out
- xs_stack.tif
inputs:
tifs:
type: File[]
inputBinding:
position: 5
prefix: -il
separate: true
outputs:
xs_stack:
outputBinding:
glob: "xs_stack.tif"
type: File
stderr: stderr
stdout: stdout
cwlVersion: v1.0
otbcli_BundleToPerfectSensor
class: CommandLineTool
requirements:
InlineJavascriptRequirement: {}
DockerRequirement:
dockerPull: terradue/otb-7.2.0
baseCommand: otbcli_BundleToPerfectSensor
arguments:
- -out
- pan-sharpen.tif
inputs:
xs:
type: File
inputBinding:
position: 2
prefix: -inxs
separate: true
pan:
type: File
inputBinding:
position: 3
prefix: -inp
separate: true
outputs:
pan-sharpened:
outputBinding:
glob: "*.tif"
type: File
stderr: stderr
stdout: stdout
cwlVersion: v1.0