-
Notifications
You must be signed in to change notification settings - Fork 1
/
srs_cloud.xml
108 lines (93 loc) · 4.21 KB
/
srs_cloud.xml
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
<tool id="srs_cloud_mask" name="Cloud mask" version="@VERSION@" profile = "20.01">
<description>from remote sensing data</description>
<macros>
<import>macro.xml</import>
</macros>
<expand macro="SRS_requirements">
<requirement type="package" version="3.99_0.9">r-xml</requirement>
</expand>
<command detect_errors="exit_code"><![CDATA[
#import re
#if $method.origin == 'envi_bil':
#set input_raster = $method.input_raster
#set input_raster_identifier = re.sub('[^\s\w\-]', '_', str($input_raster.element_identifier))
#set input_header = $method.input_header
#set input_header_identifier = re.sub('[^\s\w\-]+[^.hdr]', '_', str($input_header.element_identifier))
ln '${input_raster}' '${input_raster_identifier}' &&
ln '${input_header}' '${input_header_identifier}' &&
#end if
Rscript
'$__tool_directory__/srs_cloud.r'
#if $method.origin == 'envi_bil':
'$input_raster_identifier'
'$input_header_identifier'
''
#else:
''
''
'$method.input'
#end if
'$__tool_directory__/functions.r'
'$output_cloud'
'$plots'
]]>
</command>
<inputs>
<conditional name="method">
<param name="origin" type="select" label="In which format are your data ?">
<option value="zipper">The data you are using are in a zip folder Cloud Mask</option>
<option value="envi_bil">Your already have the files in ENVI BIL format</option>
</param>
<when value="zipper">
<param name="input" type="data" format="zip" multiple="true" label="Input data"/>
</when>
<when value="envi_bil">
<param name="input_raster" type="data" format="bil" label="Input raster" help="It can be the raw data in bil or the PCA raster layer in bil"/>
<param name="input_header" type="data" format="hdr" label="Input header"/>
</when>
</conditional>
<!--<param name="typepca" type="character" label="Do you want to do a PCA or a SPCA ?" display="radio" help="If you choose PCA there is no rescaling of the data as oppposed as if you choose SPCA"/>-->
</inputs>
<outputs>
<data name="output_cloud" from_work_dir="cloud.tabular" format="tabular" label="Cloud mask tabular"/>
<collection type="list" name="plots" label="Cloud plot">
<discover_datasets pattern="(?P<designation>.+)\.png" visible="false" format="png"/>
</collection>
</outputs>
<tests>
<test>
<param name="origin" value="envi_bil"/>
<param name="input_raster" value="S2A_Subset"/>
<param name="input_header" value="S2A_Subset.hdr"/>
<param name="type" value="all"/>
<output name="output_cloud">
<assert_contents>
<has_n_columns n="3"/>
</assert_contents>
</output>
<output_collection name="plots" type="list" count="3"/>
</test>
</tests>
<help><![CDATA[
========================================================================
Calculate cloud mask from envi bil format
========================================================================
**What it does**
**Input description**
It expects an image file as input, with a specific data format. ENVI HDR image with BIL interleave required.
The image is an ENVI raster including :
- A binary file (which has no extension here).
- A header file (with .hdr extension).
The header file is a text file including all necessary metadata which can be read with a text editor. It includes image dimensions, projection, and the name and central wavelength for each spectral band.
In order to get such input we advise to use the tool preprocessing sentinel 2 data.
+--------------+----------+
| BIL | ENVI HDR |
+==============+==========+
| raster stack | Metadata |
+--------------+----------+
| ... | ... |
+--------------+----------+
**Output**
]]> </help>
<expand macro="SRS_BDMRref"/>
</tool>