Mercurial > repos > climate > cdo_operations
comparison cdo_operations.xml @ 0:26eb6b5443c1 draft default tip
"planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/cdo commit da614bb8e3e9b19a5167ff19b625a71d9976108a"
| author | climate |
|---|---|
| date | Sat, 15 Jan 2022 23:19:24 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:26eb6b5443c1 |
|---|---|
| 1 <tool id="cdo_operations" name="CDO Operations" profile="20.05" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"> | |
| 2 <description>Climate Data Manipulation Operators operations for standard processing of climate and NWP model output.</description> | |
| 3 <macros> | |
| 4 <import>macros.xml</import> | |
| 5 <import>macros_operations.xml</import> | |
| 6 </macros> | |
| 7 <expand macro="edam_ontology"/> | |
| 8 <expand macro="cdo_requirements"/> | |
| 9 <expand macro="cdo_stdio"/> | |
| 10 <command detect_errors="exit_code"><![CDATA[ | |
| 11 mkdir output_dir && | |
| 12 cdo | |
| 13 #for $i, $cdo_option in enumerate( $section_option ) | |
| 14 #if $cdo_option.option_type.add_opt == '-f' | |
| 15 $cdo_option.option_type.add_opt $cdo_option.option_type.output_format | |
| 16 #elif $cdo_option.option_type.add_opt == '-g' | |
| 17 $cdo_option.option_type.add_opt $cdo_option.option_type.grid | |
| 18 #elif $cdo_option.option_type.add_opt == '-gf' | |
| 19 $cdo_option.option_type.add_opt $cdo_option.option_type.gridfile | |
| 20 #elif $cdo_option.option_type.add_opt == '-m' | |
| 21 $cdo_option.option_type.add_opt $cdo_option.option_type.missval | |
| 22 #elif $cdo_option.option_type.add_opt == '--percentile' | |
| 23 $cdo_option.option_type.add_opt $cdo_option.option_type.percentile | |
| 24 #elif $cdo_option.option_type.add_opt == '--seed' | |
| 25 $cdo_option.option_type.add_opt $cdo_option.option_type.seed | |
| 26 #else | |
| 27 $cdo_option.option_type.add_opt | |
| 28 #end if | |
| 29 #end for | |
| 30 #for $i, $cdo_oper in enumerate( $section_operators ) | |
| 31 #if $cdo_oper.operator.opt == 'duplicate' | |
| 32 -'$cdo_oper.operator.opt',$cdo_oper.operator.ndup | |
| 33 #elif $cdo_oper.operator.opt == 'addc' or $cdo_oper.operator.opt == 'subc' or $cdo_oper.operator.opt == 'mulc' or $cdo_oper.operator.opt == 'divc' | |
| 34 -'$cdo_oper.operator.opt',$cdo_oper.operator.const_value | |
| 35 #elif $cdo_oper.operator.opt == 'ens' or $cdo_oper.operator.opt == 'zon' or $cdo_oper.operator.opt == 'tim' or $cdo_oper.operator.opt == 'vert' or $cdo_oper.operator.opt == 'day' or $cdo_oper.operator.opt == 'year' or $cdo_oper.operator.opt == 'mon' or $cdo_oper.operator.opt == 'seas' or $cdo_oper.operator.opt == 'fld' | |
| 36 -'${cdo_oper.operator.opt}${cdo_oper.operator.stat}' | |
| 37 #elif $cdo_oper.operator.opt == 'sp2gp' or $cdo_oper.operator.opt == 'gp2sp' | |
| 38 #if $cdo_oper.operator.trunc > 0 | |
| 39 -'$cdo_oper.operator.opt',$cdo_oper.operator.trunc | |
| 40 #else | |
| 41 -'$cdo_oper.operator.opt' | |
| 42 #end if | |
| 43 #elif $cdo_oper.operator.opt == 'collgrid' | |
| 44 #if str($cdo_oper.operator.nx) | |
| 45 #if str($cdo_oper.operator.names) | |
| 46 -'$cdo_oper.operator.opt',$cdo_oper.operator.nx,'$cdo_oper.operator.names' | |
| 47 #else | |
| 48 -'$cdo_oper.operator.opt',$cdo_oper.operator.nx | |
| 49 #end if | |
| 50 #else | |
| 51 -'$cdo_oper.operator.opt' | |
| 52 #end if | |
| 53 #elif $cdo_oper.operator.opt == 'distgrid' | |
| 54 -'$cdo_oper.operator.opt',$cdo_oper.operator.nx,$cdo_oper.operator.ny | |
| 55 #elif $cdo_oper.operator.opt == 'splitsel' | |
| 56 #if str($cdo_oper.operator.noffset) | |
| 57 #if str($cdo_oper.operator.nskip) | |
| 58 -'$cdo_oper.operator.opt',$cdo_oper.operator.nsets,$cdo_oper.operator.noffset,$cdo_oper.operator.nskip | |
| 59 #else | |
| 60 -'$cdo_oper.operator.opt',$cdo_oper.operator.nsets,$cdo_oper.operator.noffset | |
| 61 #end if | |
| 62 #else | |
| 63 -'$cdo_oper.operator.opt',$cdo_oper.operator.nsets | |
| 64 #end if | |
| 65 #elif $cdo_oper.operator.opt == 'select' or $cdo_oper.operator.opt == 'delete' or $cdo_oper.operator.opt == 'selname' or $cdo_oper.operator.opt == 'delname' or $cdo_oper.operator.opt == 'seltimestep' or $cdo_oper.operator.opt == 'sellonlatbox' or $cdo_oper.operator.opt == 'expr' or $cdo_oper.operator.opt == 'ml2pl' or $cdo_oper.operator.opt == 'ml2hl' or $cdo_oper.operator.opt == 'intlevel' | |
| 66 -'$cdo_oper.operator.opt','$cdo_oper.operator.params' | |
| 67 #elif $cdo_oper.operator.opt == 'setattribute' | |
| 68 -'$cdo_oper.operator.opt',FILE='$cdo_oper.operator.attr_file' | |
| 69 #else | |
| 70 -'$cdo_oper.operator.opt' | |
| 71 #end if | |
| 72 #if $cdo_oper.operator.opt == 'copy' or $cdo_oper.operator.opt == 'cat' or $cdo_oper.operator.opt == 'merge' or $cdo_oper.operator.opt == 'mergetime' or $cdo_oper.operator.opt == 'collgrid' or $cdo_oper.operator.opt == 'select' or $cdo_oper.operator.opt == 'delete' or $cdo_oper.operator.opt == 'replace' | |
| 73 #for $ifile in $cdo_oper.operator.add_file | |
| 74 '${ifile}' | |
| 75 #end for | |
| 76 #elif $cdo_oper.operator.add_file and '$cdo_oper.operator.add_file' != '' and '$cdo_oper.operator.add_file' != 'None' and $cdo_oper.operator.add_file is not None | |
| 77 '$cdo_oper.operator.add_file' | |
| 78 #end if | |
| 79 #if $i == 0 | |
| 80 #if $cdo_oper.operator.opt == 'splitcode' or $cdo_oper.operator.opt == 'splitparam' or $cdo_oper.operator.opt == 'splitname' or $cdo_oper.operator.opt == 'splitlevel' or $cdo_oper.operator.opt == 'splitgrid' or $cdo_oper.operator.opt == 'splitzaxis' or $cdo_oper.operator.opt == 'splittabnum' or $cdo_oper.operator.opt == 'splithour' or $cdo_oper.operator.opt == 'splitday' or $cdo_oper.operator.opt == 'splitseas' or $cdo_oper.operator.opt == 'splityear' or $cdo_oper.operator.opt == 'splityearmon' or $cdo_oper.operator.opt == 'splitmon' | |
| 81 #set output = 'output_dir/outfile_' | |
| 82 #else | |
| 83 #set output = 'output_dir/outfile.netcdf' | |
| 84 #end if | |
| 85 #end if | |
| 86 #end for | |
| 87 '${output}' | |
| 88 ]]> </command> | |
| 89 <inputs> | |
| 90 <repeat name="section_operators" title="CDO Operators" min="1" max="10"> | |
| 91 <expand macro="cdo_operator"/> | |
| 92 </repeat> | |
| 93 <repeat name="section_option" title="CDO Options" min="0" max="5"> | |
| 94 <expand macro="cdo_option"/> | |
| 95 </repeat> | |
| 96 </inputs> | |
| 97 <outputs> | |
| 98 <collection name="output_files" type="list" label="${tool.name} outfiles"> | |
| 99 <discover_datasets pattern="__name__" directory="output_dir" visible="true" format="netcdf"/> | |
| 100 </collection> | |
| 101 </outputs> | |
| 102 <tests> | |
| 103 <test> | |
| 104 <conditional name="operator"> | |
| 105 <param name="opt" value="select" /> | |
| 106 <param name="params" value="name=Drops" /> | |
| 107 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 108 </conditional> | |
| 109 <output_collection name="output_files" type="list" count="1"> | |
| 110 <element name="outfile.netcdf" ftype="netcdf" file="drops1.nc" compare="sim_size" delta="50"/> | |
| 111 </output_collection> | |
| 112 </test> | |
| 113 <test> | |
| 114 <conditional name="operator"> | |
| 115 <param name="opt" value="copy" /> | |
| 116 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 117 </conditional> | |
| 118 <output_collection name="output_files" type="list" count="1"> | |
| 119 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_copy.nc" compare="sim_size" delta="50"/> | |
| 120 </output_collection> | |
| 121 </test> | |
| 122 <test> | |
| 123 <conditional name="operator"> | |
| 124 <param name="opt" value="cat" /> | |
| 125 <param name="add_file" value="drops1.nc,drops2.nc" ftype="netcdf" /> | |
| 126 </conditional> | |
| 127 <output_collection name="output_files" type="list" count="1"> | |
| 128 <element name="outfile.netcdf" ftype="netcdf" file="drops_cat.nc" compare="sim_size" delta="50"/> | |
| 129 </output_collection> | |
| 130 </test> | |
| 131 <test> | |
| 132 <conditional name="operator"> | |
| 133 <param name="opt" value="splitname" /> | |
| 134 <param name="add_file" value="lat_long.nc" ftype="netcdf" /> | |
| 135 </conditional> | |
| 136 <output_collection name="output_files" type="list" count="2"/> | |
| 137 </test> | |
| 138 <test> | |
| 139 <conditional name="operator"> | |
| 140 <param name="opt" value="replace" /> | |
| 141 <param name="add_file" value="lat_long.nc,latitude_modified.nc" ftype="netcdf" /> | |
| 142 </conditional> | |
| 143 <output_collection name="output_files" type="list" count="1"> | |
| 144 <element name="outfile.netcdf" ftype="netcdf" file="lat_long_modified.nc" compare="sim_size" delta="50"/> | |
| 145 </output_collection> | |
| 146 </test> | |
| 147 <test> | |
| 148 <conditional name="operator"> | |
| 149 <param name="opt" value="duplicate" /> | |
| 150 <param name="ndup" value="3" ftype="integer" /> | |
| 151 <param name="add_file" value="latitude.nc" ftype="netcdf" /> | |
| 152 </conditional> | |
| 153 <output_collection name="output_files" type="list" count="1"> | |
| 154 <element name="outfile.netcdf" ftype="netcdf" file="latitude3.nc" compare="sim_size" delta="50"/> | |
| 155 </output_collection> | |
| 156 </test> | |
| 157 <test> | |
| 158 <conditional name="operator"> | |
| 159 <param name="opt" value="selname" /> | |
| 160 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 161 <param name="params" value="Drops" /> | |
| 162 </conditional> | |
| 163 <output_collection name="output_files" type="list" count="1"> | |
| 164 <element name="outfile.netcdf" ftype="netcdf" file="drops1.nc" compare="sim_size" delta="50"/> | |
| 165 </output_collection> | |
| 166 </test> | |
| 167 <test> | |
| 168 <conditional name="operator"> | |
| 169 <param name="opt" value="seltimestep" /> | |
| 170 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 171 <param name="params" value="1,13,25" /> | |
| 172 </conditional> | |
| 173 <output_collection name="output_files" type="list" count="1"> | |
| 174 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_timesteps.nc" compare="sim_size" delta="50"/> | |
| 175 </output_collection> | |
| 176 </test> | |
| 177 <test> | |
| 178 <conditional name="operator"> | |
| 179 <param name="opt" value="sellonlatbox" /> | |
| 180 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 181 <param name="params" value="-10,10,60,70" /> | |
| 182 </conditional> | |
| 183 <output_collection name="output_files" type="list" count="1"> | |
| 184 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_sellonlatbox.nc" compare="sim_size" delta="50"/> | |
| 185 </output_collection> | |
| 186 </test> | |
| 187 <test> | |
| 188 <conditional name="operator"> | |
| 189 <param name="opt" value="invertlat" /> | |
| 190 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 191 </conditional> | |
| 192 <output_collection name="output_files" type="list" count="1"> | |
| 193 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_invertlat.nc" compare="sim_size" delta="50"/> | |
| 194 </output_collection> | |
| 195 </test> | |
| 196 <test> | |
| 197 <repeat name="section_operators"> | |
| 198 <conditional name="operator"> | |
| 199 <param name="opt" value="selname" /> | |
| 200 <param name="params" value="Drops" /> | |
| 201 </conditional> | |
| 202 </repeat> | |
| 203 <repeat name="section_operators"> | |
| 204 <conditional name="operator"> | |
| 205 <param name="opt" value="addc" /> | |
| 206 <param name="const_value" value="10.5" /> | |
| 207 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 208 </conditional> | |
| 209 </repeat> | |
| 210 <output_collection name="output_files" type="list" count="1"> | |
| 211 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_addc.nc" compare="sim_size" delta="50"/> | |
| 212 </output_collection> | |
| 213 </test> | |
| 214 <test> | |
| 215 <conditional name="operator"> | |
| 216 <param name="opt" value="expr" /> | |
| 217 <param name="params" value="Drops2=1000*exp(1+Drops)" /> | |
| 218 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 219 </conditional> | |
| 220 <output_collection name="output_files" type="list" count="1"> | |
| 221 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_expr.nc" compare="sim_size" delta="50"/> | |
| 222 </output_collection> | |
| 223 </test> | |
| 224 <test> | |
| 225 <repeat name="section_operators"> | |
| 226 <conditional name="operator"> | |
| 227 <param name="opt" value="selname" /> | |
| 228 <param name="params" value="CLEAR_SKY_BHI" /> | |
| 229 </conditional> | |
| 230 </repeat> | |
| 231 <repeat name="section_operators"> | |
| 232 <conditional name="operator"> | |
| 233 <param name="opt" value="tim" /> | |
| 234 <param name="stat" value="avg" /> | |
| 235 <param name="add_file" value="timeseries.nc" ftype="netcdf" /> | |
| 236 </conditional> | |
| 237 </repeat> | |
| 238 <output_collection name="output_files" type="list" count="1"> | |
| 239 <element name="outfile.netcdf" ftype="netcdf" file="timeseries_timavg.nc" compare="sim_size" delta="50"/> | |
| 240 </output_collection> | |
| 241 </test> | |
| 242 <test> | |
| 243 <repeat name="section_operators"> | |
| 244 <conditional name="operator"> | |
| 245 <param name="opt" value="sub" /> | |
| 246 <param name="add_file" value="timeseries.nc" ftype="netcdf" /> | |
| 247 </conditional> | |
| 248 </repeat> | |
| 249 <repeat name="section_operators"> | |
| 250 <conditional name="operator"> | |
| 251 <param name="opt" value="addc" /> | |
| 252 <param name="const_value" value="10.5" /> | |
| 253 <param name="add_file" value="timeseries.nc" ftype="netcdf" /> | |
| 254 </conditional> | |
| 255 </repeat> | |
| 256 <output_collection name="output_files" type="list" count="1"> | |
| 257 <element name="outfile.netcdf" ftype="netcdf" file="timeseries_sub.nc" compare="sim_size" delta="50"/> | |
| 258 </output_collection> | |
| 259 </test> | |
| 260 <test> | |
| 261 <repeat name="section_operators"> | |
| 262 <conditional name="operator"> | |
| 263 <param name="opt" value="sellonlatbox" /> | |
| 264 <param name="params" value="-10,10,60,70" /> | |
| 265 </conditional> | |
| 266 </repeat> | |
| 267 <repeat name="section_operators"> | |
| 268 <conditional name="operator"> | |
| 269 <param name="opt" value="setattribute" /> | |
| 270 <param name="attr_file" value="attributes.txt" /> | |
| 271 <param name="add_file" value="WMI_Lear.nc" ftype="netcdf" /> | |
| 272 </conditional> | |
| 273 </repeat> | |
| 274 <output_collection name="output_files" type="list" count="1"> | |
| 275 <element name="outfile.netcdf" ftype="netcdf" file="WMI_Lear_sellonlatbox_units.nc" compare="sim_size" delta="50"/> | |
| 276 </output_collection> | |
| 277 </test> | |
| 278 </tests> | |
| 279 <help><![CDATA[ | |
| 280 | |
| 281 **Climate Data Operators (CDO)** | |
| 282 ======================================================================================================= | |
| 283 | |
| 284 This tool is a wrapper to the Climate Data Operators (CDO) for all operators manipulating input files and creating a new output file. | |
| 285 | |
| 286 - CDO is a collection of command line Operators to manipulate and analyse Climate and NWP model Data. | |
| 287 - There are more than 600 operators available. | |
| 288 | |
| 289 - `CDO online documentation <https://code.mpimet.mpg.de/projects/cdo/>`_. | |
| 290 | |
| 291 ]]> </help> | |
| 292 <expand macro="citations"/> | |
| 293 </tool> |
