source: trunk/libIGCM/AA_create_ts @ 392

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

Step 2/3 toward CompletedFlag? auto-detection, part of ticket #40.
Tests OK. For chunck2D and chunck3D time series.

This should close ticket #42

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