view xarray_mapplot.xml @ 2:506b6d6880ff draft default tip

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
author ecology
date Sun, 31 Jul 2022 21:22:41 +0000
parents dc05bf0af58f
children
line wrap: on
line source

<tool id="xarray_mapplot" name="NetCDF xarray map plotting" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>Visualize netCDF variables on a geographical map</description>
    <macros>
        <import>macros.xml</import>
        <import>macros_mapplot.xml</import>
    </macros>
    <expand macro="edam_ontology"/>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">xarray</requirement>
        <requirement type="package" version="3">python</requirement>
        <requirement type="package" version="1.6.0">netcdf4</requirement>
        <requirement type="package" version="0.20.3">cartopy</requirement>
        <requirement type="package" version="3.5.2">matplotlib</requirement>
        <requirement type="package" version="1.4">cmcrameri</requirement>
        <requirement type="package" version="2022.7.0">dask</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
    mkdir output_dir &&
    mkdir -p `pwd`/mlp_tmpdir &&
    MPLCONFIGDIR=`pwd`/mlp_tmpdir &&
    echo "Galaxy xarray version @TOOL_VERSION@" > $version &&
    python '$__tool_directory__/xarray_mapplot.py' '$input' '$var'
    --config '$map_customization' --proj '$map_projection'
    #if $shift
         --shift
    #end if
         --output plot.png
         --verbose &&
    mv *.png output_dir
    ]]></command>
    <expand macro="config_map"/>
    <inputs>
        <param type="data" name="input" label="Input netcdf file" format="netcdf"/>
        <param type="data" label="Tabular of variables" name="var_tab" format="tabular" help="Select the tabular file which summarize the available variables and dimensions."/>
        <param name="var" type="select" label="Choose the variable to plot">
            <options from_dataset="var_tab">
                <column name="name" index="0"/>
                <column name="value" index="0"/>
            </options>
        </param>
        <param name="lat_dim" type="select" label="Name of latitude coordinate" >
            <options from_dataset="var_tab">
                <column name="value" index="0"/>
            </options>
        </param>
        <param name="lon_dim" type="select" label="Name of longitude coordinate" >
            <options from_dataset="var_tab">
                <column name="value" index="0"/>
            </options>
        </param>
        <conditional name="condi_datetime">
            <param name="datetime" type="select" label="Datetime selection" help="Use this option when your dataset contains multiple times/dates">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </param>
            <when value="no"></when>
            <when value="yes">
                <param type="data" label="Tabular of time values" name="time_tab" format="tabular" help="File containing time values."/>
                <param name="time_values" type="select" multiple="true" label="Choose the times to plot">
                    <options from_dataset="time_tab">
                        <column name="name" index="1"/>
                        <column name="value" index="0"/>
                    </options>
                </param>
            </when>
       </conditional>
        <param name="xlim" type="text" optional="true" label="longitudes values 'lonW,lonE' for limited geographical area (optional and only available with some projections)" />
        <param name="ylim" type="text" value=""  optional="true" label="latitudes values 'latS,latN' for limited geographical area (optional and only available with some projections)" />
        <param name="shift" type="select"  display="radio" label="Shift longitudes [0,360] --> [-180,180]"> 
             <option value="" selected="true">No</option>
             <option value="Yes">Yes</option>
        </param>
        <param name="range" type="text" optional="true" label="Range of values for plotting e.g. minimum value and maximum value (minval,maxval) (optional)" />
        <param name="threshold" type="float"  optional="true" label="Do not plot values below this threshold (optional)" />
        <expand macro="customize_appearance_plots" />
        <param name="proj" type="text" optional="true" label='Specify the projection (proj4) on which we draw e.g. {"proj":"PlateCarree"} with double quote (optional)'>
            <sanitizer>
                <valid initial="string.ascii_letters,string.digits,string.punctuation,string.whitespace">
                    <add value="{" />
                    <add value="}" />
                </valid>
            </sanitizer>
        </param>

    </inputs>
    <outputs>
        <data name="version" format="tabular" label="Tool version"/>
        <collection type="list" name="output_dir" label="Map plots">
            <discover_datasets pattern="__name_and_ext__" directory="output_dir"/>
        </collection>
    </outputs>
    <tests>
        <test>
             <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/>
             <param name="var" value="nh4"/>
             <param name="var_tab" value="var_tab_dataset-ibi"/>
             <param name="lat_dim" value="latitude"/>
             <param name="lon_dim" value="longitude"/>
             <conditional name="condi_datetime">
                 <param name="datetime" value="yes"/>
                 <param name="time_tab" value="time.tabular"/>
                 <param name="time_values" value="50"/>
             </conditional>
             <param name="cmap" value="cm.devon_r"/>   
             <param name="proj" value='{"proj":"PlateCarree"}'/>    
             <param name="land" value="0.1"/>                         
             <param name="ocean" value="0.1"/>                         
             <param name="coastline" value="0.2"/>                         
             <param name="borders" value="0.5"/>                         
             <output_collection name="output_dir" type="list" count="1">
                 <element name="plot_time50" ftype='png' file="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133_time50.png"/>
             </output_collection>
             <output name="version" ftype='tabular' file="version.tabular"/>
        </test>
        <test>
             <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/>
             <param name="var" value="chl"/>
             <param name="var_tab" value="var_tab_dataset-ibi"/>
             <param name="lat_dim" value="latitude"/>
             <param name="lon_dim" value="longitude"/>
             <conditional name="condi_datetime">
                 <param name="datetime" value="yes"/>
                 <param name="time_tab" value="time.tabular"/>
                 <param name="time_values" value="0,1"/>
             </conditional>
             <param name="cmap" value="Greens"/>   
             <param name="proj" value='{"proj":"PlateCarree"}'/>    
             <param name="land" value="0.1"/>                         
             <param name="ocean" value="0.1"/>                         
             <param name="coastline" value="0.2"/>                         
             <param name="borders" value="0.5"/>                         
             <output_collection name="output_dir" type="list" count="2">
                 <element name="plot_time0" ftype="png" file="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133_time0.png"/>
                 <element name="plot_time1" ftype="png" file="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133_time1.png"/>
             </output_collection>
             <output name="version" ftype="tabular" file="version.tabular"/>
        </test>
        <test>
             <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/>
             <param name="var" value="chl"/>
             <param name="var_tab" value="var_tab_dataset-ibi"/>
             <param name="lat_dim" value="latitude"/>
             <param name="lon_dim" value="longitude"/>
             <conditional name="condi_datetime">
                 <param name="datetime" value="yes"/>
                 <param name="time_tab" value="time.tabular"/>
                 <param name="time_values" value="0"/>
             </conditional>
             <param name="cmap" value="vik_r"/>   
             <param name="proj" value='{"proj":"EquidistantConic", "central_longitude": 20.0, "central_latitude": 70.0 }'/>    
             <param name="land" value="0.1"/>                         
             <param name="ocean" value="0.1"/>                         
             <param name="coastline" value="0.2"/>                         
             <param name="borders" value="0.5"/>                       
             <param name="title" value="Xarray map test"/>   
             <param name="colorbar_label" value="My personal label (X)" />                     
             <output_collection name="output_dir" type="list" count="1">
                 <element name="plot_time0" ftype="png" file="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133_time0_title.png"/>
             </output_collection>
             <output name="version" ftype="tabular" file="version.tabular"/>
        </test>
    </tests>
    <help><![CDATA[
**What it does**

This tool plots a variable on a geographical map. It must be a 2D variable (latitude, longitude) and eventually with 
and additional time dimension (specific time to plot should then be selected).

The appearance of plots can be customized with options as well at the projection. 
The projection needs to be given as a PROJ dictionary such as:
- {"proj":"EquidistantConic", "central_longitude": 20.0, "central_latitude": 70.0 }
- {"proj":"AlbersEqualArea", "central_longitude": 20.0, "central_latitude": 70.0 }
- {"proj":"EuroPP"}

The output is a collection of plots (png format); one per selected times.

-------------------------------------------------

The xarray select tool can be used after the xarray Info and xarray coord.
    ]]></help>
    <expand macro="citations"/>
</tool>