view psy-maps.xml @ 3:988212a7466a draft default tip

planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit 526396eeef506a7a8b868d9663b9cde0bcab83ab
author climate
date Tue, 01 Oct 2024 20:14:38 +0000
parents e6d1e9d6b399
children
line wrap: on
line source

<tool id="psy_maps" name="map plot" version="1.3.1" profile="23.0">
    <description>gridded (lat/lon) netCDF data</description>
    <edam_topics>
      <edam_topic>topic_3855</edam_topic>
      <edam_topic>topic_3318</edam_topic>
    </edam_topics>
    <edam_operations>
      <edam_operation>operation_0573</edam_operation>
    </edam_operations>
    <requirements>
        <requirement type="package" version="3">python</requirement>
        <requirement type="package" version="3.9.2">matplotlib</requirement>
        <requirement type="package" version="1.4.3">psyplot</requirement>
        <requirement type="package" version="1.4.2">psy-maps</requirement>
        <requirement type="package" version="1.4.0">psy-reg</requirement>
        <requirement type="package" version="1.6.5">netcdf4</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
       python3 '$__tool_directory__/psymap_simple.py'
            '$ifilename' '$variable'
            --logscale '$adv.logscale'
            --proj '$adv.projection'
            --cmap '$adv.colormap'
            --output image.png
       #if str($adv.multiple_plot.selector) == 'yes'
            --time '$adv.multiple_plot.time'
            --format '$adv.multiple_plot.format'
            --ncol '$adv.multiple_plot.ncol'
            --nrow '$adv.multiple_plot.nrow'
       #end if
       #if str($adv.multiple_plot.title).strip()
            --title '$adv.multiple_plot.title'
       #end if
    ]]></command>
    <inputs>
        <param name="ifilename" type="data" format="netcdf" label="input with geographical coordinates (netCDF format)"></param>
        <param name="variable" type="text" value="TS" label="variable name as given in the netCDF file" />
        <section name="adv" title="Advanced Options" expanded="false">
            <conditional name="multiple_plot">
                <param name="selector" type="select" label="multiple times">
                    <option value="yes">yes</option>
                    <option value="no" selected="true">no</option>
                </param>
                <when value="yes">
                    <param name="time" type="text" value="0" label="comma separated list of indexes for fields to plot" />
                    <param name="format" type="text" value="%Y-%m-%d %H:%M:%S" label="date and time format" />
                    <param name="ncol" type="integer" value="1" min="1" max="4" label="number of columns for subplot grid" />
                    <param name="nrow" type="integer" value="1" min="1" max="20" label="number of rows for subplot grid" />
                    <param name="title" type="text" value="" label="subplot title (repeated on each subplot)" />
                </when>
                <when value="no">
                    <param name="title" type="text" value="" label="plot title" />
                </when>
            </conditional>
            <param name="logscale" type="select" label="log scale the data">
                <option value="yes">yes</option>
                <option value="no" selected="true">no</option>
            </param>
            <param name="projection" type="select">
                <option value="" selected="true">PlateCarree</option>
                <option value="robin">Robinson</option>
                <option value="moll">Mollweide</option>
                <option value="geo">Geostationary</option>
                <option value="northpole">NorthPolarStereo</option>
                <option value="southpole">SouthPolarStereo</option>
                <option value="ortho">Orthographic</option>
                <option value="stereo">Stereographic</option>
                <option value="near">NearsidePerspective</option>
            </param>
            <param name="colormap" type="select">
                <option value="Accent">Accent</option>
                <option value="Blues">Blues</option>
                <option value="BrBG">BrBG</option>
                <option value="BuGn">BuGn</option>
                <option value="BuPu">BuPu</option>
                <option value="CMRmap">CMRmap</option>
                <option value="Dark2">Dark2</option>
                <option value="GnBu">GnBu</option>
                <option value="Greens">Greens</option>
                <option value="Greys">Greys</option>
                <option value="OrRd">OrRd</option>
                <option value="Oranges">Oranges</option>
                <option value="PRGn">PRGn</option>
                <option value="Paired">Paired</option>
                <option value="Pastel1">Pastel1</option>
                <option value="Pastel2">Pastel2</option>
                <option value="PiYG">PiYG</option>
                <option value="PuBu">PuBu</option>
                <option value="PuBuGn">PuBuGn</option>
                <option value="PuOr">PuOr</option>
                <option value="PuRd">PuRd</option>
                <option value="Purples">Purples</option>
                <option value="RdBu">RdBu</option>
                <option value="RdGy">RdGy</option>
                <option value="RdPu">RdPu</option>
                <option value="RdBu_r">RdBu_r</option>
                <option value="RdGy_r">RdGy_r</option>
                <option value="RdPu_r">RdPu_r</option>
                <option value="RdYlBu">RdYlBu</option>
                <option value="RdYlGn">RdYlGn</option>
                <option value="Reds">Reds</option>
                <option value="Set1">Set1</option>
                <option value="Set2">Set2</option>
                <option value="Set3">Set3</option>
                <option value="Spectral">Spectral</option>
                <option value="Wistia">Wistia</option>
                <option value="YlGn">YlGn</option>
                <option value="YlGnBu">YlGnBu</option>
                <option value="YlOrBr">YlOrBr</option>
                <option value="YlOrRd">YlOrRd</option>
                <option value="afmhot">afmhot</option>
                <option value="autumn">autumn</option>
                <option value="binary">binary</option>
                <option value="bone">bone</option>
                <option value="brg">brg</option>
                <option value="bwr">bwr</option>
                <option value="cool">cool</option>
                <option value="coolwarm">coolwarm</option>
                <option value="copper">copper</option>
                <option value="cubehelix">cubehelix</option>
                <option value="flag">flag</option>
                <option value="gist_earth">gist_earth</option>
                <option value="gist_gray">gist_gray</option>
                <option value="gist_heat">gist_heat</option>
                <option value="gist_ncar">gist_ncar</option>
                <option value="gist_rainbow">gist_rainbow</option>
                <option value="gist_stern">gist_stern</option>
                <option value="gist_yarg">gist_yarg</option>
                <option value="gnuplot">gnuplot</option>
                <option value="gnuplot2">gnuplot2</option>
                <option value="gray">gray</option>
                <option value="hot">hot</option>
                <option value="hsv">hsv</option>
                <option value="jet" selected="true">jet</option>
                <option value="nipy_spectral">nipy_spectral</option>
                <option value="ocean">ocean</option>
                <option value="pink">pink</option>
                <option value="prism">prism</option>
                <option value="rainbow">rainbow</option>
                <option value="seismic">seismic</option>
                <option value="spring">spring</option>
                <option value="summer">summer</option>
                <option value="tab10">tab10</option>
                <option value="tab20">tab20</option>
                <option value="tab20b">tab20b</option>
                <option value="tab20c">tab20c</option>
                <option value="terrain">terrain</option>
                <option value="winter">winter</option>
            </param>
        </section>
    </inputs>
    <outputs>
        <data name="ofilename" format="png" from_work_dir="image.png"/>
    </outputs>
    <tests>
        <test>
            <param name="ifilename" value="TS.f2000.T31T31.control.cam.h0.0014-12.nc" />
            <param name="variable" value="TS" />
            <param name="projection" value="" />
            <param name="colormap" value="jet" />
            <output name="ofilename" ftype="png" file="TS.f2000.T31T31.control.cam.h0.0014-12.png" compare="sim_size" delta="500"/>
        </test>
        <test>
            <param name="ifilename" value="TS.f2000.T31T31.control.cam.h0.0014-12.nc" />
            <param name="variable" value="TS" />
            <param name="projection" value="ortho" />
            <param name="colormap" value="RdBu_r" />
            <output name="ofilename" ftype="png" file="TS.f2000.T31T31.control.cam.h0.0014-12_ortho.png" compare="sim_size" delta="500"/>
        </test>
        <test>
            <param name="ifilename" value="ESACCI-OC-L3S-CHLOR_A-20220601-RESIZED-fv6.0.nc" />
            <param name="variable" value="chlor_a" />
            <param name="projection" value="" />
            <param name="colormap" value="jet" />
            <param name="logscale" value="yes" />
            <output name="ofilename" ftype="png" file="ESACCI-OC-L3S-CHLOR_A-20220601-RESIZED-fv6.0.png" compare="sim_size" delta="1500"/>
        </test>
    </tests>
    <help><![CDATA[

**Visualization on a map with psyplot**
=========================================

This tool wraps the functionality of ``psyplot.plot.mapplot``.


.. class:: infomark

        The wrappers aims at providing the same functionality as ``psyplot.plot.mapplot`` but it has some limitations.
        The input file must be in netCDF format and must contain 2D arrays with geographical coordinatates 
	(latitudes, longitudes) given in degrees.
        The code may fail when the data is significantly different from what has been tested.

**What it does**
----------------

This tools creates an image (png format) corresponding to the visualization on a geographical map of a variable extracted from a
netCDF file (input file). 
By default, the projection is ``PlateCarree`` and colormap is ``jet``. 
These settings can be changed in *Advanced settings* alongside an option to log scale the plot.


**Usage**

::

  usage: psymap_simple.py [-h] [--proj PROJ] [--cmap CMAP] [--output OUTPUT] [--time TIME]
                          [--format FORMAT] [--title TITLE] [--ncol NCOL] [--nrow NROW] [-l] [-v] input varname


Positional arguments:
~~~~~~~~~~~~~~~~~~~~~

- **input**:            input filename with geographical coordinates (netCDF format)
- **varname**:          specify which variable to plot (case sensitive)

Optional arguments:
~~~~~~~~~~~~~~~~~~~~~

  -h, --help       show this help message and exit
  -l, --logscale   log scale the data
  --proj PROJ      specify the projection on which we draw
  --cmap CMAP      specify which colormap to use for plotting
  --output OUTPUT  output filename to store resulting image (png format)
  -v, --verbose    switch on verbose mode
  --time TIME      list of times to plot for multiple plots
  --format FORMAT  format for date/time (default is Month d, yyyy)
  --title TITLE    plot title
  --ncol NCOL      number of columns for multiple plots
  --nrow NROW      number of rows for multiple plots

It uses psy-maps, a python package to generate plots. More information about
psyplot and psy-maps can be found at https://psyplot.readthedocs.io/projects/psy-maps/en/latest/

    ]]></help>
    <citations>
        <citation type="doi">10.21105/joss.00363</citation>
    </citations>
</tool>