SNAP Graph inline
CWL allows creating files using the InitialWorkDirRequirement
:
InitialWorkDirRequirement:
listing:
- entryname: graph.xml
entry: |-
The file graph.xml
is created before executing the CommandLineTool. This approach is thus used to create the SNAP Graph with the content provided in the CWL document.
This approach removes the File
parameter used in the previous section and provides a self-standing CWL document:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 | class: CommandLineTool
id: sar-calibration
requirements:
DockerRequirement:
dockerPull: snap-gpt
EnvVarRequirement:
envDef:
PATH: /srv/conda/envs/env_snap/snap/bin:/usr/share/java/maven/bin:/usr/share/java/maven/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
ResourceRequirement: {}
InitialWorkDirRequirement:
listing:
- entryname: calibration.xml
entry: |-
<graph id="Graph">
<version>1.0</version>
<node id="Read">
<operator>Read</operator>
<sources/>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<file>${inFile}</file>
<formatName>SENTINEL-1</formatName>
</parameters>
</node>
<node id="Calibration">
<operator>Calibration</operator>
<sources>
<sourceProduct refid="Read"/>
</sources>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<sourceBands/>
<auxFile>Product Auxiliary File</auxFile>
<externalAuxFile/>
<outputImageInComplex>false</outputImageInComplex>
<outputImageScaleInDb>false</outputImageScaleInDb>
<createGammaBand>false</createGammaBand>
<createBetaBand>false</createBetaBand>
<selectedPolarisations>${selPol}</selectedPolarisations>
<outputSigmaBand>true</outputSigmaBand>
<outputGammaBand>false</outputGammaBand>
<outputBetaBand>false</outputBetaBand>
</parameters>
</node>
<node id="Write">
<operator>Write</operator>
<sources>
<sourceProduct refid="Calibration"/>
</sources>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<file>./cal.dim</file>
<formatName>BEAM-DIMAP</formatName>
</parameters>
</node>
</graph>
baseCommand: [gpt, calibration.xml]
inputs:
polarization:
inputBinding:
position: 1
prefix: -PselPol=
separate: false
type: string
safe:
inputBinding:
position: 2
prefix: -PinFile=
separate: false
type: Directory
outputs:
results:
outputBinding:
glob: .
type: Directory
stderr: std.err
stdout: std.out
cwlVersion: v1.0
|
The baseCommand
is updated to add the calibration.xml
argument:
| </graph>
baseCommand: [gpt, calibration.xml]
inputs:
|
The Workflow is updated accordingly:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 | $graph:
- class: Workflow
id: main
doc: SNAP Sentinel-1 GRD Calibration
label: SNAP Sentinel-1 GRD Calibration
inputs:
polarization:
doc: Polarization channel
label: Polarization channel
type: string
safe:
doc: Sentinel-1 GRD product SAFE Directory
label: Sentinel-1 GRD product SAFE Directory
type: Directory
outputs:
- id: wf_outputs
outputSource:
- node_1/results
type: Directory
requirements:
SubworkflowFeatureRequirement: {}
steps:
node_1:
in:
snap_graph: snap_graph
polarization: polarization
out:
- results
run: '#sar-calibration'
- class: CommandLineTool
id: sar-calibration
requirements:
DockerRequirement:
dockerPull: snap-gpt
EnvVarRequirement:
envDef:
PATH: /srv/conda/envs/env_snap/snap/bin:/usr/share/java/maven/bin:/usr/share/java/maven/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
ResourceRequirement: {}
InitialWorkDirRequirement:
listing:
- entryname: calibration.xml
entry: |-
<graph id="Graph">
<version>1.0</version>
<node id="Read">
<operator>Read</operator>
<sources/>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<file>${inFile}</file>
<formatName>SENTINEL-1</formatName>
</parameters>
</node>
<node id="Calibration">
<operator>Calibration</operator>
<sources>
<sourceProduct refid="Read"/>
</sources>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<sourceBands/>
<auxFile>Product Auxiliary File</auxFile>
<externalAuxFile/>
<outputImageInComplex>false</outputImageInComplex>
<outputImageScaleInDb>false</outputImageScaleInDb>
<createGammaBand>false</createGammaBand>
<createBetaBand>false</createBetaBand>
<selectedPolarisations>${selPol}</selectedPolarisations>
<outputSigmaBand>true</outputSigmaBand>
<outputGammaBand>false</outputGammaBand>
<outputBetaBand>false</outputBetaBand>
</parameters>
</node>
<node id="Write">
<operator>Write</operator>
<sources>
<sourceProduct refid="Calibration"/>
</sources>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<file>./cal.dim</file>
<formatName>BEAM-DIMAP</formatName>
</parameters>
</node>
</graph>
baseCommand: [gpt, calibration.xml]
inputs:
polarization:
inputBinding:
position: 2
prefix: -PselPol=
separate: false
type: string
safe:
inputBinding:
position: 2
prefix: -PinFile=
separate: false
type: Directory
outputs:
results:
outputBinding:
glob: .
type: Directory
stderr: std.err
stdout: std.out
cwlVersion: v1.0
|