diff xarray_mapplot.xml @ 1:65621a6c85e9 draft

"planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit 2166974df82f97557b082a9e55135098e61640c4"
author ecology
date Thu, 20 Jan 2022 17:05:20 +0000
parents 85ef700693ef
children adc0367f7cb1
line wrap: on
line diff
--- a/xarray_mapplot.xml	Sun Jun 06 08:47:59 2021 +0000
+++ b/xarray_mapplot.xml	Thu Jan 20 17:05:20 2022 +0000
@@ -1,195 +1,182 @@
-<tool id="xarray_mapplot" name="NetCDF xarray map plotting" profile="20.05" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
-    <description>Visualize netCDF variables on a geographical map</description>
-    <macros>
-        <import>macros.xml</import>
-    </macros>
-    <expand macro="edam_ontology"/>
-    <requirements>
-        <requirement type="package" version="3">python</requirement>
-        <requirement type="package" version="1.5.6">netcdf4</requirement>
-        <requirement type="package" version="@TOOL_VERSION@">xarray</requirement>
-        <requirement type="package" version="0.19.0">cartopy</requirement>
-        <requirement type="package" version="3.4.2">matplotlib</requirement>
-        <requirement type="package" version="1.2">cmcrameri</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'
-    #if $condi_datetime.datetime=="yes"
-         --time="$condi_datetime.time_values"
-    #end if
-         --latitude='$lat_dim'
-         --longitude='$lon_dim'
-    #if $colorbar_label
-         --label='$colorbar_label'
-    #end if
-    #if $title
-         --title=$title
-    #end if
-    #if $cmap
-         --cmap='$cmap'
-    #end if
-    #if $proj
-         --proj='$proj'
-    #end if
-    #if $land
-         --land='$land'
-    #end if
-    #if $ocean
-         --ocean='$ocean'
-    #end if
-    #if $coastline
-         --coastline='$coastline'
-    #end if
-    #if $borders
-         --borders='$borders'
-    #end if
-    #if $threshold
-         --threshold='$threshold'
-    #end if
-    #if $range
-         --range='$range'
-    #end if
-    #if $xlim
-         --xlim='$xlim'
-    #end if
-    #if $ylim
-         --ylim='$ylim'
-    #end if
-    #if $shift
-         --shift
-    #end if
-         --output plot.png
-         --verbose &&
-    mv *.png output_dir
-    ]]></command>
-    <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"  optional="true" 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 abd 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>
-    </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>
+<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.5.6">netcdf4</requirement>
+        <requirement type="package" version="0.19.0">cartopy</requirement>
+        <requirement type="package" version="3.4.2">matplotlib</requirement>
+        <requirement type="package" version="1.2">cmcrameri</requirement>
+        <requirement type="package" version="2021.12.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>