comparison xarray_netcdf2netcdf.xml @ 2:e87073edecd6 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:08:29 +0000
parents 1a91e551f3a9
children c91c27b63fb2
comparison
equal deleted inserted replaced
1:1a91e551f3a9 2:e87073edecd6
1 <tool id="xarray_netcdf2netcdf" name="NetCDF xarray operations" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"> 1 <tool id="xarray_netcdf2netcdf" name="NetCDF xarray operations" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>manipulate xarray from netCDF and save back to netCDF</description> 2 <description>manipulate xarray from netCDF and save back to netCDF</description>
3 <macros> 3 <macros>
4 <import>macros.xml</import> 4 <import>macros.xml</import>
5 <import>macros_netcdf2netcdf.xml</import>
6 <import>macros_tests_netcdf2netcdf.xml</import>
5 </macros> 7 </macros>
6 <expand macro="edam_ontology"/> 8 <expand macro="edam_ontology"/>
7 <requirements> 9 <requirements>
10 <requirement type="package" version="@TOOL_VERSION@">xarray</requirement>
8 <requirement type="package" version="3">python</requirement> 11 <requirement type="package" version="3">python</requirement>
9 <requirement type="package" version="1.5.6">netcdf4</requirement> 12 <requirement type="package" version="1.5.8">netcdf4</requirement>
10 <requirement type="package" version="@TOOL_VERSION@">xarray</requirement> 13 <requirement type="package" version="2021.12.0">dask</requirement>
11 </requirements> 14 </requirements>
12 <command detect_errors="exit_code"><![CDATA[ 15 <command detect_errors="exit_code"><![CDATA[
13 mkdir output_dir && 16 mkdir output_dir &&
14 python '$__tool_directory__/xarray_netcdf2netcdf.py' '$input' '$var' 17 python '$__tool_directory__/xarray_netcdf2netcdf.py'
18 '$input'
19 '$variable.var'
15 --filter 20 --filter
16 #for $i,$uc in enumerate($user_choice) 21 #for $i,$uc in enumerate($subset_coords.tsel.user_choice)
17 #if $uc.condi_between.comparator=="sl" 22 #if $uc.condi_between.comparator == "sl"
18 '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.t1}#${uc.condi_between.t2}' 23 '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.t1}#${uc.condi_between.t2}'
24 #elif $subset_coords.tsel.by_click == "sel" and $uc.condi_between.method != 'None'
25 '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.value}#${uc.condi_between.method}'
19 #else 26 #else
20 '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.value}' 27 '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.value}'
21 #end if 28 #end if
22 #end for 29 #end for
23 #if $scale 30 #if $subset_coords.tsel.by_click == "sel"
24 --scale '$scale' 31 --selection
25 #end if 32 #end if
26 #if $write_all 33 #if $variable.scale
34 --scale '$variable.scale'
35 #end if
36 #if ($variable.write_all) or (str($variable.var) == 'None')
27 --write_all 37 --write_all
38 #end if
39 #if $variable.keep_attributes
40 --keep_attributes
41 #end if
42 #if str($mask_values.mask_condi.mask_option) == 'drop'
43 --drop
44 #elif str($mask_values.mask_condi.mask_option) == 'other'
45 --other '$mask_values.mask_condi.set_other'
46 #end if
47 #if str($mask_values.where_condition) != ""
48 --where '$mask_values.where_condition'
28 #end if 49 #end if
29 --verbose 50 --verbose
30 --output '$output_netcdf' 51 --output '$output_netcdf'
31 ]]></command> 52 ]]> </command>
32 <inputs> 53 <inputs>
33 <param type="data" name="input" label="Input netcdf file" format="netcdf"/> 54 <param type="data" name="input" multiple="true" min="1" label="Input netcdf file" format="netcdf"/>
34 <param type="data" label="Tabular of variables" name="var_tab" format="tabular" help="Select the tabular file which summarize the available variables and dimensions."/> 55 <param type="data" label="Metadata Infos" name="var_tab" format="tabular" help="Select the tabular file which summarize the available variables and dimensions."/>
35 56 <expand macro="section_variables"/>
36 <param name="var" type="select" label="Choose the variable to extract"> 57 <expand macro="section_coords"/>
37 <options from_dataset="var_tab"> 58 <expand macro="section_where"/>
38 <column name="name" index="0"/>
39 <column name="value" index="0"/>
40 </options>
41 </param>
42
43 <repeat name="user_choice" title="additional filter" min="0" max="20" help="Use this option to filter on the selected dataset">
44 <param name="dim" type="select" label="Dimensions">
45 <options from_dataset="var_tab">
46 <column name="value" index="0"/>
47 </options>
48 </param>
49 <param type="data" label="Tabular containing values of this dimension" name="dim_tab" format="tabular" help="File containing values for this dimension."/>
50 <conditional name="condi_between">
51 <param name="comparator" type="select" label="Comparator">
52 <option value="is">is</option>
53 <option value="from">from</option>
54 <option value="to">to</option>
55 <option value="sl">slice(threshold1,threshold2)</option>
56 </param>
57 <when value="sl">
58 <param name="t1" type="select" multiple="false" label="Choose the start value for slice">
59 <options from_dataset="dim_tab">
60 <column name="name" index="1"/>
61 <column name="value" index="0"/>
62 </options>
63 </param>
64 <param name="t2" type="select" multiple="false" label="Choose the end value for slice">
65 <options from_dataset="dim_tab">
66 <column name="name" index="1"/>
67 <column name="value" index="0"/>
68 </options>
69 </param>
70 </when>
71 <when value="is">
72 <param name="value" type="select" multiple="false" label="Choose the value to select">
73 <options from_dataset="dim_tab">
74 <column name="name" index="1"/>
75 <column name="value" index="0"/>
76 </options>
77 </param>
78 </when>
79 <when value="to">
80 <param name="value" type="select" multiple="false" label="Choose the end value">
81 <options from_dataset="dim_tab">
82 <column name="name" index="1"/>
83 <column name="value" index="0"/>
84 </options>
85 </param>
86 </when>
87 <when value="from">
88 <param name="value" type="select" multiple="false" label="Choose the start value">
89 <options from_dataset="dim_tab">
90 <column name="name" index="1"/>
91 <column name="value" index="0"/>
92 </options>
93 </param>
94 </when>
95 </conditional>
96 </repeat>
97 <param type="float" name="scale" optional="true" help="scale factor (float) to apply to selection (optional)"/>
98
99 <param name="write_all" type="boolean" value="false" label="Write all variables to new netCDF file"/>
100 </inputs> 59 </inputs>
101 <outputs> 60 <outputs>
102 <data name="output_netcdf" format="netcdf"/> 61 <data name="output_netcdf" format="netcdf"/>
103 </outputs> 62 </outputs>
104 <tests> 63 <expand macro="section_tests"/>
105 <test>
106 <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/>
107 <param name="var_tab" value="var_tab_dataset-ibi"/>
108 <param name="var" value="chl"/>
109 <repeat name="user_choice">
110 <param name="dim" value="time"/>
111 <conditional name="condi_between">
112 <param name="comparator" value="sl"/>
113 <param name="t1" value="10"/>
114 <param name="t2" value="12"/>
115 </conditional>
116 </repeat>
117 <repeat name="user_choice">
118 <param name="dim" value="latitude"/>
119 <param name="dim_tab" value="latitude.tabular"/>
120 <conditional name="condi_between">
121 <param name="comparator" value="sl"/>
122 <param name="t1" value="5"/>
123 <param name="t2" value="10"/>
124 </conditional>
125 </repeat>
126 <repeat name="user_choice">
127 <param name="dim" value="longitude"/>
128 <param name="dim_tab" value="longitude.tabular"/>
129 <conditional name="condi_between">
130 <param name="comparator" value="sl"/>
131 <param name="t1" value="4"/>
132 <param name="t2" value="10"/>
133 </conditional>
134 </repeat>
135 <param name="scale" value="1000.5"/>
136 <output name="output_netcdf" file="small.netcdf" compare="sim_size" delta="1000"/>
137 </test>
138 <test>
139 <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/>
140 <param name="var_tab" value="var_tab_dataset-ibi"/>
141 <param name="var" value="chl"/>
142 <repeat name="user_choice">
143 <param name="dim" value="time"/>
144 <conditional name="condi_between">
145 <param name="comparator" value="sl"/>
146 <param name="t1" value="10"/>
147 <param name="t2" value="12"/>
148 </conditional>
149 </repeat>
150 <repeat name="user_choice">
151 <param name="dim" value="latitude"/>
152 <param name="dim_tab" value="latitude.tabular"/>
153 <conditional name="condi_between">
154 <param name="comparator" value="sl"/>
155 <param name="t1" value="5"/>
156 <param name="t2" value="10"/>
157 </conditional>
158 </repeat>
159 <repeat name="user_choice">
160 <param name="dim" value="longitude"/>
161 <param name="dim_tab" value="longitude.tabular"/>
162 <conditional name="condi_between">
163 <param name="comparator" value="sl"/>
164 <param name="t1" value="4"/>
165 <param name="t2" value="10"/>
166 </conditional>
167 </repeat>
168 <param name="scale" value="1000.5"/>
169 <param name="write_all" value="Yes"/>
170 <output name="output_netcdf" file="all.netcdf" compare="sim_size" delta="1000"/>
171 </test>
172 </tests>
173 <help><![CDATA[ 64 <help><![CDATA[
174 **What it does** 65 **What it does**
175 66
176 Select a variable ans can restrict over any of its dimension and apply a scaling (1 by default). 67 Select a variable ans can restrict over any of its dimension and apply a scaling (1 by default).
177 the result is stored in a new netCDF file. 68 the result is stored in a new netCDF file.
183 74
184 75
185 ------------------------------------------------- 76 -------------------------------------------------
186 77
187 The xarray select tool can be used after the xarray Info and xarray Coord. 78 The xarray select tool can be used after the xarray Info and xarray Coord.
188 ]]></help> 79 ]]> </help>
189 <expand macro="citations"/> 80 <expand macro="citations"/>
190 </tool> 81 </tool>