#!/bin/sh
#=======================================================================
# pool one year of model diagnostic files               --- pool_ann ---
# $Id: pool_ann_jobdef 656 2011-12-28 19:51:43Z acrnrls $
#=======================================================================
#     keyword :: pool_ann
# description :: pool one year of diagnostic files (Jan-Dec)

#******************************
#********* WARNING ************
#******************************
#
# auto, nonqs, nextjob, flabel, RCMRUN, runid, run, nqsext, crawork,
# mdest, [sgd]time, nnodex, nprocx, initmem, sv, vic, memory[0-9][0-9],
# queue, jobname, gcmjcl
#
# These variables are special in that they are extracted from the
# submission script prior to execution and used to parse file names,
# among other things. Therefore any of these variables whose definition
# depends on another variable that is not in this list will be improperly
# defined in this preprocessing step. This could lead to file names being
# incorrectly specified. The variables are extracted by copying the entire
# line on which they are defined from the submission script. Therefore
# variables that are used to define any of these variables must be defined
# on the same line as that variable and prior to it or on a previous line
# that contains any of these variables.
#
#******************************
set -a
. betapath2

#  * ..................... Definition of Global Parameters .....................

 # These variables are set when the job string is created
 run_start_year=NotSet   # memory99=1
 run_start_month=NotSet  # memory99=1
 run_stop_year=NotSet    # memory99=1
 run_stop_month=NotSet   # memory99=1
 current_year=NotSet     # memory99=1
 current_month=NotSet    # memory99=1
 previous_year=NotSet    # memory99=1
 previous_month=NotSet   # memory99=1
 next_year=NotSet        # memory99=1
 next_month=NotSet       # memory99=1

 runid=aaa; uxxx=uxxx
 pool_uxxx=$uxxx; pool_ann_flabel_uxxx=$pool_uxxx         # memory99=1
 diag_uxxx=$uxxx; pool_ann_model_uxxx=$diag_uxxx          # memory99=1
 pool_ann_flabel_prefix=${pool_ann_flabel_uxxx}_${runid}  # memory99=1
 pool_ann_model_prefix=${pool_ann_model_uxxx}_${runid}    # memory99=1

 jobname=pool_ann;
 crawork=${runid}_pool_ann; username="acrnxxx"; user="XXX"
 nqsprfx="${runid}_"; nqsext='';

 # pool_suffix_list is used by poolseas4
 pool_ann_suffix_list=''
 pool_suffix_list=${pool_ann_suffix_list:=''}

#  * ........................... Parmsub Parameters ............................

 year=000; flabel="${pool_ann_flabel_prefix}_${year}_ann_"

 model1="${pool_ann_model_prefix}_${year}_m01_";
 model2="${pool_ann_model_prefix}_${year}_m02_";
 model3="${pool_ann_model_prefix}_${year}_m03_";
 model4="${pool_ann_model_prefix}_${year}_m04_";
 model5="${pool_ann_model_prefix}_${year}_m05_";
 model6="${pool_ann_model_prefix}_${year}_m06_";
 model7="${pool_ann_model_prefix}_${year}_m07_";
 model8="${pool_ann_model_prefix}_${year}_m08_";
 model9="${pool_ann_model_prefix}_${year}_m09_";
 model10="${pool_ann_model_prefix}_${year}_m10_";
 model11="${pool_ann_model_prefix}_${year}_m11_";
 model12="${pool_ann_model_prefix}_${year}_m12_";

 ml01="31"; ml02="28"; ml03="31"; ml04="30"; ml05="31"; ml06="30";
 ml07="31"; ml08="31"; ml09="30"; ml10="31"; ml11="30"; ml12="31";

 dtime=1800; gptime=1800; stime=1800;
 memory1="250mb"; memory2="250mb"; memory3="250mb";

 lopgm=lopgm

 # Allow the user to reset CCRNTMP and/or RUNPATH
 pool_RUNPATH=''
 RUNPATH=${pool_RUNPATH:=$RUNPATH}
 pool_CCRNTMP=''
 CCRNTMP=${pool_CCRNTMP:=$CCRNTMP}

 # Alternate path to a directory where .queue/.crawork will be found
 JHOME=''

 if [ -n "$JHOME" -a x"$JHOME" != x"$HOME" ]; then
   # Allow optional reset of DATAPATH/RUNPATH
   JHOME_DATA=''
   DATAPATH=${JHOME_DATA:=$DATAPATH}
   RUNPATH=${JHOME_DATA:=$RUNPATH}
   # Allow optional reset of CCRNTMP
   JHOME_RUN=''
   CCRNTMP=${JHOME_RUN:=$CCRNTMP}
 fi

#  * ............................ Condef Parameters ............................

 join=12
 nextjob=on
 noprint=on
 # pool_var=on means pool variances as well as means
 pool_ann_pool_var=off
 pool_var=$pool_ann_pool_var
 # poolabort=off means do not abort when variables are missing
 poolabort=off

#  * ............................. Deck Definition .............................

 . poolseas4.dk

#end_of_job
