source: tags/libIGCM_v2.0_beta3/AA_create_ts @ 1137

Last change on this file since 1137 was 681, checked in by mafoipsl, 12 years ago

On curie : Computing job on -q standard ie thin nodes, post-processing jobs on -q large ie large nodes. Stop default echo of commands.

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