view c3s.xml @ 2:21e8386cf36f draft default tip

planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
author climate
date Fri, 27 Sep 2024 19:34:36 +0000
parents bd153c794da1
children
line wrap: on
line source

<tool id="c3s" name="Copernicus Climate Data Store" version="0.3.0" profile="23.0">
    <description>for retrieving climate data</description>
    <edam_topics>
        <edam_topic>topic_3855</edam_topic>
        <edam_topic>topic_3318</edam_topic>
      </edam_topics>
      <edam_operations>
        <edam_operation>operation_2422</edam_operation>
        <edam_operation>operation_3357</edam_operation>
        <edam_operation>operation_0335</edam_operation>
      </edam_operations>
    <requirements>
        <requirement type="package" version="3.8">python</requirement>
        <requirement type="package" version="0.7.3">cdsapi</requirement>
        <requirement type="package" version="2.4.4">cdo</requirement>
        <requirement type="package" version="1.34">tar</requirement>
        <requirement type="package" version="6.0">unzip</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
       export HOME=`pwd`  &&
       #set $c3s_cds_apikey = $__user__.extra_preferences.get('c3s_account|c3s_cds_apikey', "")
       #if $c3s_cds_apikey == ""
	    echo "Error. Set your credentials via: User -> Preferences -> Manage Information" &&
       #else
            cp '$cds_key_file' .cdsapirc &&
       #end if
       #if str($is_file.has_req).strip() == 'yes'
            python3 '$__tool_directory__/c3s_retrieve.py' 
	             --request '$is_file.api_req_file' --output request.txt  &&
       #else
            python3 '$__tool_directory__/c3s_retrieve.py' 
	             --request $req_from_paste --output request.txt &&
       #end if
       bash $__tool_directory__/c3s.sh &&
       echo "C3S data retrieval is done"
    ]]></command>
    <configfiles>
        <configfile name="cds_key_file"><![CDATA[
#set $c3s_cds_apikey = $__user__.extra_preferences.get('c3s_account|c3s_cds_apikey', "")
         url: https://cds.climate.copernicus.eu/api
         key: $c3s_cds_apikey
        ]]></configfile>
        <configfile name="req_from_paste"><![CDATA[
       #if str($is_file.has_req).strip() == 'no'
$is_file.api_req_text
       #end if
        ]]></configfile>
    </configfiles>
    <inputs>
        <conditional name="is_file">
            <param name="has_req" type="select" label="C3S request is a given as a filename">
                <option value="yes" selected="true">yes</option>
                <option value="no">no</option>
            </param>
	   <when value="yes">
	        <param name="api_req_file" type="data" label="API Request filename" format="txt"/>
           </when>
            <when value="no">
	        <param name="api_req_text" type="text" label="Paste API Request" area="true" />
           </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="request" format="txt" from_work_dir="request.txt" label="${tool.name} on ${on_string}: request script"/>
        <data name="ofilename" format="netcdf" from_work_dir="tmp.nc" label="${tool.name} on ${on_string}: NC"/>
    </outputs>
    <tests>
        <test>
            <param name="api_req_file" value="input.txt" />
            <output name="request" ftype="txt">
              <assert_contents>
                  <has_text text="dataset to retrieve: reanalysis-era5-single-levels-monthly-means" />
                  <has_text text="'data_format': 'netcdf'" />
                  <has_text text="'product_type': 'monthly_averaged_reanalysis'" />
                  <has_text text="'variable': '2m_temperature'" />
                  <has_text text="'year': '2020'" />
                  <has_text text="'month': '12'" />
                  <has_text text="'time': '00:00'" />
		  <has_text text="'area': [" />
	          <has_text text="60," />
		  <has_text text="10," />
		  <has_text text="59.5," />            
		  <has_text text="10.5," />
		  <has_text text="]" />
		  <has_text text="output filename: download.nc" />
              </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[

**Copernicus Climate Data Store (C3S)**
=======================================

This tool is a wrapper to retrieve data from the Copernicus Climate Data Store.

- It allows to retrieve data from the Copernicus climate Data Store.
- Any user willing to use this tool needs to `create a new account <https://cds.climate.copernicus.eu/>`_.
- Set your CDS API Key via: User -> Preferences -> Manage Information"
- Documentation on where to get the CDS API key can be found `here <https://cds.climate.copernicus.eu/how-to-api>`_.
- Compose your request directly on C3S and extract the relevant information, which should be put in the input field "Request" or saved in a file. The format should be, for example::


    import cdsapi
    
    c = cdsapi.Client()
    c.retrieve(
        'reanalysis-era5-single-levels-monthly-means',
        {
            'data_format': 'netcdf',
            'product_type': 'monthly_averaged_reanalysis',
            'variable': '2m_temperature',
            'year': '2020',
            'month': '12',
            'time': '00:00',
            'area': [60, 10, 59.5, 10.5],
        },
        'download.nc')


- Be aware that for being able to download dataset from C3S, users also need to agree to licensing terms for each dataset of interest on the C3S website.

License:
~~~~~~~~

Generated using Copernicus Climate Change Service information [2024]
Neither the European Commission nor ECMWF is responsible for any use 
that may be made of the Copernicus information or data it contains.
    ]]></help>
    <citations>
	<citation type="bibtex">
	@misc{C3S2024,author={Copernicus Climate Change Service},year={2024}}</citation>
    </citations>
</tool>