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