source: trunk/libIGCM/AA_create_ts @ 315

Last change on this file since 315 was 315, checked in by mafoipsl, 14 years ago

Add mail when job aborts in mercure front-end header. Correct SendMail? function on mercurex9.

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Date Author Revision
File size: 33.8 KB
Line 
1#-Q- cesium #!/bin/ksh
2#-Q- cesium ######################
3#-Q- cesium ## CESIUM   CEA ##
4#-Q- cesium ######################
5#-Q- cesium #MSUB -r TS             # Nom du job               
6#-Q- cesium #MSUB -N 1              # Reservation du noeud
7#-Q- cesium #MSUB -n 1              # Reservation du processus
8#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
9#-Q- cesium #MSUB -E "-j o"
10#-Q- cesium #MSUB -E "-S /bin/ksh"
11#-Q- platine #!/usr/bin/ksh
12#-Q- platine ###################
13#-Q- platine ## PLATINE   CEA ##
14#-Q- platine ###################
15#-Q- platine #BSUB -J TS                     # Nom du job
16#-Q- platine #BSUB -N                        # message a la fin du job
17#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
18#-Q- platine #BSUB -W 1:00                   # Limite temps
19#-Q- platine #BSUB -q post                   # Passage en queue post
20#-Q- sx8brodie #!/bin/ksh
21#-Q- sx8brodie #######################
22#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
23#-Q- sx8brodie #######################
24#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
25#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
26#-Q- sx8brodie # Nom du travail LoadLeveler
27#-Q- sx8brodie # @ job_name   = TS
28#-Q- sx8brodie # Fichier de sortie standard du travail       
29#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
30#-Q- sx8brodie # Fichier de sortie d'erreur du travail
31#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
32#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
33#-Q- sx8brodie # @ notification = error
34#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
35#-Q- aix6 #!/bin/ksh
36#-Q- aix6 #######################
37#-Q- aix6 ##   VARGAS   IDRIS  ##
38#-Q- aix6 #######################
39#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
40#-Q- aix6 # @ wall_clock_limit = 20:00:00
41#-Q- aix6 # Nom du travail LoadLeveler
42#-Q- aix6 # @ job_name   = TS
43#-Q- aix6 # Fichier de sortie standard du travail
44#-Q- aix6 # @ output     = $(job_name).$(jobid)
45#-Q- aix6 # Fichier de sortie d'erreur du travail
46#-Q- aix6 # @ error      =  $(job_name).$(jobid)
47#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
48#-Q- aix6 # @ notification = error
49#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
50#-Q- aix6 # @ queue
51#-Q- sx8brodie # @ queue
52#-Q- sx8mercure #!/bin/ksh
53#-Q- sx8mercure ######################
54#-Q- sx8mercure ## SX8MERCURE   CEA ##
55#-Q- sx8mercure ######################
56#-Q- sx8mercure #PBS -N TS                   # Nom du job
57#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
58#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
59#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
60#-Q- sx8mercure #PBS -l cputim_job=24:00:00   # Limite temps a 2 heures
61#-Q- sx8mercure #PBS -q scalaire
62#-Q- sx9mercure #!/bin/ksh
63#-Q- sx9mercure ######################
64#-Q- sx9mercure ## SX9MERCURE   CEA ##
65#-Q- sx9mercure ######################
66#-Q- sx9mercure #PBS -N TS                   # Nom du job
67#-Q- sx9mercure #PBS -m a                    # message si abort
68#-Q- sx9mercure #PBS -j o                    # regroupement des stdout et stderr
69#-Q- sx9mercure #PBS -S /usr/bin/ksh         # shell de soumission
70#-Q- sx9mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
71#-Q- sx9mercure #PBS -l cputim_job=24:00:00   # Limite temps a 2 heures
72#-Q- sx9mercure #PBS -q scalaire
73#-Q- titane #!/bin/ksh
74#-Q- titane ######################
75#-Q- titane ## TITANE   CEA ##
76#-Q- titane ######################
77#-Q- titane #MSUB -r TS             # Nom du job               
78#-Q- titane #MSUB -N 1              # Reservation du noeud
79#-Q- titane #MSUB -n 1              # Reservation du processus
80#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
81#-Q- titane #MSUB -E "-j o"
82#-Q- titane #MSUB -E "-S /bin/ksh"
83#-Q- titane ##MSUB -e nco.out        # Sortie standard
84#-Q- titane ##MSUB -o nco.out        # Sortie standard
85#-Q- lxiv8 ######################
86#-Q- lxiv8 ## OBELIX      LSCE ##
87#-Q- lxiv8 ######################
88#-Q- lxiv8 #PBS -N TS
89#-Q- lxiv8 #PBS -m a
90#-Q- lxiv8 #PBS -j oe
91#-Q- lxiv8 #PBS -q medium
92#-Q- lxiv8 #PBS -o TS.$$
93#-Q- lxiv8 #PBS -S /bin/ksh
94#-Q- default #!/bin/ksh
95#-Q- default ##################
96#-Q- default ## DEFAULT HOST ##
97#-Q- default ##################
98
99# $Date$
100# $Author$
101# $Revision$
102# IPSL (2006)
103#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
104
105#set -eu
106#set -vx
107
108date
109
110#-Q- sx8brodie export OMP_NUM_THREADS=1
111#-Q- aix6 export OMP_NUM_THREADS=1
112
113########################################################################
114
115#D- Flag to determine if this job in a standalone mode
116#D- Default : value from AA_job if any
117StandAlone=${StandAlone:=true}
118
119#D- Low level debug : to bypass lib test checks and stack construction
120#D- Default : value from AA_job if any
121libIGCM=${libIGCM:=::modipsl::/libIGCM}
122# WARNING for StandAlone used : To run this script on some machine,
123# you must check MirrorlibIGCM variable in sys library.
124# If this variable is true, you must use libIGCM_POST path instead
125# of your running libIGCM directory.
126
127#D- Flag to determine allready produced time series. Empty if you start from the beginning
128#D- Default : Value from AA_job if any. Usefull in StandAlone case if you want to continue a time series
129CompletedFlag=${CompletedFlag:=}
130
131#D- Flag to determine task type this script will perform.
132#D- Possible Value : 2D, 3D, Chunck2D, Chunck3D
133#D- Default : Value from AA_job if any. Usefull in StandAlone case.
134TsTask=${TsTask:=2D}
135if [ X${TsTask} = Xempty ] ; then
136    TsTask=""
137fi
138
139#D- Flag to determine if rebuild process has been performed asynchronously
140#D- Possible value true or false.
141#D- If true raw files has allready been patched by rebuild job
142#D- If false create_ts will patch the raw files
143#D- Default : Value from AA_job if any. Usefull in StandAlone case.
144RebuildFrequency=${RebuildFrequency:=true}
145
146#D- Flag to determine job's output directory
147#D- Default : value from libIGCM_post.ksh if any
148POST_DIR=${POST_DIR:=${PBS_O_WORKDIR}}
149
150#D- Increased verbosity (1, 2, 3)
151#D- Default : value from AA_job if any
152Verbosity=${Verbosity:=3}
153
154#D- Low level debug : to bypass lib test checks and stack construction
155#D- Default : value from AA_job if any
156DEBUG_debug=${DEBUG_debug:=false}
157
158#D- TEMPORARY Flag to determine atmospheric resolution
159#D- Default : value from atmospheric driver if any
160RESOL_ATM=ALL
161
162#D- Flag to determine surface resolution
163#D- Default : value from surface driver if any
164RESOL_SRF=ALL
165
166#D- Flag to determine surface resolution
167#D- Default : value from surface driver if any
168RESOL_SBG=ALL
169
170#D- TEMPORARY Flag to determine ocean resolution
171#D- Default : value from ocean driver if any
172RESOL_OCE=${RESOL_OCE:=ORCA2}
173
174#D- TEMPORARY Flag to determine ice resolution
175#D- Default : value from ice driver if any
176RESOL_ICE=${RESOL_ICE:=ORCA2}
177
178#D- TEMPORARY Flag to determine marine biogeochemistry resolution
179#D- Default : value from ice driver if any
180RESOL_MBG=${RESOL_MBG:=ORCA2}
181
182########################################################################
183
184. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
185      ( ${DEBUG_debug} ) && IGCM_debug_Check
186. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
187     ( ${DEBUG_debug} ) && IGCM_card_Check
188. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
189     ( ${DEBUG_debug} ) && IGCM_date_Check
190#-------
191. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
192
193########################################################################
194
195#set -vx
196
197# Useful cleaning function
198MENAGE () 
199{
200    [ -f $3 ] && ( IGCM_sys_RshArchive rm -f $1/$2 ;)
201}
202
203########################################################################
204
205IGCM_sys_MkdirWork ${RUN_DIR_PATH}
206IGCM_sys_Cd ${RUN_DIR_PATH}
207
208if [ ${StandAlone} = true ] ; then
209    CARD_DIR=${SUBMIT_DIR}
210else
211    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
212    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
213fi
214
215#
216# First of all
217#
218IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
219typeset option
220for option in ${config_UserChoices[*]} ; do
221    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
222done
223#
224echo
225IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
226IGCM_debug_PrintVariables 3 config_UserChoices_JobName
227IGCM_debug_PrintVariables 3 config_UserChoices_LongName
228IGCM_debug_PrintVariables 3 config_UserChoices_TagName
229IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
230IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
231IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
232IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
233IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
234IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
235echo
236
237#==================================
238#R_SAVE : Job output directory
239if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
240    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
241    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
242    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
243else
244    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
245    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
246fi
247#
248# Determine component to take care of depending on kind of task create_ts will perform
249#
250( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
251#
252# Determine period for time series. Default : value from AA_job or from launch_TS if any
253#
254[ X${CompletedFlag} = X ] || CompletedFlag=$( IGCM_date_ConvertFormatToGregorian ${CompletedFlag} )
255
256DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
257#
258PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
259#
260# Determine Dimension of the produced time series : 2D or 3D
261if (   [ X${TsTask} = XChunck2D ] || [ X${TsTask} = X2D ] ) ; then
262    Dimension=2D
263elif ( [ X${TsTask} = XChunck3D ] || [ X${TsTask} = X3D ] ) ; then
264    Dimension=3D
265else
266    Dimension=""
267fi
268
269
270########################################################################
271#
272#      Depending on requested time series fill following variables :
273#
274#                           - LISTE_FILE_${comp}[*]
275#                           - LISTE_VARS_${file}[*]
276#                           - LISTE_AXIS_${file}[*]
277#                           - LISTE_PATCH_${file}[*]
278########################################################################
279
280#
281# For each selected component determine which files need post-processing
282#
283DoJob=false
284for comp in ${config_ListOfComponents[*]} ; do
285    #
286    ActiveComp=false
287    #
288    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
289    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
290    #
291    card=${CARD_DIR}/COMP/${compname}.card
292
293    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
294    #
295    ListFilesName=${compname}_OutputFiles_List
296    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
297    #
298    if [ X${FileName0} != X${NULL_STR} ] ; then
299        #
300        #IGCM_debug_Print 1 "Component      : ${compname}"
301        #
302        # INITIALISATION
303        #
304        typeset i
305        if ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) ; then
306            ((NbFiles=${FlagToRead}))
307            ((i=${NbFiles}))
308        else
309            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
310            i=2
311        fi
312        #
313        until [ $i -gt $NbFiles ]; do
314            #
315            eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
316            #
317            if [ X${flag_post} != XNONE ] ; then
318                #
319                # For each comp and each file who needs post-processing
320                # determine which variables need time series.
321                #
322                FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
323                IGCM_card_DefineArrayFromOption ${card}    Post_${FILE} TimeSeriesVars${Dimension}
324                IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension}
325                #
326                # If TimeSeriesVars list is empty we skip
327                #
328                if [ $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
329                    #
330                    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
331                    IGCM_debug_Print 3 "TimeSeriesVars${Dimension} for ${FILE} is empty"
332                    (( i=i+3 ))
333                    continue
334                    #
335                fi
336                #
337                # If files/variables has been switch off by ChunckJob${Dimension}=0 we skip
338                #
339                if [ X$( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = XOFF ] ; then
340                    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
341                    IGCM_debug_Print 3 "ChunckJob${Dimension}=OFF for ${FILE} so it has been switched off"
342                    (( i=i+3 ))
343                    continue
344                fi
345                #
346                # If we are not a Chunck type task, we skip files/variables handled by chunck task
347                #
348                if ( [ ! X${TsTask} = XChunck${Dimension} ] && [ ! X${TsTask} = X ] && [ ! XChunck${Dimension} = XChunck ] ) ; then
349                    if [ ! $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = NONE ] ; then
350                        IGCM_debug_Print 3 "Nothing to do for ${FILE} TimeSeriesVars${Dimension} according to ${card}"
351                        IGCM_debug_Print 3 "Let another chunck task do the job $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} )"
352                        (( i=i+3 ))
353                        continue
354                    fi
355                fi
356                #
357                # Now on we know we have things to do
358                #
359
360                #
361                #  We need coordinates axis to properly fill produced time series
362                #
363                IGCM_card_DefineArrayFromOption ${card} Post_${FILE} GatherWithInternal
364                #
365                if [ $( eval echo \${${compname}_Post_${FILE}_GatherWithInternal} ) = ${NULL_STR} ] ; then
366                    #
367                    IGCM_debug_Print 1 "ERROR !! We miss coordinate axis for ${FILE} according to ${card}"
368                    IGCM_debug_Print 1 "So no time series will be produced for ${FILE} !!"
369                    (( i=i+3 ))
370                    continue
371                    #
372                fi
373                #
374                # We need LIST of variables not allready produced (useful for standalone mode)
375                #
376                FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' )
377                case ${FlagDir} in
378                    *Y)  TS_Dir=TS_YE  ;;
379                    *M)  TS_Dir=TS_MO  ;;
380                    *D)  TS_Dir=TS_DA  ;;
381                    HF)  TS_Dir=TS_HF  ;;
382                    3H)  TS_Dir=TS_HF  ;;
383                    INS) TS_Dir=TS_INS ;;
384                esac
385                #
386                count=0
387                for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
388                    #
389                    DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir}
390                    TestedFile=${config_UserChoices_JobName}_${DateBegin}_${PeriodDateEnd}_${FlagDir}_${var}.nc
391                    #
392                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
393                    if [ ! $? = 0 ] ; then
394                        eval set +A LISTE_VARS_${FILE} \${LISTE_VARS_${FILE}[*]} ${var}
395                        ActiveComp=true
396                        (( count = count + 1 ))
397                    fi
398                done
399                #
400                if [ ${count} -gt 0 ] ; then
401                    #
402                    eval set +A LISTE_FILE_${comp} \${LISTE_FILE_${comp}[*]} ${FILE}
403                    eval set +A LISTE_AXIS_${FILE} \${${compname}_Post_${FILE}_GatherWithInternal[*]}
404                    #
405                    if [ ! X${RebuildFrequency} = Xtrue ] ; then
406                        IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
407                        eval set +A LISTE_PATCHES_${FILE} \${${compname}_Post_${FILE}_Patches[*]}
408                        if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
409                            for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
410                                if [ Xload${Patch} != X ] ; then
411                                    . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
412                                    eval load${Patch}=loaded
413                                fi
414                            done
415                        fi
416                    fi
417                fi
418            fi
419            (( i=i+3 ))
420        done
421    fi
422    #
423    if [ ${ActiveComp} = true ] ; then
424        set +A ActiveListOfComponents ${ActiveListOfComponents[*]} ${comp}
425    fi
426done
427
428set -A config_ListOfComponents ${ActiveListOfComponents[*]}
429[ ! -z "${ActiveListOfComponents}" ] && DoJob=true
430
431########################################################################
432#
433#                          DEFINE DATE FUNCTIONS
434#
435########################################################################
436
437# Give the end of the next $1 period from $2 date
438function create_ts_next_date {
439    IGCM_debug_PushStack "create_ts_next_date" $@
440    typeset Length
441    case ${config_UserChoices_PeriodLength} in
442        *Y|*y) 
443            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
444            IGCM_date_GetYearMonth ${1} year month
445            year=$( IGCM_date_SupressZeros ${year} )
446            (( Length=0 ))
447            (( i=0 ))
448            until [ $i -ge $PeriodLengthInYears ] ; do
449                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) 
450                (( i=i+1 ))
451            done
452            ;;
453        *M|*m) 
454            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
455            IGCM_date_GetYearMonth ${1} year month
456            year=$( IGCM_date_SupressZeros ${year} )
457            (( year0 = year ))
458            if [ $(( month + 1 )) -lt 13 ] ; then
459                month0=$(( month + 1 ))
460            else
461                month0=$(( month + 1 - 12 ))
462                (( year = year0 + 1 ))
463            fi
464            (( Length=0 ))
465            (( i=0 ))
466            until [ $i -ge $PeriodLengthInMonths ] ; do
467                if [ $(( month0 + i )) -lt 13 ] ; then
468                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) ))
469                else
470                    (( year = year0 + 1 ))
471                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) ))
472                fi
473                (( i=i+1 ))
474            done
475            ;;
476        *D|*d)
477            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
478        *)
479            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D."
480            IGCM_debug_Verif_Exit_Post ;;
481    esac
482    echo ${Length}
483
484    IGCM_debug_PopStack "create_ts_next_date"
485}
486
487# Give the end of the actual $1 period from $2 date
488function create_ts_begin_date {
489    IGCM_debug_PushStack "create_ts_begin_date" $@
490    typeset Length
491    case ${config_UserChoices_PeriodLength} in
492        *Y|*y) 
493            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
494            IGCM_date_GetYearMonth ${1} year month
495            year=$( IGCM_date_SupressZeros ${year} )
496            if [ X${2} = Xend ] ; then
497                (( year = year - PeriodLengthInYears + 1))
498            fi
499            (( Length=0 ))
500            (( i=0 ))
501            until [ $i -ge $PeriodLengthInYears ] ; do
502                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
503                (( i=i+1 ))
504            done
505            ;;
506        *M|*m) 
507            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
508            IGCM_date_GetYearMonth ${1} year month
509            year=$( IGCM_date_SupressZeros ${year} )
510            if [ X${2} = Xend ] ; then
511                (( month = month - PeriodLengthInMonths + 1 ))
512            fi     
513            (( year0 = year ))
514            if [ $month -le 0 ] ; then
515                (( month = month + 12 ))
516                year=$( printf "%04i\n" $(( year - 1 )) )
517            fi
518            month=$( printf "%02i\n" ${month} )
519            (( Length=0 ))
520            (( i=0 ))
521            until [ $i -ge $PeriodLengthInMonths ] ; do
522                if [ $(( month + i )) -lt 13 ] ; then
523                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))
524                else
525                    (( year = year0 + 1 ))
526                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))
527                fi
528                (( i=i+1 ))
529            done
530            ;;
531        *D|*d)
532            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
533        *)
534            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D."
535            IGCM_debug_Verif_Exit_Post ;;
536    esac
537    echo ${Length}
538
539    IGCM_debug_PopStack "create_ts_begin_date"
540}
541
542########################################################################
543#
544#               IS THERE SOME ALLREADY PRODUCED TIME SERIES ?
545#                 IF SO BRING THEM IN THE WORKING DIRECTORY
546#
547# PS : Keep in mind that IGCM_sys_Get here is a weak link :
548#      - especially for IDRiS
549#      - no special protection against "command too long" !
550#      - libIGCM_sys should handle that or modify following code part
551#
552########################################################################
553
554if [ ${StandAlone} != true ] ; then
555    Running_Flag=$( IGCM_sys_RshMaster "IGCM_card_DefineVariableFromOption \
556       ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning ; \
557       echo \${run_PostProcessing_TimeSeriesRunning}" )
558
559    #if [ X${Running_Flag} = Xy ] ; then
560    #    # Time Series Job allready running
561    #   IGCM_debug_Print 1 "Time Series Job allready running exit"
562    #   exit
563    #fi
564    # Now run.card know we are running
565
566
567
568
569    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "y"
570
571
572
573
574
575    # Get information from last execution
576    #CompletedFlag=$( IGCM_sys_RshMaster \
577    #   "IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted ;\
578    #        echo \${run_PostProcessing_TimeSeriesCompleted}" )
579fi
580
581# Is it the first submission or not ?
582
583if ( [ X${CompletedFlag} = X ] || [ X${CompletedFlag} = X$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 ) ] ) ; then
584    # First Time Series Submission
585    FIRST_PASS=TRUE
586    Length=$( create_ts_begin_date ${DateBegin} begin)
587    DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) )
588else
589    # Last Completed Time Series
590    FIRST_PASS=FALSE
591    DATE_FIN_JOB_B=${CompletedFlag}
592    date=${DateBegin}_${DATE_FIN_JOB_B}
593    for comp in ${config_ListOfComponents[*]} ; do
594        #
595        IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp}
596        #
597        IGCM_sys_Cd ${RUN_DIR_PATH}/${comp}
598        #
599        #set -A liste_file
600        unset liste_file
601        #
602        file_path=${R_SAVE}/${comp}/Analyse
603        #
604        i=0
605        file=${NULL_STR}
606        #
607        for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
608            #
609            # Determine in which output can we find file
610            # IE : Analyse/TS or Analyse/DA2TS or ...
611            #
612            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
613            case ${FlagDir} in
614                *Y)  TS_Dir=TS_YE  ;;
615                *M)  TS_Dir=TS_MO  ;;
616                *D)  TS_Dir=TS_DA  ;;
617                HF)  TS_Dir=TS_HF  ;;
618                3H)  TS_Dir=TS_HF  ;;
619                INS) TS_Dir=TS_INS ;;
620            esac
621            for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do
622                #
623                #set +A liste_file ${liste_file[*]} ${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc
624                liste_file[${#liste_file[*]}]=${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc
625                #
626            done
627        done
628        if [ X${file} != X${NULL_STR} ] ; then
629            IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp}
630            ExitFlag=false
631            IGCM_debug_Verif_Exit_Post
632        fi
633    done
634    #
635    LEVEL=0
636    #
637fi
638
639########################################################################
640#
641#                          DEFINE LOOP PARAMETERS
642#
643########################################################################
644
645DATE_COUNT=${DATE_FIN_JOB_B}
646DATE_FIN_JOB_B_LOOP=${DATE_FIN_JOB_B}
647
648( [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] ) && NBRE_FILE_TOT=0 || NBRE_FILE_TOT=1
649
650if [ ${DoJob} = true ] ; then
651    while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do
652        (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 ))
653        Length=$( create_ts_next_date ${DATE_COUNT} )
654        DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} )
655    done
656else
657    NBRE_FILE_TOT=0
658fi
659
660if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then
661    NBRE_TOUR=1
662elif [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then
663    let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT} 
664else
665    let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT}+1
666fi
667
668CURRENT_LOOP=1
669# THIS LOOP GIVES PARAMETERS FOR THE DATE'S LOOP ie : DATE_COURANTE, DATE_FIN.
670# WE HAVE 3 LEVELS
671#    - LEVEL 1 : JUST ONE LOOP TO COMPLETE
672#    - LEVEL 2 : WE ARE IN THE "DEEP" LOOP
673#    - LEVEL 3 : WE ARE IN THE LAST LOOP
674
675while [ ${CURRENT_LOOP} -le  ${NBRE_TOUR} ] ; do
676     
677    if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then 
678        # - LEVEL 1 : JUST ONE LOOP TO COMPLETE
679        NBRE_FILE_LOOP=${NBRE_FILE_TOT}
680
681        if [ ${FIRST_PASS} = TRUE ] ; then
682            DATE_COURANTE=${DATE_FIN_JOB_B_LOOP}
683        else
684            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )
685            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
686        fi
687
688        DATE_FIN=${PeriodDateEnd}
689        DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP}
690
691        [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
692        [ -n "${LEVEL}" ] && FLAG_B="TRUE" || FLAG_B="FALSE"
693
694        LEVEL=1
695        DEPOT="TRUE"     
696    elif [ ${CURRENT_LOOP} -ne  ${NBRE_TOUR} ] ; then
697        # - LEVEL 2 : WE ARE IN THE "DEEP" LOOP
698        NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
699
700        if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then
701            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )
702            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
703        elif [ -z "${DATE_COURANTE}" ] ; then
704            DATE_COURANTE=${DATE_FIN_JOB_B}
705        else
706            Length=$( create_ts_next_date ${DATE_FIN} )
707            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
708        fi
709         
710        (( TotLength = 0 ))
711        COMPTEUR=1
712        DATE_LOOP=${DATE_COURANTE}
713
714        while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do
715            #
716            Length=$( create_ts_next_date ${DATE_LOOP} )
717            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} )
718            (( TotLength = TotLength + Length ))
719            (( COMPTEUR = COMPTEUR + 1 ))
720            #
721        done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done
722        DATE_FIN=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} ${TotLength} )
723
724        [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
725        [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] && FLAG_B="TRUE" || [ ${CURRENT_LOOP} -gt 1 ] && FLAG_B="TRUE" || FLAG_B="FALSE"
726        DEPOT="FALSE"
727        LEVEL=2
728    else
729        # - LEVEL 3 : WE ARE IN THE LAST LOOP
730        NBRE_FILE_LOOP=$(( ${NBRE_FILE_TOT} % ( ${UNIX_MAX_LIMIT} * ( ${CURRENT_LOOP} - 1 ) ) ))
731        [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
732
733        Length=$( create_ts_next_date ${DATE_FIN} )
734        DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
735        DATE_FIN=${PeriodDateEnd}
736        [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
737
738        LEVEL=3
739        DEPOT="TRUE"
740        FLAG_B="TRUE"
741    fi
742
743    # THEN FOR EACH FILE TYPE WE LOOP BETWEEN DATE_COURANTE AND DATE_FIN.
744    for comp in ${config_ListOfComponents[*]} ; do
745        #
746        IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp}
747        #
748        IGCM_sys_Cd ${RUN_DIR_PATH}/${comp}
749        #
750        eval R_OUT_${comp}=${R_SAVE}/${comp}
751        #
752        i=0
753        #
754        for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
755            #
756            # Determine in which output can we find file
757            # IE : Output/MO or Output/DA or ...
758            #
759            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
760            case ${FlagDir} in
761                *Y)    TS_Dir=TS_YE  ; FreqDir=YE  ;;
762                *M)    TS_Dir=TS_MO  ; FreqDir=MO  ;;
763                *D)    TS_Dir=TS_DA  ; FreqDir=DA  ;;
764                HF)    TS_Dir=TS_HF  ; FreqDir=HF  ;;
765                3H)    TS_Dir=TS_HF  ; FreqDir=HF  ;;
766                INS)   TS_Dir=TS_INS ; FreqDir=INS ;;
767                *) 
768                       IGCM_debug_Print 1 "Error in FlagDir=${FlagDir} for file ${file}."
769                       IGCM_sys_Exit "Job create_ts" ;;
770            esac
771
772            # Initialize array
773            #set -A liste_file
774            #set -A liste_file_tmp
775            unset liste_file
776            unset liste_file_tmp
777            eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
778
779            COMPTEUR=1
780            DATE_LOOP=${DATE_COURANTE}
781
782            while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do
783                #
784                Length1=$( create_ts_begin_date ${DATE_LOOP} end)
785                DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP}
786
787                Length2=$( create_ts_next_date ${DATE_LOOP} end)
788                DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} )
789
790                #set +A liste_file ${liste_file[*]} ${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
791                #set +A liste_file_tmp ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
792                liste_file[${#liste_file[*]}]=${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
793                liste_file_tmp[${#liste_file_tmp[*]}]=${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
794                (( COMPTEUR = COMPTEUR + 1 ))
795                #
796            done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done
797            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} -${Length2} )
798
799            # Get selected files
800            IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp}
801            ExitFlag=false
802            IGCM_debug_Verif_Exit_Post
803
804            # Apply IGCM_Patch if needed
805            if [ ! X${RebuildFrequency} = Xtrue ] ; then
806                if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
807                    for file_t in $( eval echo ${liste_file_tmp[*]} ); do               
808                        for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
809                            IGCM_${Patch} ${file_t}
810                        done
811                    done
812                fi
813            fi
814
815            # WE CAN CONCATENATE FILES AT THIS POINT
816            [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC}
817            Length=$( create_ts_begin_date ${DATE_COURANTE} end)
818            DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) )
819            DATE_BUILD=${DATE_BUILD1}_${DATE_FIN}
820            DATE_BUILD_END=${DateBegin}_${DATE_FIN}
821
822            liste_coord=" "
823            for axis in $( eval echo \${LISTE_AXIS_${file}[*]} ); do
824              liste_coord=${liste_coord}${axis}","
825            done
826
827            # Time axis must be the last dimension
828            time_axis=${axis}
829
830            # SWITCH BETWEEN MODEL TO FIT PARTICULAR CASE
831            for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do
832                #
833                IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
834                #
835#                 # Change time axis name to be CF compliant
836#                 if [ ${time_axis} != time_counter ]; then
837#                   IGCM_sys_ncrename -O -v ${time_axis},time_counter ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
838#                 fi
839                #
840                if [ "${FLAG_B}" = "TRUE" ] ; then
841                    # WE CONCATENATE WITH EXISTING FILES
842                    file1=${config_UserChoices_JobName}_${DATE_BUILD_B}_${FlagDir}_${var}.nc
843                    file2=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
844                    file_out=${config_UserChoices_JobName}_${DATE_BUILD_END}_${FlagDir}_${var}.nc
845                    IGCM_sys_ncrcat --hst ${file1} ${file2} ${file_out}
846                    #
847                    IGCM_sys_Rm ${file1} ${file2}
848                fi
849
850                #
851                if [ "${DEPOT}" = "TRUE" ] ; then
852                    # WE PUT FINAL FILE ON FILE SYSTEM
853                    [ "${FLAG_B}" = "FALSE" ] && file_out=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
854                    #${ncatted} -a modulo,time_counter,c,c," " ${file_out}
855                    file_before=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc
856                    #
857                    eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}}/Analyse/${TS_Dir}/${file_out}
858                    [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file_before} ${file_out}
859                    #
860                    if [ ${FlagDir} = "1M" ] ; then
861                        # Compute yearly average considering calendar
862                        file_before_YE=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_1Y_${var}.nc
863                        file_out_YE=${config_UserChoices_JobName}_${DATE_BUILD_END}_1Y_${var}.nc
864                        #
865                        # Set date of the mid year to 01/07 at 00:00
866                        # better than default where the date information in the outputfile is the date of the last contributing time step in the input file
867                        IGCM_sys_cdo -settime,00:00 -setday,1 -setmon,7 -settunits,days -divdpy -yearsum -muldpm ${file_out} ${file_out_YE}
868                        #
869                        eval IGCM_sys_Put_Out ${file_out_YE} \${R_OUT_${comp}}/Analyse/TS_MO_YE/${file_out_YE}
870                        [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/TS_MO_YE/ ${file_before_YE} ${file_out_YE}
871                    fi
872                    #
873                    IGCM_sys_Rm ${file_out}
874                    #
875                fi
876                #
877                ExitFlag=false
878                IGCM_debug_Verif_Exit_Post
879            done     # for var in ${liste_var} ; do
880            IGCM_sys_Rm ${liste_file_tmp[*]}
881        done         # for file in ${liste_file_brut} do
882    done             # for comp in ${config_ListOfComponents[*]} ; do
883    ExitFlag=false
884    IGCM_debug_Verif_Exit_Post
885    # GO AHEAD IN DEEPEST LOOP
886    (( CURRENT_LOOP = CURRENT_LOOP + 1 ))
887done                 # while [ ${CURRENT_LOOP} -le  ${NBRE_TOUR} ] do
888# FINISH
889
890# DODS copy
891for comp in ${config_ListOfComponents[*]} ; do
892    for TS_Dir in TS_YE TS_MO TS_MO_YE TS_DA TS_HF TS_INS ; do
893        IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/${TS_Dir}
894        [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/${TS_Dir}
895    done
896done
897
898export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
899export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; export RESOL_SBG
900
901listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
902export listVarEnv
903
904#D-
905# --------------------------------------------------------------------
906#D- Test if all was right
907# --------------------------------------------------------------------
908IGCM_debug_Verif_Exit_Post
909# --------------------------------------------------------------------
910#D- Submit MONITORING
911# --------------------------------------------------------------------
912( [ X${TsTask} = X2D ] || [ X${TsTask} = X ] ) && IGCM_sys_QsubPost monitoring
913
914#D-
915# --------------------------------------------------------------------
916#D- Update the run.card
917# --------------------------------------------------------------------
918if [ ${StandAlone} != true ] ; then
919    # Put in run.card end period of time series
920    [ X"${DATE_FIN}" = X ] || IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted "${DATE_FIN}"
921    # We have finish the job !
922    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "n"
923fi
924
925# Clean RUN_DIR_PATH (necessary for cesium)
926IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
927
928date
Note: See TracBrowser for help on using the repository browser.