view comparison_div.xml @ 0:fbffdeefb146 draft

Uploaded
author ecology
date Sun, 08 Jan 2023 23:03:35 +0000
parents
children
line wrap: on
line source

<tool id="srs_process_data" name="Compare diversity indicators" version="@VERSION@" profile="20.01">
    <description>with remote sensing data</description>
    <macros>
        <import>macro.xml</import>
    </macros>
    <expand macro="SRS_requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        #import re 
        #if $method.type == '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__/comparison_div.r'
             #if $method.type == 'envi_bil':
              '$input_raster_identifier' 
              '$input_header_identifier'
              ''
            #else:
              ''
              ''
              '$method.input'
            #end if
            '$input_plot'
            '$choice'
            '$__tool_directory__/functions.r'
            '$typepca'
            '$output_div'
            '$output_beta'
            '$plots'
        ]]>
    </command>
    <inputs>
        <conditional name="method">
            <param name="type" 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="input_plot" type="data" format="data" label="Plots folder zip"/>
        <param name="choice" type="select" label="Do you want to compute beta diversity (needs mutliple locations) ?" display="radio">
            <option value="Y">Yes</option>
            <option value="N">No</option>
        </param>
        <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>
    </inputs>
    <outputs>
        <data name="output_div" from_work_dir="Diversity.tabular" format="tabular" label="Global diversity">
        </data>
        <data name="output_beta" from_work_dir="BrayCurtis.tabular" format="tabular" label="Bray Curtis">
            <filter>choice == 'Y'</filter>
        </data>
        <collection type="list" name="plots" label="Comparison plot">
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.png" visible="false" format="png"/>
            <filter>choice =='Y'</filter>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="type" value="envi_bil"/>
            <param name="input_raster" value="S2A_Subset"/>
            <param name="input_header" value="S2A_Subset.hdr"/>
            <param name="input_plot" value="S2A_T33NUD_Plots.zip"/>
            <param name="choice" value="Y"/>
            <output name="output_div">
                <assert_contents>
                    <has_n_lines n="25"/>
                </assert_contents>
            </output>
            <output name="output_beta">
                <assert_contents>
                    <has_n_lines n="25"/>
                </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 compute diversity indices over each spatial polygon of a shapefile of plots, if available, in order to compare field inventories with diversity indices estimated from remotely-sensed 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 |  Shapefiles  |
+==============+==========+==============+
| raster stack | Metadata |  plots.zip   |
+--------------+----------+--------------+
|      ...     |    ...   |      ...     |
+--------------+----------+--------------+

**Output**

- Two tabulars : 
    - One matrix for Bray-Curtis indicator
    - One table for the following indicators; Species richness, shannon, fisher, simpson, richness, eveness, divergence

- One comparison png plot in the Pcoa space that summarizes α- and β-diversity in scatterplots and illustrates that the combination of the three components computed with PCoA allows proper differentiation among vegetation types:
    - PCoA#1 allows differentiating medium and high diversity forests from low diversity forest and low vegetation, but does not discriminate medium and high diversity forests.
    - PCoA#2 allows differentiating low diversity forest from medium/high diversity forests and low vegetation
    - PCoA#3 allows differentiating medium diversity forests from high diversity forests and low vegetation.

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