Mercurial > repos > ecology > xarray_netcdf2netcdf
diff 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 |
line wrap: on
line diff
--- a/xarray_netcdf2netcdf.xml Sun Aug 29 16:45:45 2021 +0000 +++ b/xarray_netcdf2netcdf.xml Thu Jan 20 17:08:29 2022 +0000 @@ -1,190 +1,81 @@ -<tool id="xarray_netcdf2netcdf" name="NetCDF xarray operations" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"> - <description>manipulate xarray from netCDF and save back to netCDF</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> - </requirements> - <command detect_errors="exit_code"><![CDATA[ - mkdir output_dir && - python '$__tool_directory__/xarray_netcdf2netcdf.py' '$input' '$var' - --filter - #for $i,$uc in enumerate($user_choice) - #if $uc.condi_between.comparator=="sl" - '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.t1}#${uc.condi_between.t2}' - #else - '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.value}' - #end if - #end for - #if $scale - --scale '$scale' - #end if - #if $write_all - --write_all - #end if - --verbose - --output '$output_netcdf' - ]]></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 extract"> - <options from_dataset="var_tab"> - <column name="name" index="0"/> - <column name="value" index="0"/> - </options> - </param> - - <repeat name="user_choice" title="additional filter" min="0" max="20" help="Use this option to filter on the selected dataset"> - <param name="dim" type="select" label="Dimensions"> - <options from_dataset="var_tab"> - <column name="value" index="0"/> - </options> - </param> - <param type="data" label="Tabular containing values of this dimension" name="dim_tab" format="tabular" help="File containing values for this dimension."/> - <conditional name="condi_between"> - <param name="comparator" type="select" label="Comparator"> - <option value="is">is</option> - <option value="from">from</option> - <option value="to">to</option> - <option value="sl">slice(threshold1,threshold2)</option> - </param> - <when value="sl"> - <param name="t1" type="select" multiple="false" label="Choose the start value for slice"> - <options from_dataset="dim_tab"> - <column name="name" index="1"/> - <column name="value" index="0"/> - </options> - </param> - <param name="t2" type="select" multiple="false" label="Choose the end value for slice"> - <options from_dataset="dim_tab"> - <column name="name" index="1"/> - <column name="value" index="0"/> - </options> - </param> - </when> - <when value="is"> - <param name="value" type="select" multiple="false" label="Choose the value to select"> - <options from_dataset="dim_tab"> - <column name="name" index="1"/> - <column name="value" index="0"/> - </options> - </param> - </when> - <when value="to"> - <param name="value" type="select" multiple="false" label="Choose the end value"> - <options from_dataset="dim_tab"> - <column name="name" index="1"/> - <column name="value" index="0"/> - </options> - </param> - </when> - <when value="from"> - <param name="value" type="select" multiple="false" label="Choose the start value"> - <options from_dataset="dim_tab"> - <column name="name" index="1"/> - <column name="value" index="0"/> - </options> - </param> - </when> - </conditional> - </repeat> - <param type="float" name="scale" optional="true" help="scale factor (float) to apply to selection (optional)"/> - - <param name="write_all" type="boolean" value="false" label="Write all variables to new netCDF file"/> - </inputs> - <outputs> - <data name="output_netcdf" format="netcdf"/> - </outputs> - <tests> - <test> - <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/> - <param name="var_tab" value="var_tab_dataset-ibi"/> - <param name="var" value="chl"/> - <repeat name="user_choice"> - <param name="dim" value="time"/> - <conditional name="condi_between"> - <param name="comparator" value="sl"/> - <param name="t1" value="10"/> - <param name="t2" value="12"/> - </conditional> - </repeat> - <repeat name="user_choice"> - <param name="dim" value="latitude"/> - <param name="dim_tab" value="latitude.tabular"/> - <conditional name="condi_between"> - <param name="comparator" value="sl"/> - <param name="t1" value="5"/> - <param name="t2" value="10"/> - </conditional> - </repeat> - <repeat name="user_choice"> - <param name="dim" value="longitude"/> - <param name="dim_tab" value="longitude.tabular"/> - <conditional name="condi_between"> - <param name="comparator" value="sl"/> - <param name="t1" value="4"/> - <param name="t2" value="10"/> - </conditional> - </repeat> - <param name="scale" value="1000.5"/> - <output name="output_netcdf" file="small.netcdf" compare="sim_size" delta="1000"/> - </test> - <test> - <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/> - <param name="var_tab" value="var_tab_dataset-ibi"/> - <param name="var" value="chl"/> - <repeat name="user_choice"> - <param name="dim" value="time"/> - <conditional name="condi_between"> - <param name="comparator" value="sl"/> - <param name="t1" value="10"/> - <param name="t2" value="12"/> - </conditional> - </repeat> - <repeat name="user_choice"> - <param name="dim" value="latitude"/> - <param name="dim_tab" value="latitude.tabular"/> - <conditional name="condi_between"> - <param name="comparator" value="sl"/> - <param name="t1" value="5"/> - <param name="t2" value="10"/> - </conditional> - </repeat> - <repeat name="user_choice"> - <param name="dim" value="longitude"/> - <param name="dim_tab" value="longitude.tabular"/> - <conditional name="condi_between"> - <param name="comparator" value="sl"/> - <param name="t1" value="4"/> - <param name="t2" value="10"/> - </conditional> - </repeat> - <param name="scale" value="1000.5"/> - <param name="write_all" value="Yes"/> - <output name="output_netcdf" file="all.netcdf" compare="sim_size" delta="1000"/> - </test> - </tests> - <help><![CDATA[ -**What it does** - -Select a variable ans can restrict over any of its dimension and apply a scaling (1 by default). -the result is stored in a new netCDF file. -One can also select the range of time (for timeseries) to apply these operations over the range only -when a range of time is selected and when scaling, one can choose to save the entire timeseries or -the selected range only. -when scaling, one can add additional filters on dimensions (typically used to filter -over latitudes and longitudes) - - -------------------------------------------------- - -The xarray select tool can be used after the xarray Info and xarray Coord. - ]]></help> - <expand macro="citations"/> -</tool> +<tool id="xarray_netcdf2netcdf" name="NetCDF xarray operations" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> + <description>manipulate xarray from netCDF and save back to netCDF</description> + <macros> + <import>macros.xml</import> + <import>macros_netcdf2netcdf.xml</import> + <import>macros_tests_netcdf2netcdf.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.8">netcdf4</requirement> + <requirement type="package" version="2021.12.0">dask</requirement> + </requirements> + <command detect_errors="exit_code"><![CDATA[ + mkdir output_dir && + python '$__tool_directory__/xarray_netcdf2netcdf.py' + '$input' + '$variable.var' + --filter + #for $i,$uc in enumerate($subset_coords.tsel.user_choice) + #if $uc.condi_between.comparator == "sl" + '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.t1}#${uc.condi_between.t2}' + #elif $subset_coords.tsel.by_click == "sel" and $uc.condi_between.method != 'None' + '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.value}#${uc.condi_between.method}' + #else + '${uc.dim}#${uc.condi_between.comparator}#${uc.condi_between.value}' + #end if + #end for + #if $subset_coords.tsel.by_click == "sel" + --selection + #end if + #if $variable.scale + --scale '$variable.scale' + #end if + #if ($variable.write_all) or (str($variable.var) == 'None') + --write_all + #end if + #if $variable.keep_attributes + --keep_attributes + #end if + #if str($mask_values.mask_condi.mask_option) == 'drop' + --drop + #elif str($mask_values.mask_condi.mask_option) == 'other' + --other '$mask_values.mask_condi.set_other' + #end if + #if str($mask_values.where_condition) != "" + --where '$mask_values.where_condition' + #end if + --verbose + --output '$output_netcdf' + ]]> </command> + <inputs> + <param type="data" name="input" multiple="true" min="1" label="Input netcdf file" format="netcdf"/> + <param type="data" label="Metadata Infos" name="var_tab" format="tabular" help="Select the tabular file which summarize the available variables and dimensions."/> + <expand macro="section_variables"/> + <expand macro="section_coords"/> + <expand macro="section_where"/> + </inputs> + <outputs> + <data name="output_netcdf" format="netcdf"/> + </outputs> + <expand macro="section_tests"/> + <help><![CDATA[ +**What it does** + +Select a variable ans can restrict over any of its dimension and apply a scaling (1 by default). +the result is stored in a new netCDF file. +One can also select the range of time (for timeseries) to apply these operations over the range only +when a range of time is selected and when scaling, one can choose to save the entire timeseries or +the selected range only. +when scaling, one can add additional filters on dimensions (typically used to filter +over latitudes and longitudes) + + +------------------------------------------------- + +The xarray select tool can be used after the xarray Info and xarray Coord. + ]]> </help> + <expand macro="citations"/> +</tool>