1 | #-Q- platine #!/usr/bin/ksh |
---|
2 | #-Q- platine ################### |
---|
3 | #-Q- platine ## PLATINE CEA ## |
---|
4 | #-Q- platine ################### |
---|
5 | #-Q- platine #BSUB -J SE # Nom du job |
---|
6 | #-Q- platine #BSUB -N # message a la fin du job |
---|
7 | #-Q- platine #BSUB -n 1 # reservation des processeurs pour le job |
---|
8 | #-Q- platine #BSUB -W 1:00 # Limite temps |
---|
9 | #-Q- sx8brodie ####################### |
---|
10 | #-Q- sx8brodie ## SX8BRODIE IDRIS ## |
---|
11 | #-Q- sx8brodie ####################### |
---|
12 | #-Q- sx8brodie #QSUB -r SE # Nom du job |
---|
13 | #-Q- sx8brodie #QSUB -lT 1:00:00 # limite en temps total |
---|
14 | #-Q- sx8brodie #QSUB -lt 1:00:00 # limite en temps par process |
---|
15 | #-Q- sx8brodie #QSUB -lM 1Gb |
---|
16 | #-Q- sx8brodie #QSUB -eo # rassemble standard error et output |
---|
17 | #-Q- sx8brodie #QSUB -J m |
---|
18 | #-Q- sx8brodie #QSUB -l mpp_p=4 |
---|
19 | #-Q- sx8brodie #QSUB -s /bin/ksh # shell du job |
---|
20 | #-Q- sx8mercure #!/bin/ksh |
---|
21 | #-Q- sx8mercure ###################### |
---|
22 | #-Q- sx8mercure ## SX8MERCURE CEA ## |
---|
23 | #-Q- sx8mercure ###################### |
---|
24 | #-Q- sx8mercure #PBS -N SE # Nom du job |
---|
25 | #-Q- sx8mercure #PBS -j o # regroupement des stdout et stderr |
---|
26 | #-Q- sx8mercure #PBS -S /usr/bin/ksh # shell de soumission |
---|
27 | #-Q- sx8mercure #PBS -l memsz_job=1gb # Limite memoire a 1 Go |
---|
28 | #-Q- sx8mercure #PBS -l cputim_job=1:00:00 # Limite temps a 1 heures |
---|
29 | #-Q- sx8mercure #PBS -q scalaire |
---|
30 | #-Q- default #!/bin/ksh |
---|
31 | #-Q- default ################## |
---|
32 | #-Q- default ## DEFAULT HOST ## |
---|
33 | #-Q- default ################## |
---|
34 | |
---|
35 | #set -vx |
---|
36 | |
---|
37 | date |
---|
38 | |
---|
39 | #-Q- sx8brodie export OMP_NUM_THREADS=1 |
---|
40 | |
---|
41 | # $Date$ |
---|
42 | # $Author$ |
---|
43 | # $Revision$ |
---|
44 | # IPSL (2006) |
---|
45 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
46 | |
---|
47 | ######################################################################## |
---|
48 | |
---|
49 | #D- Flag to determine if this job in a standalone mode |
---|
50 | #D- Default : value from AA_job if any |
---|
51 | StandAlone=${StandAlone:=true} |
---|
52 | |
---|
53 | #D- Flag to determine atlas job's output directory |
---|
54 | #D- Default : value from libIGCM_post.ksh if any |
---|
55 | POST_DIR=${POST_DIR:=${PBS_O_WORKDIR}} |
---|
56 | |
---|
57 | #D- Increased verbosity (1, 2, 3) |
---|
58 | #D- Default : value from AA_job if any |
---|
59 | Verbosity=${Verbosity:=3} |
---|
60 | |
---|
61 | #D- Low level debug : to bypass lib test checks and stack construction |
---|
62 | #D- Default : value from AA_job if any |
---|
63 | DEBUG_debug=${DEBUG_debug:=false} |
---|
64 | |
---|
65 | #D- Low level debug : to bypass lib test checks and stack construction |
---|
66 | #D- Default : value from AA_job if any |
---|
67 | libIGCM=${libIGCM:=/home/rech/ces/rces452/libIGCM} |
---|
68 | |
---|
69 | #D- TEMPORARY Flag to determine atmospheric resolution |
---|
70 | #D- Default : value from atmospheric driver if any |
---|
71 | RESOL_ATM=${RESOL_ATM:=LMD144142} |
---|
72 | |
---|
73 | #D- TEMPORARY Flag to determine ocean resolution |
---|
74 | #D- Default : value from ocean driver if any |
---|
75 | RESOL_OCE=${RESOL_OCE:=ORCA2} |
---|
76 | |
---|
77 | #D- TEMPORARY Flag to determine ice resolution |
---|
78 | #D- Default : value from ice driver if any |
---|
79 | RESOL_ICE=${RESOL_ICE:=ORCA2} |
---|
80 | |
---|
81 | #D- Flag to determine surface resolution |
---|
82 | #D- Default : value from surface driver if any |
---|
83 | RESOL_SRF=${RESOL_SRF:=LMD144142} |
---|
84 | |
---|
85 | ######################################################################## |
---|
86 | |
---|
87 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ; |
---|
88 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh #; IGCM_debug_Check |
---|
89 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh #; IGCM_card_Check |
---|
90 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh #; IGCM_date_Check |
---|
91 | |
---|
92 | ######################################################################## |
---|
93 | |
---|
94 | #set -vx |
---|
95 | |
---|
96 | if [ ${DEBUG_debug} = true ] ; then |
---|
97 | IGCM_sys_MkdirWork ${RUN_DIR_PATH} |
---|
98 | echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok." |
---|
99 | fi |
---|
100 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
101 | |
---|
102 | if [ ${StandAlone} = true ] ; then |
---|
103 | CARD_DIR=${SUBMIT_DIR} |
---|
104 | else |
---|
105 | CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} ) |
---|
106 | IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH} |
---|
107 | fi |
---|
108 | |
---|
109 | # |
---|
110 | # First of all |
---|
111 | # |
---|
112 | IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card UserChoices |
---|
113 | typeset option |
---|
114 | for option in ${config_UserChoices[*]} ; do |
---|
115 | IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option} |
---|
116 | done |
---|
117 | # |
---|
118 | echo |
---|
119 | IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" |
---|
120 | IGCM_debug_PrintVariables 3 config_UserChoices_JobName |
---|
121 | IGCM_debug_PrintVariables 3 config_UserChoices_LongName |
---|
122 | IGCM_debug_PrintVariables 3 config_UserChoices_TagName |
---|
123 | IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType |
---|
124 | IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin |
---|
125 | IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd |
---|
126 | IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength |
---|
127 | echo |
---|
128 | |
---|
129 | #================================== |
---|
130 | |
---|
131 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
132 | # |
---|
133 | IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents |
---|
134 | # |
---|
135 | IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency |
---|
136 | # |
---|
137 | # Determine period for seasonnal average. Default : value from AA_job if any |
---|
138 | # |
---|
139 | DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )} |
---|
140 | # |
---|
141 | DateEnd=${DateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} |
---|
142 | # |
---|
143 | freq=$( echo ${config_Post_SeasonalFrequency} | sed -e "s/[yY]//" ) |
---|
144 | # |
---|
145 | an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $DateEnd ) / 1000 ) |
---|
146 | an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) ) |
---|
147 | an_fin=$( IGCM_date_YearDigit ${an_fin} ) |
---|
148 | # |
---|
149 | # For each component selected determine which files need post-processing |
---|
150 | # |
---|
151 | for comp in ${config_ListOfComponents[*]} ; do |
---|
152 | # |
---|
153 | IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} |
---|
154 | eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 |
---|
155 | # |
---|
156 | card=${CARD_DIR}/COMP/${compname}.card |
---|
157 | IGCM_card_DefineArrayFromOption ${card} OutputFiles List |
---|
158 | # |
---|
159 | ListFilesName=${compname}_OutputFiles_List |
---|
160 | eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 |
---|
161 | # |
---|
162 | if [ X${FileName0} != X${NULL_STR} ] ; then |
---|
163 | # |
---|
164 | #IGCM_debug_Print 1 "Component : ${compname}" |
---|
165 | # |
---|
166 | # INITIALISATION |
---|
167 | # |
---|
168 | eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 |
---|
169 | typeset i=0 |
---|
170 | # |
---|
171 | until [ $i -eq $NbFiles ]; do |
---|
172 | # |
---|
173 | eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 |
---|
174 | eval file_in=${file_in_} |
---|
175 | let $(( i_ = i+2 )) |
---|
176 | eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 |
---|
177 | eval flag_post=${flag_post_} |
---|
178 | # |
---|
179 | if [ X${flag_post} != XNONE ] ; then |
---|
180 | # |
---|
181 | # Initialize ${flag_post}_${compname}_${post_freq} |
---|
182 | # |
---|
183 | eval ${flag_post}_${compname}_SeasonalFrequency=true |
---|
184 | fi |
---|
185 | let $(( i=i+3 )) |
---|
186 | done |
---|
187 | fi |
---|
188 | |
---|
189 | for element in $( set | grep Post_ | grep ${compname}_SeasonalFrequency | grep -i "=true" ) ; do |
---|
190 | # |
---|
191 | FILE=$( echo ${element} | awk -F "_${compname}" '{print $1}' | awk "-FPost_" '{print $2}' ) |
---|
192 | # |
---|
193 | IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches |
---|
194 | # |
---|
195 | # CREATE LIST |
---|
196 | # |
---|
197 | DIRECTORY=${R_SAVE}/${comp}/Analyse/SE |
---|
198 | # |
---|
199 | TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc |
---|
200 | # |
---|
201 | if [ ! -f ${DIRECTORY}/${TestedFile} ] ; then |
---|
202 | eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE} |
---|
203 | eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]} |
---|
204 | if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) != X${NULL_STR} ]; then |
---|
205 | for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do |
---|
206 | if [ Xload${Patch} != X ] ; then |
---|
207 | . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh |
---|
208 | eval load${Patch}=loaded |
---|
209 | fi |
---|
210 | done |
---|
211 | fi |
---|
212 | fi |
---|
213 | # |
---|
214 | done # for element |
---|
215 | done # for comp |
---|
216 | |
---|
217 | for comp in ${config_ListOfComponents[*]} ; do |
---|
218 | # |
---|
219 | eval R_OUT_${comp}=${R_SAVE}/${comp} |
---|
220 | # |
---|
221 | i=0 |
---|
222 | for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do |
---|
223 | # |
---|
224 | # Determine in which output can we find file |
---|
225 | # IE : Output/MO or Output/DA or ... |
---|
226 | # |
---|
227 | FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) |
---|
228 | case ${FlagDir} in |
---|
229 | *Y) FreqDir=YE ;; |
---|
230 | *M) FreqDir=MO ;; |
---|
231 | 5D|1D|*D) FreqDir=DA ;; |
---|
232 | HF) FreqDir=HF ;; |
---|
233 | INS) FreqDir=INS ;; |
---|
234 | esac |
---|
235 | # |
---|
236 | RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc |
---|
237 | # Do not redoo an existing SE |
---|
238 | if [ -f ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE} ] ; then |
---|
239 | continue |
---|
240 | fi |
---|
241 | # |
---|
242 | eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/ |
---|
243 | # |
---|
244 | case ${config_UserChoices_PeriodLength} in |
---|
245 | # For Yearly simulation : |
---|
246 | 1Y|1y) |
---|
247 | (( an = an_deb )) |
---|
248 | # Initialize array |
---|
249 | set -A liste_file_se |
---|
250 | set -A liste_file_se_tmp |
---|
251 | while [ ${an} -le ${an_fin} ] ; do |
---|
252 | moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) |
---|
253 | # |
---|
254 | an4=$(printf "%04i\n" ${an} ) |
---|
255 | # |
---|
256 | diy=$( IGCM_date_DaysInYear $an4 ) |
---|
257 | afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) |
---|
258 | date=${an4}0101_${afin} |
---|
259 | set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc |
---|
260 | set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc |
---|
261 | (( an = an + 1 )) |
---|
262 | done |
---|
263 | # |
---|
264 | IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} |
---|
265 | eval ExitFlag=false |
---|
266 | IGCM_debug_Verif_Exit_Post |
---|
267 | |
---|
268 | # Apply IGCM_Patch if needed |
---|
269 | if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then |
---|
270 | for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do |
---|
271 | for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do |
---|
272 | IGCM_${Patch} ${file_t} |
---|
273 | done |
---|
274 | done |
---|
275 | fi |
---|
276 | |
---|
277 | for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do |
---|
278 | # |
---|
279 | (( nb = ${mois} - 1 )) |
---|
280 | # |
---|
281 | OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc |
---|
282 | IGCM_sys_ncra -O -d time_counter,${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} |
---|
283 | done |
---|
284 | IGCM_sys_Rm ${liste_file_se_tmp[*]} |
---|
285 | eval ExitFlag=false |
---|
286 | IGCM_debug_Verif_Exit_Post |
---|
287 | ;; |
---|
288 | # For a Multi-Year simulation : |
---|
289 | *Y|*y) |
---|
290 | PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) |
---|
291 | (( an = an_deb )) |
---|
292 | # Initialize array |
---|
293 | set -A liste_file_se |
---|
294 | set -A liste_file_se_tmp |
---|
295 | while [ ${an} -le ${an_fin} ] ; do |
---|
296 | moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) |
---|
297 | # |
---|
298 | an4=$(printf "%04i\n" ${an} ) |
---|
299 | # |
---|
300 | (( diy = 0 )) |
---|
301 | (( ian = 0 )) |
---|
302 | while [ ${ian} -lt ${PeriodLengthInYears} ] ; do |
---|
303 | # |
---|
304 | ian4=$(printf "%04i\n" $(( an + ian )) ) |
---|
305 | (( diy = diy + $( IGCM_date_DaysInYear $ian4 ) )) |
---|
306 | (( ian = ian + 1 )) |
---|
307 | done |
---|
308 | afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) |
---|
309 | date=${an4}0101_${afin} |
---|
310 | set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc |
---|
311 | set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc |
---|
312 | (( an = an + PeriodLengthInYears )) |
---|
313 | done |
---|
314 | # |
---|
315 | IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} |
---|
316 | eval ExitFlag=false |
---|
317 | IGCM_debug_Verif_Exit_Post |
---|
318 | |
---|
319 | # Apply IGCM_Patch if needed |
---|
320 | if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then |
---|
321 | for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do |
---|
322 | for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do |
---|
323 | IGCM_${Patch} ${file_t} |
---|
324 | done |
---|
325 | done |
---|
326 | fi |
---|
327 | |
---|
328 | for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do |
---|
329 | # |
---|
330 | (( nb = ${mois} - 1 )) |
---|
331 | # |
---|
332 | OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc |
---|
333 | IGCM_sys_ncra -O -d time_counter,${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} |
---|
334 | done |
---|
335 | IGCM_sys_Rm ${liste_file_se_tmp[*]} |
---|
336 | eval ExitFlag=false |
---|
337 | IGCM_debug_Verif_Exit_Post |
---|
338 | ;; |
---|
339 | # For Monthly simulation : |
---|
340 | 1M|1m) |
---|
341 | for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do |
---|
342 | # |
---|
343 | (( nb = ${mois} - 1 )) |
---|
344 | # |
---|
345 | OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc |
---|
346 | # |
---|
347 | (( an = an_deb )) |
---|
348 | # Initialize array |
---|
349 | set -A liste_file_se |
---|
350 | set -A liste_file_se_tmp |
---|
351 | while [ ${an} -le ${an_fin} ] ; do |
---|
352 | moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) |
---|
353 | # |
---|
354 | an4=$(printf "%04i\n" ${an} ) |
---|
355 | # |
---|
356 | date=${an4}${mois}01_${an4}${mois}${moisL} |
---|
357 | set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc |
---|
358 | set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc |
---|
359 | (( an = an + 1 )) |
---|
360 | done |
---|
361 | # |
---|
362 | IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} |
---|
363 | eval ExitFlag=false |
---|
364 | IGCM_debug_Verif_Exit_Post |
---|
365 | |
---|
366 | # Apply IGCM_Patch if needed |
---|
367 | if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then |
---|
368 | for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do |
---|
369 | for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do |
---|
370 | IGCM_${Patch} ${file_t} |
---|
371 | done |
---|
372 | done |
---|
373 | fi |
---|
374 | |
---|
375 | IGCM_sys_ncra -O ${liste_file_se_tmp} ${OUT_SE[${nb}]} |
---|
376 | MENAGE_LOCAL ${liste_file_se_tmp} |
---|
377 | # |
---|
378 | IGCM_debug_Verif_Exit_Post |
---|
379 | done |
---|
380 | ;; |
---|
381 | |
---|
382 | # For Multi-Monthly simulation : |
---|
383 | *M|*m) |
---|
384 | PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) |
---|
385 | # Must be a divisor of 12 !!! e.g. 2,3,4 and 6 only |
---|
386 | if ( [ $PeriodLengthInMonths -ne 2 ] && \ |
---|
387 | [ $PeriodLengthInMonths -ne 3 ] && \ |
---|
388 | [ $PeriodLengthInMonths -ne 4 ] && \ |
---|
389 | [ $PeriodLengthInMonths -ne 6 ] ) ; then |
---|
390 | echo "create_se.job can't work with this monthly Period : ",$PeriodLengthInMonths,"M !!" |
---|
391 | echo "It must be a divisor of twelve." |
---|
392 | echo "We will stop there." |
---|
393 | IGCM_debug_Verif_Exit_Post |
---|
394 | else |
---|
395 | # |
---|
396 | (( NbSet = 12 / PeriodLengthInMonths )) |
---|
397 | (( moisd = 01 )) |
---|
398 | (( Mset = 1 )) |
---|
399 | while [ ${Mset} -le ${NbSet} ] ; do |
---|
400 | moisf=$(printf "%02i\n" $(( moisd + PeriodLengthInMonths - 1 )) ) |
---|
401 | moisd=$(printf "%02i\n" ${moisd} ) |
---|
402 | # |
---|
403 | (( an = an_deb )) |
---|
404 | # Initialize array |
---|
405 | set -A liste_file_se |
---|
406 | set -A liste_file_se_tmp |
---|
407 | while [ ${an} -le ${an_fin} ] ; do |
---|
408 | moisL=$( IGCM_date_DaysInMonth ${an} ${moisf} ) |
---|
409 | # |
---|
410 | an4=$(printf "%04i\n" ${an} ) |
---|
411 | # |
---|
412 | date=${an4}${moisd}01_${an4}${moisf}${moisL} |
---|
413 | set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc |
---|
414 | set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc |
---|
415 | (( an = an + 1 )) |
---|
416 | done |
---|
417 | # |
---|
418 | IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} |
---|
419 | eval ExitFlag=false |
---|
420 | IGCM_debug_Verif_Exit_Post |
---|
421 | |
---|
422 | # Apply IGCM_Patch if needed |
---|
423 | if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then |
---|
424 | for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do |
---|
425 | for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do |
---|
426 | IGCM_${Patch} ${file_t} |
---|
427 | done |
---|
428 | done |
---|
429 | fi |
---|
430 | |
---|
431 | (( imois = moisd )) |
---|
432 | (( i = 0 )) |
---|
433 | while [ ${imois} -le ${moisf} ] ; do |
---|
434 | # |
---|
435 | (( nb = ${imois} - 1 )) |
---|
436 | # |
---|
437 | OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${imois}_${an_deb}_${an_fin}_${file}.nc |
---|
438 | IGCM_sys_ncra -O -d time_counter,${i},,${PeriodLengthInMonths} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} |
---|
439 | (( imois = imois + 1 )) |
---|
440 | (( i = i + 1 )) |
---|
441 | done |
---|
442 | |
---|
443 | IGCM_sys_Rm ${liste_file_se_tmp[*]} |
---|
444 | eval ExitFlag=false |
---|
445 | IGCM_debug_Verif_Exit_Post |
---|
446 | moisf=$(printf "%02i\n" $(( moisf + 1 )) ) |
---|
447 | |
---|
448 | (( Mset = Mset + 1 )) |
---|
449 | done |
---|
450 | fi |
---|
451 | ;; |
---|
452 | *D|*d) |
---|
453 | for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do |
---|
454 | # |
---|
455 | (( nb = ${mois} - 1 )) |
---|
456 | # |
---|
457 | OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc |
---|
458 | # |
---|
459 | (( an = an_deb )) |
---|
460 | # Initialize array |
---|
461 | set -A liste_file_se |
---|
462 | set -A liste_file_se_tmp |
---|
463 | while [ ${an} -le ${an_fin} ] ; do |
---|
464 | moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) |
---|
465 | # |
---|
466 | an4=$(printf "%04i\n" ${an} ) |
---|
467 | # |
---|
468 | length_d=$(( ${config_UserChoices_PeriodLength} - 1 )) |
---|
469 | # for one day |
---|
470 | if [ ${length_d} -eq 1 ] ; then |
---|
471 | (( length_d = 0 )) |
---|
472 | fi |
---|
473 | (( day = 1 )) |
---|
474 | while [ ${day} -le ${moisL} ] ; do |
---|
475 | day2=$(printf "%02i\n" ${day} ) |
---|
476 | day_beg=${an4}${mois}${day2} |
---|
477 | day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} ) |
---|
478 | date=${an4}${mois}${day_beg}_${an4}${mois}${day_end} |
---|
479 | set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc |
---|
480 | set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc |
---|
481 | (( day = day + 1 )) |
---|
482 | done |
---|
483 | (( an = an + 1 )) |
---|
484 | done |
---|
485 | # |
---|
486 | IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} |
---|
487 | eval ExitFlag=false |
---|
488 | IGCM_debug_Verif_Exit_Post |
---|
489 | |
---|
490 | # Apply IGCM_Patch if needed |
---|
491 | if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then |
---|
492 | for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do |
---|
493 | for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do |
---|
494 | IGCM_${Patch} ${file_t} |
---|
495 | done |
---|
496 | done |
---|
497 | fi |
---|
498 | |
---|
499 | IGCM_sys_ncra -O ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} |
---|
500 | IGCM_sys_Rm ${liste_file_se_tmp[*]} |
---|
501 | eval ExitFlag=false |
---|
502 | IGCM_debug_Verif_Exit_Post |
---|
503 | done |
---|
504 | ;; |
---|
505 | esac |
---|
506 | # |
---|
507 | IGCM_sys_ncrcat -O ${OUT_SE[*]} ${RESULT_SE} |
---|
508 | # |
---|
509 | IGCM_sys_Rm ${OUT_SE[*]} |
---|
510 | # |
---|
511 | ${ncatted} -a modulo,time_counter,c,c," " ${RESULT_SE} |
---|
512 | # |
---|
513 | eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE} |
---|
514 | IGCM_sys_Rm ${RESULT_SE} |
---|
515 | # |
---|
516 | eval ExitFlag=false |
---|
517 | IGCM_debug_Verif_Exit_Post |
---|
518 | done |
---|
519 | done |
---|
520 | |
---|
521 | # DODS copy |
---|
522 | for comp in ${config_ListOfComponents[*]} ; do |
---|
523 | for SE_Dir in $( ls ${R_SAVE}/${comp}/Analyse/ 2>&1 | grep SE ) ; do |
---|
524 | [ -d ${R_SAVE}/${comp}/Analyse/${SE_Dir} ] && IGCM_sys_Put_Dods ${comp}/Analyse/${SE_Dir} |
---|
525 | done |
---|
526 | done |
---|
527 | |
---|
528 | YEARS=${an_deb}_${an_fin} |
---|
529 | |
---|
530 | # clean environment variables and export usefull one : |
---|
531 | if [ X$( hostname -s ) = Xrhodes ] ; then |
---|
532 | LISTE_ENV=$( env | grep -iv MYLANG | grep -iv HOST | grep -iv LOGIN | grep -iv config_ | grep -iv R_ | grep -iv libIGCM | grep -iv PERIOD \ |
---|
533 | | grep -iv DMFDIR | grep -iv AN_| grep -iv YEARS | grep -iv ex | grep -iv RESOL_ | grep -iv PATH | grep -iv WORKDIR | grep -iv USER \ |
---|
534 | | grep -iv LOGNAME | grep -iv PROFILE | grep -iv ENV | grep -iv TMPDIR | grep -iv POST_DIR | grep -iv DB |awk -F= '{print $1}' ) |
---|
535 | |
---|
536 | for variables in ${LISTE_ENV} ; do |
---|
537 | unset ${variables} |
---|
538 | done |
---|
539 | fi |
---|
540 | |
---|
541 | export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone |
---|
542 | export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_SRF |
---|
543 | export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; |
---|
544 | listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF,R_SAVE,config_UserChoices_JobName,config_UserChoices_TagName,YEARS" |
---|
545 | export listVarEnv; |
---|
546 | |
---|
547 | #D- |
---|
548 | # -------------------------------------------------------------------- |
---|
549 | #D- Test if all was right before ATLAS |
---|
550 | # -------------------------------------------------------------------- |
---|
551 | IGCM_debug_Verif_Exit_Post |
---|
552 | |
---|
553 | if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \ |
---|
554 | [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ] || \ |
---|
555 | [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then |
---|
556 | # |
---|
557 | IGCM_sys_QsubPost atlas_ORCHIDEE ; |
---|
558 | IGCM_sys_QsubPost atlas_LMDZ ; |
---|
559 | IGCM_sys_QsubPost atlas_ORCA_LIM ; |
---|
560 | IGCM_sys_QsubPost additionnal ; |
---|
561 | # |
---|
562 | elif [ ${config_UserChoices_TagName} = "LMDZOR" ] || \ |
---|
563 | [ ${config_UserChoices_TagName} = "LMDZ4OR" ] || \ |
---|
564 | [ ${config_UserChoices_TagName} = "LMDz4OR_v2" ] ; then |
---|
565 | # |
---|
566 | IGCM_sys_QsubPost atlas_LMDZ ; |
---|
567 | IGCM_sys_QsubPost atlas_ORCHIDEE ; |
---|
568 | # |
---|
569 | elif [ ${config_UserChoices_TagName} = "OL" ] || \ |
---|
570 | [ ${config_UserChoices_TagName} = "OL2" ] ; then |
---|
571 | # |
---|
572 | IGCM_sys_QsubPost atlas_ORCHIDEE ; |
---|
573 | # |
---|
574 | elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ] ; then |
---|
575 | # |
---|
576 | IGCM_sys_QsubPost atlas_ORCA_LIM ; |
---|
577 | IGCM_sys_QsubPost additionnal ; |
---|
578 | # |
---|
579 | fi |
---|