source: tags/libIGCM_v2.0_beta2/AA_create_ts @ 1170

Last change on this file since 1170 was 658, checked in by labetoulle, 12 years ago

Add Ensemble functionality to libIGCM - First step :
modify output directories according to an option in section [Ensemble]
in config.card (modification of config.card yet to be done).

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