view ctsm-fates.xml @ 2:b525b88bc941 draft

"planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/fates-emerald commit c85f3e956d229848d22dd25c2da8482d2a8269e0"
author climate
date Wed, 21 Oct 2020 20:49:19 +0000
parents 74b675f9d7c8
children efaa93ed5a79
line wrap: on
line source

<tool id="ctsm_fates" name="CTSM/FATES-EMERALD" version="2.0.1">
    <description>Functionally Assembled Terrestrial Ecosystem Simulator</description>
    <requirements>
        <requirement type="package" version="2.0.1">fates-emerald</requirement>
        <requirement type="package" version="1.32">tar</requirement>
        <requirement type="package" version="2.35">binutils</requirement>
        <requirement type="package" version="3">python</requirement>
        <requirement type="package" version="2.0132">perl-xml-libxml</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
          ( export HOME=`pwd` &&
          export USER='jovyan' &&
          mkdir -p .cime &&
          cp '$__tool_directory__/config' .cime/config &&
          cp '$__tool_directory__/config_compilers.xml' '.cime/config_compilers.xml' &&
          cp '$__tool_directory__/config_machines.xml' '.cime/config_machines.xml' &&
          mkdir inputdata &&
          tar -xf '$inputdata' -C 'inputdata/' && 
          mkdir output_dir &&
          mkdir usermods_dirs &&
          #if str($adv.condi_user_mods).strip() == 'yes'
              # should create a new type user_mods.tar
              cd usermods_dirs &&
              tar xf '$user_mods' &&
              cd .. &&
          #end if
          create_newcase --case '$casename' --compset 2000_DATM%1PTGSWP3_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV --machine espresso --run-unsupported 
          #if str($adv.condi_user_mods).strip() == 'yes'
              --user-mods-dir usermods_dirs
          #end if
              --res '$resolution'  && 
          cd '$casename' &&
          ./case.setup  > $case_info  2>&1   &&
          #if (str($adv_period.condi_type_run.run_type) == 'hybrid' or str($adv_period.condi_type_run.run_type) == 'branch')
              ./xmlchange RUN_TYPE=$adv_period.condi_type_run.run_type &&
              ./xmlchange RUN_REFDATE=$adv_period.condi_type_run.run_refdate &&
              ./xmlchange RUN_REFCASE=$adv_period.condi_type_run.run_refcase &&
          #end if
          #if ((str($adv_period.condi_type_run.run_type) == 'hybrid' or str($adv_period.condi_type_run.run_type) == 'startup') and ($adv_period.condi_type_run.run_startdate != ''))
              ./xmlchange RUN_STARTDATE=$adv_period.condi_type_run.run_startdate &&
          #end if
          ./xmlchange STOP_N=$adv_period.stopn &&
          ./xmlchange STOP_OPTION=$adv_period.stop_option &&
          ./xmlchange CCSM_CO2_PPMV=$adv.co2 &&
          ./xmlchange DOUT_S=FALSE &&
          cp '$user_nl_clm_customization' user_nl_clm &&
         ./case.build >> $case_info  2>&1 &&
          #if (str($adv_period.condi_type_run.run_type) == 'hybrid' or str($adv_period.condi_type_run.run_type) == 'branch')
             tar -xf '$adv_period.condi_type_run.restart' -C '../work/$casename/run/' && 
             
          #end if
         ./case.submit >> $case_info  2>&1 &&
         mkdir -p restart                              &&
         (cat '../work/$casename/run/rpointer'.* > $rinfo || printf "No restarts\n") &&
         (cp '../work/$casename/run/$casename'.*.r*.*.nc restart/ || printf "No netCDF restarts\n") &&
         (cp '../work/$casename/run/$casename'.*.r*.*.bin restart/ || printf "No bin restarts\n") &&
         (cp '../work/$casename/run/rpointer'.* restart/ || printf "no rpointer\n") &&
         cd restart && 
         tar cvf $restart . &&
         cd .. && 
         (cp '../work/$casename/run/$casename'.*.h*.*.nc ../output_dir/ || printf "no netCDF outputs\n") &&
         (gunzip '../work/$casename/run/'*.log.* || printf "no compressed logs") && 
         cat '../work/$casename/run/'atm.log.* >> $atm_log &&
         cat '../work/$casename/run/'cesm.log.* >> $cesm_log &&
         cat '../work/$casename/run/'cpl.log.* >> $cpl_log &&
         cat '../work/$casename/run/'lnd.log.* >> $lnd_log &&
         cat '../work/$casename/run/'rof.log.* >> $rof_log ) ||
         (printf "Case failed" && tar cf $work \${HOME}/work)
    ]]></command>
    <configfiles>
        <configfile name="user_nl_clm_customization"><![CDATA[
&clm_inparm
            hist_mfilt = 120,
            use_fates = .true.,
            fates_spitfire_mode = $adv_clm.fates_spitfire_mode,
            use_fates_planthydro = $adv_clm.use_fates_planthydro,
            use_fates_cohort_age_tracking = $adv_clm.use_fates_cohort_age_tracking,
            use_fates_ed_st3 = $adv_clm.use_fates_ed_st3,
            use_fates_ed_prescribed_phys = $adv_clm.use_fates_ed_prescribed_phys,
            use_fates_logging = $adv_clm.use_fates_logging,
            use_fates_fixed_biogeog = $adv_clm.use_fates_fixed_biogeog,
            #if (str($adv_clm.fates_parteh_mode).strip() != '')
              fates_parteh_mode = $adv_clm.fates_parteh_mode   
            #end if
/
        ]]>
        </configfile>
    </configfiles>
    <inputs>
        <param name="inputdata" type="data" format='tar' label="inputdata for running FATES EMERALD"></param>
        <param name="casename" type="text" value="usecase" label="Name of your case">
            <validator type="regex" message="start with a letter and no blanks">^[A-Za-z][A-Za-z0-9]*</validator>
        </param>
        <param name="resolution" type="select" label="Model resolution">
                <option value="1x1_ALP1">ALP1</option>
                <option value="1x1_ALP2">ALP2</option>
                <option value="1x1_ALP3">ALP3</option>
                <option value="1x1_ALP4">ALP4</option>
                <option value="1x1_SUB1">SUB1</option>
                <option value="1x1_SUB2">SUB2</option>
                <option value="1x1_SUB3">SUB3</option>
                <option value="1x1_SUB4">SUB4</option>
                <option value="1x1_BOR1">BOR1</option>
                <option value="1x1_BOR2">BOR2</option>
                <option value="1x1_BOR3">BOR3</option>
                <option value="1x1_BOR4">BOR4</option>
                <option value="1x1_LYG">LYG</option>
                <option value="1x1_BUO">BUO</option>
                <option value="1x1_HAV">HAV</option>
                <option value="1x1_SKO">SKO</option>
                <option value="1x1_VIKE">VIKE</option>
                <option value="1x1_LIAH">LIAH</option>
                <option value="1x1_FINN">FINN</option>
        </param>
        <section name="adv_period" title="Customize the model run period" expanded="false">

            <conditional name="condi_type_run">
                <param name="run_type" type="select" label="Determines the model run initialization type.">
                    <option value="startup" selected="true">startup</option>
                    <option value="hybrid">hybrid</option>
                    <option value="branch">branch</option>
                </param>
                <when value="startup">
                    <param name="run_startdate" type="text" value="" label="Run start date (yyyy-mm-dd). Only used for startup or hybrid runs.">
                       <validator type="regex" message="YYYY-MM-DD">(^$|(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])))</validator>
                    </param>
                </when>
                <when value="branch">
                    <param name="run_refcase" type="text" value="" label="Reference case for hybrid or branch runs"></param>
                    <param name="run_refdate" type="text" value="" label="Reference date for hybrid or branch runs (yyyy-mm-dd)">
                       <validator type="regex" message="YYYY-MM-DD">(^$|(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])))</validator>
                    </param>
                    <param name="restart" type="data" format='tar' label="restart for running FATES EMERALD"></param>
                </when>
                <when value="hybrid">
                    <param name="run_refcase" type="text" value="" label="Reference case for hybrid or branch runs"></param>
                    <param name="run_refdate" type="text" value="" label="Reference date for hybrid or branch runs (yyyy-mm-dd)">
                       <validator type="regex" message="YYYY-MM-DD">(^$|(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])))</validator>
                    </param>
                    <param name="run_startdate" type="text" value="" label="Run start date (yyyy-mm-dd). Only used for startup or hybrid runs.">
                       <validator type="regex" message="YYYY-MM-DD">(^$|(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])))</validator>
                    </param>
                    <param name="restart" type="data" format='tar' label="restart for running FATES EMERALD"></param>
                </when>
            </conditional>
            <param name="stopn" type="integer" value="5" label="Provides a numerical count for STOP_OPTION."></param>
            <param name="stop_option" type="select" label=" Sets the run length along with STOP_N and STOP_DATE">
                <option value="ndays" selected="true">ndays</option>
                <option value="none">none</option>
                <option value="never">never</option>
                <option value="nsteps">nsteps</option>
                <option value="nseconds">nseconds</option>
                <option value="nminutes">nminutes</option>
                <option value="nhours">nhours</option>
                <option value="nday">ndays</option>
                <option value="nmonths">nmonths</option>
                <option value="nyears">nyears</option>
                <option value="date">date</option>
                <option value="ifdays0">ifday0</option>
                <option value="end">end</option>
            </param>
        </section>
        <section name="adv_clm" title="CLM namelist customization" expanded="false">
            <param name="use_fates_planthydro" type="boolean" label="Toggle to turn on plant hydraulics" truevalue=".true." falsevalue=".false."  checked="false"/>
            <param name="use_fates_cohort_age_tracking" type="boolean" label="Toggle to turn on cohort age tracking" truevalue=".true." falsevalue=".false."  checked="false"/>
            <param name="use_fates_ed_st3" type="boolean" label="Toggle to turn on Static Stand Structure Mode" truevalue=".true." falsevalue=".false."  checked="false"/>
            <param name="use_fates_ed_prescribed_phys" type="boolean" label="Toggle to turn on prescribed physiology" truevalue=".true." falsevalue=".false."  checked="false"/>
            <param name="use_fates_logging" type="boolean" label="Toggle to turn on the logging module" truevalue=".true." falsevalue=".false."  checked="false"/>
            <param name="use_fates_fixed_biogeog" type="boolean" label="Toggle to turn on fixed biogeography mode" truevalue=".true." falsevalue=".false."  checked="false"/>
            <param name="fates_spitfire_mode" type="select" label="Spitfire module to simulate fire">
                <option value="0" selected="true">None</option>
                <option value="1">Use a global constant lightning rate found in fates_params</option>
                <option value="2">Use an external lightning dataset</option>
                <option value="3">Use an external confirmed ignitions dataset</option>
                <option value="4">Use external lightning and population datasets to simulate both natural and anthropogenic ignitions</option>
           </param>
           <param name="fates_parteh_mode" type="select" label="Switch deciding which nutrient model to use in FATES">
               <option value="" selected="true">None</option>
               <option value="1">1</option>
               <option value="2">2</option>
           </param>
        </section>
        <section name="adv" title="Advanced customization" expanded="false">
            <param name="co2" type="float" value="367.0" label="Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol)"></param>
            <conditional name="condi_user_mods">
                <param name="add_changes" type="select" label="user-modified source code">
                    <option value="no" selected="true">no</option>
                    <option value="yes">yes</option>
                </param>
                <when value="yes">
                    <param name="usermods" type="data" format="tar" label="SourceMods"></param>
               </when>
               <when value="no"/>
        </conditional>
        </section>
    </inputs>
    <outputs>
        <collection name="history_files" type="list" label="${tool.name} on ${inputdata.name} (history file)">
            <discover_datasets pattern="__designation_and_ext__" directory="output_dir" visible="true" format="netcdf"/>
        </collection>
        <data name="atm_log" format="txt" label="${tool.name} on ${inputdata.name} (atm.log)"/>
        <data name="cesm_log" format="txt" label="${tool.name} on ${inputdata.name} (cesm.log)"/>
        <data name="cpl_log" format="txt" label="${tool.name} on ${inputdata.name} (cpl.log)"/>
        <data name="lnd_log" format="txt" label="${tool.name} on ${inputdata.name} (lnd.log)"/>
        <data name="rof_log" format="txt" label="${tool.name} on ${inputdata.name} (rof.log)"/>
        <data name="restart" format="tar" label="${tool.name} on ${inputdata.name} (restart)"></data>
        <data name="case_info" format="txt" label="${tool.name} on ${inputdata.name} (case info)"></data>
        <data name="rinfo" format="txt" label="${tool.name} on ${inputdata.name} (restart info)"></data>
        <data name="work" format="tar" label="${tool.name} on ${inputdata.name} (workdir)">
        </data>
    </outputs>
    <tests>
        <test>
            <param name="inputdata" value="inputdata_test.tar" />
            <param name="casename" value="test" />
            <param name="resolution" value="1x1_ALP1" />
            <param name="run_startdate" value="2000-01-01" />
            <param name="stop_option" value="nsteps" />
            <param name="stopn" value="1" />
            <output name="atm_log" ftype="txt" file="atm.log" compare="sim_size" delta="1000">
              <assert_contents>
                  <has_text text="(datm_comp_final) atm: end of main integration loop" />
              </assert_contents>
            </output>
            <output name="cesm_log" ftype="txt" file="cesm.log" compare="sim_size" delta="1000">
              <assert_contents>
                  <has_text text="pes participating in computation for CLM" />
              </assert_contents>
            </output>
            <output name="cpl_log" ftype="txt" file="cpl.log" compare="sim_size" delta="1000">
              <assert_contents>
                  <has_text text="SUCCESSFUL TERMINATION" />
              </assert_contents>
            </output>
            <output name="lnd_log" ftype="txt" file="lnd.log" compare="sim_size" delta="1000">
              <assert_contents>
                  <has_text text="Successfully" />
              </assert_contents>
            </output>
            <output name="rof_log" ftype="txt" file="rof.log" compare="sim_size" delta="1000">
              <assert_contents>
                  <has_text text="MOSART model initialization" />
              </assert_contents>
            </output>
            <output name="work" ftype="tar" file="workdir.tar" compare="sim_size" delta="1000">
               <assert_contents>
                    <has_size value="0"/>
                </assert_contents>
            </output>
            <output name="restart" ftype="tar" file="restart.tar" compare="sim_size" delta="100" />
            <output name="rinfo" ftype="txt" file="restart_info.txt" compare="sim_size" delta="1000">
              <assert_contents>
                  <has_text text="datm.r.2000-01-01-01800.nc" />
                  <has_text text="datm.rs1.2000-01-01-01800.bin" />
                  <has_text text="cpl.r.2000-01-01-01800.nc" />
                  <has_text text="clm2.r.2000-01-01-01800.nc" />
              </assert_contents>
            </output>
            <output_collection name="history_files" count="0">
            </output_collection>
        </test>
    </tests>
    <help><![CDATA[

**The Functionally Assembled Terrestrial Ecosystem Simulator (FATES)**
==========================================================================

This tool create and run CTSM-FATES EMERALD experiments from fates-emerald release.

This version of FATES is maintained by the University of Oslo.

Currently available resolution are as following:

SeedClim Sites:
~~~~~~~~~~~~~~~

- ALP1,61.0243N,8.12343E
- ALP2,60.8231N,7.27596E
- ALP3,60.8328N,7.17561E
- ALP4,60.9335N,6.41504E
- SUB1,60.8203N,8.70466E
- SUB2,60.8760N,7.17666E
- SUB3,61.0866N,6.63028E
- SUB4,60.5445N,6.51468E
- BOR1,61.0355N,9.07876E
- BOR2,60.8803N,7.16982E
- BOR3,60.6652N,6.33738E
- BOR4,60.6901N,5.96487E

LandPress Sites:
~~~~~~~~~~~~~~~~

- LYG,60.70084N,5.092566E  
- BUO,65.83677N,12.224506E
- HAV,64.779N,11.2193E
- SKO,65.79602N,12.219299E

Three-D Sites:
~~~~~~~~~~~~~~

- VIKE,60.88019N,7.16990E
- JOAS,60.86183N,7.16800E
- LIAH,60.85994N,7.19504E


Finnmark Site:
~~~~~~~~~~~~~~

- FINN,69.341088N,25.293524E

    ]]></help>
    <citations>

    </citations>
    <edam_topics>
      <edam_topic>topic_3855</edam_topic>
      <edam_topic>topic_3318</edam_topic>
      <edam_topic>topic_3050</edam_topic>
      <edam_topic>topic_0610</edam_topic>
    </edam_topics>
    <edam_operations>
      <edam_operation>operation_3946</edam_operation>
      <edam_operation>operation_2426</edam_operation>
    </edam_operations>
</tool>