view alpha_beta.xml @ 0:9adccd3da70c draft default tip

planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
author ecology
date Mon, 09 Jan 2023 13:37:37 +0000
parents
children
line wrap: on
line source

<tool id="srs_diversity_maps" name="Map diversity" version="@VERSION@" profile="20.01">
    <description>from remote sensing data</description>
    <macros>
        <import>macro.xml</import>
    </macros>
    <expand macro="SRS_requirements">
    </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)) 
          cp '${input_raster}' '${input_raster_identifier}' &&
          cp '${input_header}' '${input_header_identifier}' &&
        #end if
        Rscript
            '$__tool_directory__/alpha_beta.r'
             #if $method.origin == 'envi_bil':
              '$input_raster_identifier' 
              '$input_header_identifier'
              ''
            #else:
              ''
              ''
              '$method.input'
            #end if
            '$typepca'
            #if $type == 'alpha':
              'TRUE'
              'FALSE'
              'FALSE'
              'FALSE'
            #else if $type == 'beta':
              'FALSE'
              'TRUE'
              'FALSE'
              'FALSE'
            #else if $type == 'funct':
              'FALSE'
              'FALSE'
              'TRUE'
              'FALSE'
            #else:
              'FALSE'
              'FALSE'
              'FALSE'
              'TRUE'
            #end if
            \${GALAXY_SLOTS:-1}
            '$__tool_directory__/functions.r'
            '$output_alpha'
            '$output_beta'
            '$output_funct'
            '$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 Reflectance</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="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">
            <option value="SPCA">SPCA</option>
            <option value="PCA">PCA</option>
        </param>
        <param name="type" type="select" label="Alpha, beta, functional diversity and comparison plot and map" display="radio">
            <option value="alpha">Alpha diversity map</option>
            <option value="beta">Beta diversity map</option>
            <option value="funct">Functional diversity map</option>
            <option value="all">All of the above</option>
        </param>
    </inputs>
    <outputs>
        <data name="output_alpha" from_work_dir="alpha.tabular" format="tabular" label="Alpha diversity">
            <filter> type == 'alpha' or  type == 'all'</filter>
        </data>
        <data name="output_beta" from_work_dir="beta.tabular" format="tabular" label="Beta diversity">
            <filter> type == 'beta' or  type == 'all'</filter>
        </data>
        <data name="output_funct" from_work_dir="Functionnal.tabular" format="tabular" label="Functionnal diversity">
            <filter> type == 'funct' or  type == 'all'</filter>
        </data>
        <collection type="list" name="plots" label="${type} plot">
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.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="alpha"/>
            <output name="output_alpha">
                <assert_contents>
                    <has_n_columns n="3"/>
                </assert_contents>
            </output>
            <output_collection name="plots" type="list" count="1"/>
        </test>
    </tests>
    <help><![CDATA[
========================================================================
Process satellite remote sensing data to produce biodiversity indicators
========================================================================


**What it does**

FĂ©ret and Asner (2014) developed a method for **tropical forest** diversity mapping based on very high spatial resolution airborne imaging spectroscopy.

The goal of this tool using the package biodivMapR is to produce (spectral) diversity maps based on (optical) images.

**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**

- Three tabulars : alpha, beta, functionnal each of them with 3 colomns latitude, longitude and the indice.

- Three png graph for each indice 

    ]]></help>
    <expand macro="SRS_BDMRref"/>
</tool>