source: trunk/libIGCM/AA_create_ts @ 437

Last change on this file since 437 was 436, checked in by sdipsl, 13 years ago

Some more break points ; just in case...

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