source: trunk/libIGCM/AA_create_ts @ 711

Last change on this file since 711 was 704, checked in by jgipsl, 12 years ago

=> Added "#MSUB -Q normal" in headings for jobs at curie : When submitting a job in test queue (#MSUB -Q test) all sub jobs will also be subbmitted in test queue if nothingelse is specified.

=> Changed in AA_job : use /bin/ksh at curie due to specific usage in SPINUP configuration.

=> Correct directory in libIGCM_sys_obelix.

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