Mercurial > repos > ecology > srs_pca
comparison pca_raster.xml @ 0:79bcb8c6dff0 draft
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
author | ecology |
---|---|
date | Mon, 09 Jan 2023 13:55:34 +0000 |
parents | |
children | 9300a492b634 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:79bcb8c6dff0 |
---|---|
1 <tool id="srs_pca" name="Compute a PCA raster" version="@VERSION@" profile = "20.01"> | |
2 <description>from remote sensing data</description> | |
3 <macros> | |
4 <import>macro.xml</import> | |
5 </macros> | |
6 <expand macro="SRS_requirements"/> | |
7 <command detect_errors="exit_code"><![CDATA[ | |
8 #import re | |
9 #if $method.origin == 'envi_bil': | |
10 #set input_raster = $method.input_raster | |
11 #set input_raster_identifier = re.sub('[^\s\w\-]', '_', str($input_raster.element_identifier)) | |
12 #set input_header = $method.input_header | |
13 #set input_header_identifier = re.sub('[^\s\w\-]+[^.hdr]', '_', str($input_header.element_identifier)) | |
14 cp '${input_raster}' '${input_raster_identifier}' && | |
15 cp '${input_header}' '${input_header_identifier}' && | |
16 #end if | |
17 Rscript | |
18 '$__tool_directory__/pca_raster.r' | |
19 #if $method.origin == 'envi_bil': | |
20 '$input_raster_identifier' | |
21 '$input_header_identifier' | |
22 '' | |
23 #else: | |
24 '' | |
25 '' | |
26 '$method.input' | |
27 #end if | |
28 '$type' | |
29 '$__tool_directory__/functions.r' | |
30 '$output_raster' | |
31 '$output_pca' | |
32 '$plots' | |
33 ]]> | |
34 </command> | |
35 <inputs> | |
36 <conditional name="method"> | |
37 <param name="origin" type="select" label="In which format are your data ?"> | |
38 <option value="zipper">The data you are using are in a zip folder Reflectance</option> | |
39 <option value="envi_bil">Your already have the files ENVI BIL</option> | |
40 </param> | |
41 <when value="zipper"> | |
42 <param name="input" type="data" format="zip" multiple="true" label="Input data"/> | |
43 </when> | |
44 <when value="envi_bil"> | |
45 <param name="input_raster" type="data" format="bil" label="Input raster"/> | |
46 <param name="input_header" type="data" format="hdr" label="Input raster header"/> | |
47 </when> | |
48 </conditional> | |
49 <param name="type" type="select" 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"> | |
50 <option value="SPCA">SPCA</option> | |
51 <option value="PCA">PCA</option> | |
52 </param> | |
53 </inputs> | |
54 <outputs> | |
55 <collection type="list" name="output_raster" label="PCA raster"> | |
56 <discover_datasets pattern="(?P<designation>.+)" directory="RESULTS/" visible="false" recurse="true" format="bil,hdr"/> | |
57 </collection> | |
58 <data name="output_pca" from_work_dir="PCA.tabular" format="tabular" label="PCA tabular"/> | |
59 <collection type="list" name="plots" label="PCA plot"> | |
60 <discover_datasets pattern="(?P<designation>.+)\.png" visible="false" format="png"/> | |
61 </collection> | |
62 </outputs> | |
63 <tests> | |
64 <test> | |
65 <param name="origin" value="envi_bil"/> | |
66 <param name="input_raster" value="S2A_Subset"/> | |
67 <param name="input_header" value="S2A_Subset.hdr"/> | |
68 <param name="type" value="PCA"/> | |
69 <output_collection name="output_raster" type="list" count="5"/> | |
70 <output name="output_pca"> | |
71 <assert_contents> | |
72 <has_n_lines n="960435"/> | |
73 </assert_contents> | |
74 </output> | |
75 <output_collection name="plots" type="list" count="1"/> | |
76 </test> | |
77 </tests> | |
78 <help><![CDATA[ | |
79 ======================================================================== | |
80 Process satellite remote sensing data to produce biodiversity indicators | |
81 ======================================================================== | |
82 | |
83 | |
84 **What it does** | |
85 | |
86 Féret and Asner (2014) developed a method for **tropical forest** diversity mapping based on very high spatial resolution airborne imaging spectroscopy. | |
87 | |
88 The goal of this tool using the package biodivMapR is to produce a Principal Components Analysis (PCA) based on (optical) images. Principal component analysis prepares for feature extraction in order to reduce noise in the image. It is performed on a random subset of the image to ensure computational efficiency for large images. | |
89 | |
90 **Input description** | |
91 | |
92 It expects an image file as input, with a specific data format. ENVI HDR image with BIL interleave required. | |
93 The image is an ENVI raster including : | |
94 | |
95 - A binary file (which has no extension here). | |
96 | |
97 - A header file (with .hdr extension). | |
98 | |
99 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. | |
100 | |
101 In order to get such input we advise to use the tool preprocessing sentinel 2 data. | |
102 | |
103 +--------------+----------+ | |
104 | BIL | ENVI HDR | | |
105 +==============+==========+ | |
106 | raster stack | Metadata | | |
107 +--------------+----------+ | |
108 | ... | ... | | |
109 +--------------+----------+ | |
110 | |
111 **Output** | |
112 | |
113 - One tabular with 3 columns : longitude, latitude and pca. | |
114 | |
115 - One png graph. | |
116 | |
117 - One ENVI BIL files with the one file for the bil raster and one file for the hdr header. | |
118 ]]> </help> | |
119 <expand macro="SRS_BDMRref"/> | |
120 </tool> |