source: trunk/libIGCM/AA_create_ts @ 426

Last change on this file since 426 was 426, checked in by mmaipsl, 13 years ago

Add login shell path for platine jobs.

  • 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.6 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
230if [ ${StandAlone} = true ] ; then
231    CARD_DIR=${SUBMIT_DIR}
232else
233    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
234    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
235fi
236
237#
238# First of all
239#
240IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
241typeset option
242for option in ${config_UserChoices[*]} ; do
243    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
244done
245#
246echo
247IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
248IGCM_debug_PrintVariables 3 config_UserChoices_JobName
249IGCM_debug_PrintVariables 3 config_UserChoices_LongName
250IGCM_debug_PrintVariables 3 config_UserChoices_TagName
251IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
252IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
253IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
254IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
255IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
256IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
257echo
258
259#==================================
260#R_SAVE : Job output directory
261if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
262    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
263    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
264    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
265else
266    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
267    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
268fi
269#
270# Determine component to take care of depending on kind of task create_ts will perform
271#
272[ ${CompToRead} ] && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
273#
274# Determine period for time series. Default : value from AA_job or from launch_TS if any
275#
276[ X${CompletedFlag} = X ] || CompletedFlag=$( IGCM_date_ConvertFormatToGregorian ${CompletedFlag} )
277
278DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
279#
280PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
281#
282# Determine Dimension of the produced time series : 2D or 3D
283if (   [ X${TsTask} = XChunck2D ] || [ X${TsTask} = X2D ] ) ; then
284    Dimension=2D
285elif ( [ X${TsTask} = XChunck3D ] || [ X${TsTask} = X3D ] ) ; then
286    Dimension=3D
287else
288    Dimension=""
289fi
290
291
292########################################################################
293#
294#      Depending on requested time series fill following variables :
295#
296#                           - LISTE_FILE_${comp}[*]
297#                           - LISTE_VARS_${file}[*]
298#                           - LISTE_AXIS_${file}[*]
299#                           - LISTE_PATCH_${file}[*]
300########################################################################
301
302#
303# For each selected component determine which files need post-processing
304#
305DoJob=false
306for comp in ${config_ListOfComponents[*]} ; do
307    #
308    ActiveComp=false
309    #
310    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
311    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
312    #
313    card=${CARD_DIR}/COMP/${compname}.card
314
315    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
316    #
317    ListFilesName=${compname}_OutputFiles_List
318    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
319    #
320    if [ X${FileName0} != X${NULL_STR} ] ; then
321        #
322        #IGCM_debug_Print 1 "Component      : ${compname}"
323        #
324        # INITIALISATION
325        #
326        typeset i
327        if [ ${FlagToRead} ] ; then
328            ((NbFiles=${FlagToRead}))
329            ((i=${NbFiles}))
330        else
331            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
332            i=2
333        fi
334        #
335        until [ $i -gt $NbFiles ]; do
336            #
337            eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
338            #
339            if [ X${flag_post} != XNONE ] ; then
340                #
341                # For each comp and each file who needs post-processing
342                # determine which variables need time series.
343                #
344                FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
345                IGCM_card_DefineArrayFromOption ${card}    Post_${FILE} TimeSeriesVars${Dimension}
346                IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension}
347                #
348                # If TimeSeriesVars list is empty we skip
349                #
350                if [ $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
351                    #
352                    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
353                    IGCM_debug_Print 3 "TimeSeriesVars${Dimension} for ${FILE} is empty"
354                    (( i=i+3 ))
355                    continue
356                    #
357                fi
358                #
359                # If files/variables has been switch off by ChunckJob${Dimension}=0 we skip
360                #
361                if [ X$( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = XOFF ] ; then
362                    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
363                    IGCM_debug_Print 3 "ChunckJob${Dimension}=OFF for ${FILE} so it has been switched off"
364                    (( i=i+3 ))
365                    continue
366                fi
367                #
368                # If we are not a Chunck type task, we skip files/variables handled by chunck task
369                #
370                if ( [ ! X${TsTask} = XChunck${Dimension} ] && [ ! X${TsTask} = X ] && [ ! XChunck${Dimension} = XChunck ] ) ; then
371                    if [ ! $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = NONE ] ; then
372                        IGCM_debug_Print 3 "Nothing to do for ${FILE} TimeSeriesVars${Dimension} according to ${card}"
373                        IGCM_debug_Print 3 "Let another chunck task do the job $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} )"
374                        (( i=i+3 ))
375                        continue
376                    fi
377                fi
378                #
379                # Now on we know we have things to do
380                #
381
382                #
383                #  We need coordinates axis to properly fill produced time series
384                #
385                IGCM_card_DefineArrayFromOption ${card} Post_${FILE} GatherWithInternal
386                #
387                if [ $( eval echo \${${compname}_Post_${FILE}_GatherWithInternal} ) = ${NULL_STR} ] ; then
388                    #
389                    IGCM_debug_Print 1 "ERROR !! We miss coordinate axis for ${FILE} according to ${card}"
390                    IGCM_debug_Print 1 "So no time series will be produced for ${FILE} !!"
391                    (( i=i+3 ))
392                    continue
393                    #
394                fi
395                #
396                # We need LIST of variables not allready produced (useful for standalone mode)
397                #
398                FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' )
399                case ${FlagDir} in
400                    *Y)  TS_Dir=TS_YE  ;;
401                    *M)  TS_Dir=TS_MO  ;;
402                    *D)  TS_Dir=TS_DA  ;;
403                    HF)  TS_Dir=TS_HF  ;;
404                    3H)  TS_Dir=TS_HF  ;;
405                    INS) TS_Dir=TS_INS ;;
406                esac
407                #
408                count=0
409                for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
410                    #
411                    DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir}
412                    TestedFile=${config_UserChoices_JobName}_${DateBegin}_${PeriodDateEnd}_${FlagDir}_${var}.nc
413                    #
414                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
415                    if [ ! $? = 0 ] ; then
416                        eval set +A LISTE_VARS_${FILE} \${LISTE_VARS_${FILE}[*]} ${var}
417                        ActiveComp=true
418                        (( count = count + 1 ))
419                    fi
420                done
421                #
422                if [ ${count} -gt 0 ] ; then
423                    #
424                    eval set +A LISTE_FILE_${comp} \${LISTE_FILE_${comp}[*]} ${FILE}
425                    eval set +A LISTE_AXIS_${FILE} \${${compname}_Post_${FILE}_GatherWithInternal[*]}
426                    #
427                    if [ ! X${RebuildFrequency} = Xtrue ] ; then
428                        IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
429                        eval set +A LISTE_PATCHES_${FILE} \${${compname}_Post_${FILE}_Patches[*]}
430                        if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
431                            for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
432                                if [ Xload${Patch} != X ] ; then
433                                    . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
434                                    eval load${Patch}=loaded
435                                fi
436                            done
437                        fi
438                    fi
439                fi
440            fi
441            (( i=i+3 ))
442        done
443    fi
444    #
445    if [ ${ActiveComp} = true ] ; then
446        set +A ActiveListOfComponents ${ActiveListOfComponents[*]} ${comp}
447    fi
448done
449
450set -A config_ListOfComponents ${ActiveListOfComponents[*]}
451[ ! -z "${ActiveListOfComponents}" ] && DoJob=true
452
453########################################################################
454#
455#                          DEFINE DATE FUNCTIONS
456#
457########################################################################
458
459# Give the end of the next $1 period from $2 date
460function create_ts_next_date {
461    IGCM_debug_PushStack "create_ts_next_date" $@
462    typeset Length
463    case ${config_UserChoices_PeriodLength} in
464        *Y|*y) 
465            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
466            IGCM_date_GetYearMonth ${1} year month
467            year=$( IGCM_date_SupressZeros ${year} )
468            (( Length=0 ))
469            (( i=0 ))
470            until [ $i -ge $PeriodLengthInYears ] ; do
471                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) 
472                (( i=i+1 ))
473            done
474            ;;
475        *M|*m) 
476            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
477            IGCM_date_GetYearMonth ${1} year month
478            year=$( IGCM_date_SupressZeros ${year} )
479            (( year0 = year ))
480            if [ $(( month + 1 )) -lt 13 ] ; then
481                month0=$(( month + 1 ))
482            else
483                month0=$(( month + 1 - 12 ))
484                (( year = year0 + 1 ))
485            fi
486            (( Length=0 ))
487            (( i=0 ))
488            until [ $i -ge $PeriodLengthInMonths ] ; do
489                if [ $(( month0 + i )) -lt 13 ] ; then
490                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) ))
491                else
492                    (( year = year0 + 1 ))
493                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) ))
494                fi
495                (( i=i+1 ))
496            done
497            ;;
498        *D|*d)
499            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
500        *)
501            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D."
502            IGCM_debug_Verif_Exit_Post ;;
503    esac
504    echo ${Length}
505
506    IGCM_debug_PopStack "create_ts_next_date"
507}
508
509# Give the end of the actual $1 period from $2 date
510function create_ts_begin_date {
511    IGCM_debug_PushStack "create_ts_begin_date" $@
512    typeset Length
513    case ${config_UserChoices_PeriodLength} in
514        *Y|*y) 
515            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
516            IGCM_date_GetYearMonth ${1} year month
517            year=$( IGCM_date_SupressZeros ${year} )
518            if [ X${2} = Xend ] ; then
519                (( year = year - PeriodLengthInYears + 1))
520            fi
521            (( Length=0 ))
522            (( i=0 ))
523            until [ $i -ge $PeriodLengthInYears ] ; do
524                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
525                (( i=i+1 ))
526            done
527            ;;
528        *M|*m) 
529            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
530            IGCM_date_GetYearMonth ${1} year month
531            year=$( IGCM_date_SupressZeros ${year} )
532            if [ X${2} = Xend ] ; then
533                (( month = month - PeriodLengthInMonths + 1 ))
534            fi     
535            (( year0 = year ))
536            if [ $month -le 0 ] ; then
537                (( month = month + 12 ))
538                year=$( printf "%04i\n" $(( year - 1 )) )
539            fi
540            month=$( printf "%02i\n" ${month} )
541            (( Length=0 ))
542            (( i=0 ))
543            until [ $i -ge $PeriodLengthInMonths ] ; do
544                if [ $(( month + i )) -lt 13 ] ; then
545                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))
546                else
547                    (( year = year0 + 1 ))
548                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))
549                fi
550                (( i=i+1 ))
551            done
552            ;;
553        *D|*d)
554            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
555        *)
556            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D."
557            IGCM_debug_Verif_Exit_Post ;;
558    esac
559    echo ${Length}
560
561    IGCM_debug_PopStack "create_ts_begin_date"
562}
563
564########################################################################
565#
566#               IS THERE SOME ALLREADY PRODUCED TIME SERIES ?
567#                 IF SO BRING THEM IN THE WORKING DIRECTORY
568#
569# PS : Keep in mind that IGCM_sys_Get here is a weak link :
570#      - especially for IDRiS
571#      - no special protection against "command too long" !
572#      - libIGCM_sys should handle that or modify following code part
573#
574########################################################################
575
576if [ ${StandAlone} != true ] ; then
577    Running_Flag=$( IGCM_sys_RshMaster "IGCM_card_DefineVariableFromOption \
578       ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning ; \
579       echo \${run_PostProcessing_TimeSeriesRunning}" )
580
581    #if [ X${Running_Flag} = Xy ] ; then
582    #    # Time Series Job allready running
583    #   IGCM_debug_Print 1 "Time Series Job allready running exit"
584    #   exit
585    #fi
586    # Now run.card know we are running
587
588
589
590
591    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "y"
592
593
594
595
596
597    # Get information from last execution
598    #CompletedFlag=$( IGCM_sys_RshMaster \
599    #   "IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted ;\
600    #        echo \${run_PostProcessing_TimeSeriesCompleted}" )
601fi
602
603# Is it the first submission or not ?
604
605if ( [ X${CompletedFlag} = X ] || [ X${CompletedFlag} = X$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 ) ] ) ; then
606    # First Time Series Submission
607    FIRST_PASS=TRUE
608    Length=$( create_ts_begin_date ${DateBegin} begin)
609    DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) )
610else
611    # Last Completed Time Series
612    FIRST_PASS=FALSE
613    DATE_FIN_JOB_B=${CompletedFlag}
614    date=${DateBegin}_${DATE_FIN_JOB_B}
615    for comp in ${config_ListOfComponents[*]} ; do
616        #
617        IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp}
618        #
619        IGCM_sys_Cd ${RUN_DIR_PATH}/${comp}
620        #
621        #set -A liste_file
622        unset liste_file
623        #
624        file_path=${R_SAVE}/${comp}/Analyse
625        #
626        i=0
627        file=${NULL_STR}
628        #
629        for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
630            #
631            # Determine in which output can we find file
632            # IE : Analyse/TS or Analyse/DA2TS or ...
633            #
634            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
635            case ${FlagDir} in
636                *Y)  TS_Dir=TS_YE  ;;
637                *M)  TS_Dir=TS_MO  ;;
638                *D)  TS_Dir=TS_DA  ;;
639                HF)  TS_Dir=TS_HF  ;;
640                3H)  TS_Dir=TS_HF  ;;
641                INS) TS_Dir=TS_INS ;;
642            esac
643            for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do
644                #
645                #set +A liste_file ${liste_file[*]} ${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc
646                liste_file[${#liste_file[*]}]=${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc
647                #
648            done
649        done
650        if [ X${file} != X${NULL_STR} ] ; then
651            IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp}
652            # Even if some files are missing we tried to continue
653            # Either ListVar in compname.card are asked nut not present in original history file
654            # Either a previous TS task failed
655            ExitFlag=false
656            IGCM_debug_Verif_Exit_Post
657        fi
658    done
659    #
660    LEVEL=0
661    #
662fi
663
664########################################################################
665#
666#                          DEFINE LOOP PARAMETERS
667#
668########################################################################
669
670DATE_COUNT=${DATE_FIN_JOB_B}
671DATE_FIN_JOB_B_LOOP=${DATE_FIN_JOB_B}
672
673( [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] ) && NBRE_FILE_TOT=0 || NBRE_FILE_TOT=1
674
675if [ ${DoJob} = true ] ; then
676    while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do
677        (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 ))
678        Length=$( create_ts_next_date ${DATE_COUNT} )
679        DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} )
680    done
681else
682    NBRE_FILE_TOT=0
683fi
684
685if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then
686    NBRE_TOUR=1
687elif [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then
688    let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT} 
689else
690    let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT}+1
691fi
692
693CURRENT_LOOP=1
694# THIS LOOP GIVES PARAMETERS FOR THE DATE'S LOOP ie : DATE_COURANTE, DATE_FIN.
695# WE HAVE 3 LEVELS
696#    - LEVEL 1 : JUST ONE LOOP TO COMPLETE
697#    - LEVEL 2 : WE ARE IN THE "DEEP" LOOP
698#    - LEVEL 3 : WE ARE IN THE LAST LOOP
699
700while [ ${CURRENT_LOOP} -le  ${NBRE_TOUR} ] ; do
701     
702    if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then 
703        # - LEVEL 1 : JUST ONE LOOP TO COMPLETE
704        NBRE_FILE_LOOP=${NBRE_FILE_TOT}
705
706        if [ ${FIRST_PASS} = TRUE ] ; then
707            DATE_COURANTE=${DATE_FIN_JOB_B_LOOP}
708        else
709            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )
710            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
711        fi
712
713        DATE_FIN=${PeriodDateEnd}
714        DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP}
715
716        [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
717        [ -n "${LEVEL}" ] && FLAG_B="TRUE" || FLAG_B="FALSE"
718
719        LEVEL=1
720        DEPOT="TRUE"     
721    elif [ ${CURRENT_LOOP} -ne  ${NBRE_TOUR} ] ; then
722        # - LEVEL 2 : WE ARE IN THE "DEEP" LOOP
723        NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
724
725        if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then
726            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )
727            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
728        elif [ -z "${DATE_COURANTE}" ] ; then
729            DATE_COURANTE=${DATE_FIN_JOB_B}
730        else
731            Length=$( create_ts_next_date ${DATE_FIN} )
732            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
733        fi
734         
735        (( TotLength = 0 ))
736        COMPTEUR=1
737        DATE_LOOP=${DATE_COURANTE}
738
739        while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do
740            #
741            Length=$( create_ts_next_date ${DATE_LOOP} )
742            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} )
743            (( TotLength = TotLength + Length ))
744            (( COMPTEUR = COMPTEUR + 1 ))
745            #
746        done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done
747        DATE_FIN=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} ${TotLength} )
748
749        [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
750        [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] && FLAG_B="TRUE" || [ ${CURRENT_LOOP} -gt 1 ] && FLAG_B="TRUE" || FLAG_B="FALSE"
751        DEPOT="FALSE"
752        LEVEL=2
753    else
754        # - LEVEL 3 : WE ARE IN THE LAST LOOP
755        NBRE_FILE_LOOP=$(( ${NBRE_FILE_TOT} % ( ${UNIX_MAX_LIMIT} * ( ${CURRENT_LOOP} - 1 ) ) ))
756        [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
757
758        Length=$( create_ts_next_date ${DATE_FIN} )
759        DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
760        DATE_FIN=${PeriodDateEnd}
761        [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
762
763        LEVEL=3
764        DEPOT="TRUE"
765        FLAG_B="TRUE"
766    fi
767
768    # THEN FOR EACH FILE TYPE WE LOOP BETWEEN DATE_COURANTE AND DATE_FIN.
769    for comp in ${config_ListOfComponents[*]} ; do
770        #
771        IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp}
772        #
773        IGCM_sys_Cd ${RUN_DIR_PATH}/${comp}
774        #
775        eval R_OUT_${comp}=${R_SAVE}/${comp}
776        #
777        i=0
778        #
779        for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
780            #
781            # Determine in which output can we find file
782            # IE : Output/MO or Output/DA or ...
783            #
784            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
785            case ${FlagDir} in
786                *Y)    TS_Dir=TS_YE  ; FreqDir=YE  ;;
787                *M)    TS_Dir=TS_MO  ; FreqDir=MO  ;;
788                *D)    TS_Dir=TS_DA  ; FreqDir=DA  ;;
789                HF)    TS_Dir=TS_HF  ; FreqDir=HF  ;;
790                3H)    TS_Dir=TS_HF  ; FreqDir=HF  ;;
791                INS)   TS_Dir=TS_INS ; FreqDir=INS ;;
792                *) 
793                       IGCM_debug_Print 1 "Error in FlagDir=${FlagDir} for file ${file}."
794                       IGCM_sys_Exit "Job create_ts" ;;
795            esac
796
797            # Initialize array
798            #set -A liste_file
799            #set -A liste_file_tmp
800            unset liste_file
801            unset liste_file_tmp
802            eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
803
804            COMPTEUR=1
805            DATE_LOOP=${DATE_COURANTE}
806
807            while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do
808                #
809                Length1=$( create_ts_begin_date ${DATE_LOOP} end)
810                DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP}
811
812                Length2=$( create_ts_next_date ${DATE_LOOP} end)
813                DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} )
814
815                #set +A liste_file ${liste_file[*]} ${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
816                #set +A liste_file_tmp ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
817                liste_file[${#liste_file[*]}]=${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
818                liste_file_tmp[${#liste_file_tmp[*]}]=${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
819                (( COMPTEUR = COMPTEUR + 1 ))
820                #
821            done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done
822            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} -${Length2} )
823
824            # Get selected files
825            IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp}
826            IGCM_debug_Verif_Exit_Post
827
828            # Apply IGCM_Patch if needed
829            if [ ! X${RebuildFrequency} = Xtrue ] ; then
830                if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
831                    for file_t in $( eval echo ${liste_file_tmp[*]} ); do               
832                        for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
833                            IGCM_${Patch} ${file_t}
834                            IGCM_debug_Verif_Exit_Post
835                        done
836                    done
837                fi
838            fi
839
840            # WE CAN CONCATENATE FILES AT THIS POINT
841            [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC}
842            Length=$( create_ts_begin_date ${DATE_COURANTE} end)
843            DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) )
844            DATE_BUILD=${DATE_BUILD1}_${DATE_FIN}
845            DATE_BUILD_END=${DateBegin}_${DATE_FIN}
846
847            liste_coord=" "
848            for axis in $( eval echo \${LISTE_AXIS_${file}[*]} ); do
849              liste_coord=${liste_coord}${axis}","
850            done
851
852            # Time axis must be the last dimension
853            time_axis=${axis}
854
855            # SWITCH BETWEEN MODEL TO FIT PARTICULAR CASE
856            for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do
857                #
858                IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
859                #
860                if [ "${FLAG_B}" = "TRUE" ] ; then
861                    # WE CONCATENATE WITH EXISTING FILES
862                    file1=${config_UserChoices_JobName}_${DATE_BUILD_B}_${FlagDir}_${var}.nc
863                    file2=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
864                    file_out=${config_UserChoices_JobName}_${DATE_BUILD_END}_${FlagDir}_${var}.nc
865                    IGCM_sys_ncrcat --hst ${file1} ${file2} ${file_out}
866                    #
867                    IGCM_sys_Rm ${file1} ${file2}
868                fi
869
870                #
871                if [ "${DEPOT}" = "TRUE" ] ; then
872                    # WE PUT FINAL FILE ON FILE SYSTEM
873                    [ "${FLAG_B}" = "FALSE" ] && file_out=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
874                    file_before=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc
875                    #
876                    eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}}/Analyse/${TS_Dir}/${file_out}
877                    [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file_before} ${file_out}
878                    #
879                    if [ ${FlagDir} = "1M" ] ; then
880                        file_before_YE=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_1Y_${var}.nc
881                        file_out_YE=${config_UserChoices_JobName}_${DATE_BUILD_END}_1Y_${var}.nc
882                        #
883                        # Compute yearly average considering calendar
884                        # and set date of the mid year to 01/07 at 00:00
885                        IGCM_sys_cdo -settime,00:00 -setday,1 -setmon,7 -settunits,days -divdpy -yearsum -muldpm -selvar,${var} ${file_out} ${file_out_YE}
886                        # Extract all ancillary variables except $var, they will be appended after the cdo command
887                        # Needed because cdo applies calculs on all variables
888                        IGCM_sys_ncks -Oh -x -v ${var} ${file_out} ${file_out_YE%%.nc}_tmp1.nc
889                        # This will remove the time axis because cdo rewrites severely with only considered useful variables
890                        IGCM_sys_cdo -mulc,1 ${file_out_YE%%.nc}_tmp1.nc ${file_out_YE%%.nc}_tmp2.nc
891                        if [ $? -eq 0 ] ; then
892                                # Now append all ancillary variables if previous cdo operator ok
893                                IGCM_sys_ncks -h -A ${file_out_YE%%.nc}_tmp2.nc ${file_out_YE}
894                        fi
895
896                        # Put global history attribut
897                        IGCM_sys_ncatted -Oh -a history,global,o,c,"build by libIGCM/create_ts" ${file_out_YE}
898                        #
899                        eval IGCM_sys_Put_Out ${file_out_YE} \${R_OUT_${comp}}/Analyse/TS_MO_YE/${file_out_YE}
900                        [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/TS_MO_YE/ ${file_before_YE} ${file_out_YE}
901                        IGCM_sys_Rm ${file_out_YE%%.nc}_tmp*.nc
902                    fi
903                    #
904                    IGCM_sys_Rm ${file_out}
905                    #
906                fi
907                #
908            done     # for var in ${liste_var} ; do
909            IGCM_sys_Rm ${liste_file_tmp[*]}
910        done         # for file in ${liste_file_brut} do
911    done             # for comp in ${config_ListOfComponents[*]} ; do
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} = X3D ] || [ 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.