1 | #!/bin/ksh |
---|
2 | |
---|
3 | #************************************************************** |
---|
4 | # Author: Sebastien Denvil |
---|
5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
6 | # $Revision:: $ Revision of last commit |
---|
7 | # $Author:: $ Author of last commit |
---|
8 | # $Date:: $ Date of last commit |
---|
9 | # IPSL (2006) |
---|
10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
11 | # |
---|
12 | #************************************************************** |
---|
13 | |
---|
14 | #======================================================================= |
---|
15 | |
---|
16 | function IGCM_post_Configure |
---|
17 | { |
---|
18 | IGCM_debug_PushStack "IGCM_post_Configure" |
---|
19 | |
---|
20 | # Debug Print : |
---|
21 | echo |
---|
22 | IGCM_debug_Print 1 "IGCM_post_Configure" |
---|
23 | # |
---|
24 | # Initialize |
---|
25 | # |
---|
26 | POST=false |
---|
27 | RebuildFrequency=false |
---|
28 | PackFrequency=false |
---|
29 | TimeSeriesFrequency=false |
---|
30 | SeasonalFrequency=false |
---|
31 | unset list_post |
---|
32 | # |
---|
33 | # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS |
---|
34 | # |
---|
35 | if [ X${AsynchronousRebuild} = Xtrue ] ; then |
---|
36 | list_post="RebuildFrequency" |
---|
37 | fi |
---|
38 | # |
---|
39 | if [ X${Pack} = Xtrue ] ; then |
---|
40 | list_post="${list_post} PackFrequency" |
---|
41 | fi |
---|
42 | # |
---|
43 | if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] || [ X${TimeSeriesChunck2D} = Xtrue ] || [ X${TimeSeriesChunck3D} = Xtrue ] ) ; then |
---|
44 | list_post="${list_post} TimeSeriesFrequency" |
---|
45 | fi |
---|
46 | # |
---|
47 | if [ X${Seasonal} = Xtrue ] ; then |
---|
48 | list_post="${list_post} SeasonalFrequency" |
---|
49 | fi |
---|
50 | |
---|
51 | # Overrule Time Series triggering. Special case 1. |
---|
52 | if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ |
---|
53 | [ ! X${config_Post_TimeSeriesFrequency} = XNONE ] && \ |
---|
54 | [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
55 | TimeSeriesFrequency=true |
---|
56 | POST=true |
---|
57 | fi |
---|
58 | # Overrule Rebuild triggering. Special case 2. |
---|
59 | if ( [ X${AsynchronousRebuild} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
60 | RebuildFrequency=true |
---|
61 | POST=true |
---|
62 | fi |
---|
63 | # Overrule Pack triggering. Special case 3. |
---|
64 | if ( [ X${Pack} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
65 | PackFrequency=true |
---|
66 | POST=true |
---|
67 | fi |
---|
68 | |
---|
69 | # READ REBUILD OR PACK OR TIME SERIES OR SEASONAL FREQUENCY |
---|
70 | # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO |
---|
71 | for post_freq in ${list_post} ; do |
---|
72 | # Extract frequency from previously defined variable |
---|
73 | config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} ) |
---|
74 | # Offset for Seasonal Average starting period |
---|
75 | if [ ${post_freq} = SeasonalFrequency ] ; then |
---|
76 | if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then |
---|
77 | PeriodOffset=0 |
---|
78 | else |
---|
79 | PeriodOffset=${config_Post_SeasonalFrequencyOffset} |
---|
80 | fi |
---|
81 | else |
---|
82 | PeriodOffset=0 |
---|
83 | fi |
---|
84 | # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) |
---|
85 | # RebuildFrequency needs additionnal information |
---|
86 | if [ ${post_freq} = RebuildFrequency ] ; then |
---|
87 | IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbPeriodPerFrequency |
---|
88 | NbRebuildDir=${NbPeriodPerFrequency} |
---|
89 | else |
---|
90 | IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength |
---|
91 | fi |
---|
92 | # |
---|
93 | eval IGCM_debug_Print 1 \" "${post_freq} flag value : \${${post_freq}}" \" |
---|
94 | done |
---|
95 | # |
---|
96 | IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}" |
---|
97 | # |
---|
98 | # Prepare headers for the shell dedicated to post-processing |
---|
99 | if ( [ ${PackFrequency} = true ] && ( [ ${TimeSeriesFrequency} = true ] || [ ${SeasonalFrequency} = true ] ) ) ; then |
---|
100 | if [ $DRYRUN -le 1 ]; then |
---|
101 | echo "#!/bin/ksh " > ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
102 | echo "function IGCM_FlushPost " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
103 | echo "{ " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
104 | echo "IGCM_debug_PushStack \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
105 | echo "echo " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
106 | echo "IGCM_debug_Print 1 \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
107 | echo "echo " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
108 | fi |
---|
109 | fi |
---|
110 | IGCM_debug_PopStack "IGCM_post_Configure" |
---|
111 | } |
---|
112 | |
---|
113 | function IGCM_post_Submit |
---|
114 | { |
---|
115 | IGCM_debug_PushStack "IGCM_post_Submit" |
---|
116 | |
---|
117 | typeset listVarEnv DaysTemp |
---|
118 | |
---|
119 | POST_DIR=${R_BUF_KSH} |
---|
120 | |
---|
121 | if [ ${POST} = true ]; then |
---|
122 | echo |
---|
123 | IGCM_debug_Print 1 "IGCM_post_Submit" |
---|
124 | echo |
---|
125 | IGCM_debug_Print 2 "POST_DIR = ${POST_DIR}" |
---|
126 | fi |
---|
127 | |
---|
128 | #============ TIME SERIES POST-PROCESSING ===========# |
---|
129 | if [ ${TimeSeriesFrequency} = true ] ; then |
---|
130 | |
---|
131 | IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ACTIVATED" |
---|
132 | echo |
---|
133 | |
---|
134 | |
---|
135 | |
---|
136 | # Get information from last execution |
---|
137 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted |
---|
138 | CompletedFlag=${run_PostProcessing_TimeSeriesCompleted} |
---|
139 | # |
---|
140 | |
---|
141 | |
---|
142 | |
---|
143 | listVarEnv="DEBUG_debug,BigBrother,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,Script_Post_Output,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" |
---|
144 | # |
---|
145 | jLoop=${#ListDimension[*]} |
---|
146 | j=0 |
---|
147 | until [ $j -ge ${jLoop} ]; do |
---|
148 | Dimension=${ListDimension[${j}]} |
---|
149 | # |
---|
150 | if [ X$( eval echo \${TimeSeries${Dimension}} ) = Xtrue ] ; then |
---|
151 | # |
---|
152 | IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED" |
---|
153 | echo |
---|
154 | # |
---|
155 | if [ X${Dimension} = X ] ; then |
---|
156 | TsTask="empty" |
---|
157 | Script_Post_Output=create_ts.${PeriodDateEnd} |
---|
158 | else |
---|
159 | TsTask=${Dimension} |
---|
160 | Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask} |
---|
161 | fi |
---|
162 | # |
---|
163 | if [ ${RebuildFrequency} = true ] ; then |
---|
164 | # |
---|
165 | if [ ${PackFrequency} = true ] ; then |
---|
166 | FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
167 | else |
---|
168 | FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
169 | fi |
---|
170 | # |
---|
171 | if [ -f ${FunctionPath} ] ; then |
---|
172 | # if [ X${MASTER} = Xtitane ] ; then |
---|
173 | # echo "IGCM_sys_RshPost <<-EOF" >> ${FunctionPath} |
---|
174 | # fi |
---|
175 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${FunctionPath} |
---|
176 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
177 | echo "export MODIPSL=${MODIPSL} " >> ${FunctionPath} |
---|
178 | echo "export libIGCM_SX=${libIGCM} " >> ${FunctionPath} |
---|
179 | echo "export libIGCM=${libIGCM_POST} " >> ${FunctionPath} |
---|
180 | echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${FunctionPath} |
---|
181 | echo "export POST_DIR=${POST_DIR} " >> ${FunctionPath} |
---|
182 | echo "export MASTER=${MASTER} " >> ${FunctionPath} |
---|
183 | echo "export RebuildFrequency=${RebuildFrequency} " >> ${FunctionPath} |
---|
184 | echo "export DateBegin=${DateBegin} " >> ${FunctionPath} |
---|
185 | echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${FunctionPath} |
---|
186 | echo "export StandAlone=false " >> ${FunctionPath} |
---|
187 | echo "export CompletedFlag=${CompletedFlag} " >> ${FunctionPath} |
---|
188 | echo "export TsTask=${TsTask} " >> ${FunctionPath} |
---|
189 | echo "unset CompToRead " >> ${FunctionPath} |
---|
190 | echo "unset FlagToRead " >> ${FunctionPath} |
---|
191 | echo "export RESOL_ATM=${RESOL_ATM} " >> ${FunctionPath} |
---|
192 | echo "export RESOL_OCE=${RESOL_OCE} " >> ${FunctionPath} |
---|
193 | echo "export RESOL_ICE=${RESOL_ICE} " >> ${FunctionPath} |
---|
194 | echo "export RESOL_MBG=${RESOL_MBG} " >> ${FunctionPath} |
---|
195 | echo "export RESOL_SRF=${RESOL_SRF} " >> ${FunctionPath} |
---|
196 | echo "export RESOL_SBG=${RESOL_SBG} " >> ${FunctionPath} |
---|
197 | echo "export listVarEnv=${listVarEnv} " >> ${FunctionPath} |
---|
198 | echo "export Script_Post_Output=${Script_Post_Output}" >> ${FunctionPath} |
---|
199 | # if [ X${MASTER} = Xtitane ] ; then |
---|
200 | # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath} |
---|
201 | # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${FunctionPath} |
---|
202 | # fi |
---|
203 | echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${FunctionPath} |
---|
204 | echo "IGCM_debug_Verif_Exit_Post " >> ${FunctionPath} |
---|
205 | echo "IGCM_sys_QsubPost create_ts " >> ${FunctionPath} |
---|
206 | # if [ X${MASTER} = Xtitane ] ; then |
---|
207 | # echo "EOF" >> ${FunctionPath} |
---|
208 | # fi |
---|
209 | fi |
---|
210 | else |
---|
211 | IGCM_sys_RshPost <<-EOF |
---|
212 | export DEBUG_debug=${DEBUG_debug} |
---|
213 | export BigBrother=${BigBrother} |
---|
214 | export MODIPSL=${MODIPSL} |
---|
215 | export libIGCM_SX=${libIGCM} |
---|
216 | export libIGCM=${libIGCM_POST} |
---|
217 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
218 | export POST_DIR=${POST_DIR} |
---|
219 | export MASTER=${MASTER} |
---|
220 | export RebuildFrequency=${RebuildFrequency} |
---|
221 | export DateBegin=${DateBegin} |
---|
222 | export PeriodDateEnd=${PeriodDateEnd} |
---|
223 | export StandAlone=false |
---|
224 | export CompletedFlag=${CompletedFlag} |
---|
225 | export TsTask=${TsTask} |
---|
226 | unset CompToRead |
---|
227 | unset FlagToRead |
---|
228 | export RESOL_ATM=${RESOL_ATM} |
---|
229 | export RESOL_OCE=${RESOL_OCE} |
---|
230 | export RESOL_ICE=${RESOL_ICE} |
---|
231 | export RESOL_MBG=${RESOL_MBG} |
---|
232 | export RESOL_SRF=${RESOL_SRF} |
---|
233 | export RESOL_SBG=${RESOL_SBG} |
---|
234 | export listVarEnv=${listVarEnv} |
---|
235 | export Script_Post_Output=${Script_Post_Output} |
---|
236 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
237 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
238 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
239 | IGCM_debug_Verif_Exit_Post |
---|
240 | IGCM_sys_QsubPost create_ts |
---|
241 | EOF |
---|
242 | fi |
---|
243 | fi |
---|
244 | # |
---|
245 | if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then |
---|
246 | # |
---|
247 | IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} WITH CHUNCK ACTIVATED" |
---|
248 | echo |
---|
249 | # Need to Remember This One |
---|
250 | SavedDateBegin=${DateBegin} |
---|
251 | # Kind of task create_ts will perform |
---|
252 | TsTask=Chunck${Dimension} |
---|
253 | # Number of chunck jobs to configure and submit |
---|
254 | eval NbJob=\${#CHUNCK${Dimension}_COMP[@]} |
---|
255 | typeset i |
---|
256 | i=0 |
---|
257 | until [ $i -ge $NbJob ]; do |
---|
258 | CompToRead=$( eval echo \${CHUNCK${Dimension}_COMP[\${i}]} ) |
---|
259 | FlagToRead=$( eval echo \${CHUNCK${Dimension}_FLAG[\${i}]} ) |
---|
260 | NameToRead=$( eval echo \${CHUNCK${Dimension}_NAME[\${i}]} ) |
---|
261 | ChunckSize=$( eval echo \${CHUNCK${Dimension}_SIZE[\${i}]} ) |
---|
262 | # Chunck Length (mandatory in Year) |
---|
263 | YearsChunckLength=$( echo ${ChunckSize} | sed -e "s/[yY]//" ) |
---|
264 | # |
---|
265 | IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin |
---|
266 | # |
---|
267 | IGCM_date_GetYearMonth ${PeriodDateEnd} YearEnd MonthEnd |
---|
268 | # How many chunck in total since simulation began |
---|
269 | NbYearsChunckLoop=$(( ( ${YearEnd} - ${YearBegin} + 1 ) / ${YearsChunckLength} )) |
---|
270 | # Tweak special case |
---|
271 | [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 )) |
---|
272 | # Starting Year of the current chunck |
---|
273 | ChunckTsYearBegin=$(( ${NbYearsChunckLoop} * ${YearsChunckLength} + ${YearBegin} )) |
---|
274 | # Starting date of the current chunck |
---|
275 | ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01 |
---|
276 | # |
---|
277 | Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead} |
---|
278 | # |
---|
279 | if [ ${RebuildFrequency} = true ] ; then |
---|
280 | # |
---|
281 | if [ ${PackFrequency} = true ] ; then |
---|
282 | FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
283 | else |
---|
284 | FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
285 | fi |
---|
286 | # |
---|
287 | if [ -f ${FunctionPath} ] ; then |
---|
288 | # if [ X${MASTER} = Xtitane ] ; then |
---|
289 | # echo "IGCM_sys_RshPost <<-EOF" >> ${FunctionPath} |
---|
290 | # fi |
---|
291 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${FunctionPath} |
---|
292 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
293 | echo "export MODIPSL=${MODIPSL} " >> ${FunctionPath} |
---|
294 | echo "export libIGCM_SX=${libIGCM} " >> ${FunctionPath} |
---|
295 | echo "export libIGCM=${libIGCM_POST} " >> ${FunctionPath} |
---|
296 | echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${FunctionPath} |
---|
297 | echo "export POST_DIR=${POST_DIR} " >> ${FunctionPath} |
---|
298 | echo "export MASTER=${MASTER} " >> ${FunctionPath} |
---|
299 | echo "export RebuildFrequency=${RebuildFrequency} " >> ${FunctionPath} |
---|
300 | echo "export DateBegin=${ChunckTsDateBegin} " >> ${FunctionPath} |
---|
301 | echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${FunctionPath} |
---|
302 | echo "export StandAlone=false " >> ${FunctionPath} |
---|
303 | echo "export CompletedFlag=${CompletedFlag} " >> ${FunctionPath} |
---|
304 | echo "export TsTask=${TsTask} " >> ${FunctionPath} |
---|
305 | echo "export CompToRead=${CompToRead} " >> ${FunctionPath} |
---|
306 | echo "export FlagToRead=${FlagToRead} " >> ${FunctionPath} |
---|
307 | echo "export RESOL_ATM=${RESOL_ATM} " >> ${FunctionPath} |
---|
308 | echo "export RESOL_OCE=${RESOL_OCE} " >> ${FunctionPath} |
---|
309 | echo "export RESOL_ICE=${RESOL_ICE} " >> ${FunctionPath} |
---|
310 | echo "export RESOL_MBG=${RESOL_MBG} " >> ${FunctionPath} |
---|
311 | echo "export RESOL_SRF=${RESOL_SRF} " >> ${FunctionPath} |
---|
312 | echo "export RESOL_SBG=${RESOL_SBG} " >> ${FunctionPath} |
---|
313 | echo "export listVarEnv=${listVarEnv} " >> ${FunctionPath} |
---|
314 | echo "export Script_Post_Output=${Script_Post_Output}" >> ${FunctionPath} |
---|
315 | # if [ X${MASTER} = Xtitane ] ; then |
---|
316 | # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath} |
---|
317 | # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${FunctionPath} |
---|
318 | # fi |
---|
319 | echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${FunctionPath} |
---|
320 | echo "IGCM_debug_Verif_Exit_Post " >> ${FunctionPath} |
---|
321 | echo "IGCM_sys_QsubPost create_ts " >> ${FunctionPath} |
---|
322 | # if [ X${MASTER} = Xtitane ] ; then |
---|
323 | # echo "EOF" >> ${FunctionPath} |
---|
324 | # fi |
---|
325 | fi |
---|
326 | else |
---|
327 | IGCM_sys_RshPost <<-EOF |
---|
328 | export DEBUG_debug=${DEBUG_debug} |
---|
329 | export BigBrother=${BigBrother} |
---|
330 | export MODIPSL=${MODIPSL} |
---|
331 | export libIGCM_SX=${libIGCM} |
---|
332 | export libIGCM=${libIGCM_POST} |
---|
333 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
334 | export POST_DIR=${POST_DIR} |
---|
335 | export MASTER=${MASTER} |
---|
336 | export RebuildFrequency=${RebuildFrequency} |
---|
337 | export DateBegin=${ChunckTsDateBegin} |
---|
338 | export PeriodDateEnd=${PeriodDateEnd} |
---|
339 | export StandAlone=false |
---|
340 | export CompletedFlag=${CompletedFlag} |
---|
341 | export TsTask=${TsTask} |
---|
342 | export CompToRead=${CompToRead} |
---|
343 | export FlagToRead=${FlagToRead} |
---|
344 | export RESOL_ATM=${RESOL_ATM} |
---|
345 | export RESOL_OCE=${RESOL_OCE} |
---|
346 | export RESOL_ICE=${RESOL_ICE} |
---|
347 | export RESOL_MBG=${RESOL_MBG} |
---|
348 | export RESOL_SRF=${RESOL_SRF} |
---|
349 | export RESOL_SBG=${RESOL_SBG} |
---|
350 | export listVarEnv=${listVarEnv} |
---|
351 | export Script_Post_Output=${Script_Post_Output} |
---|
352 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
353 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
354 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
355 | IGCM_debug_Verif_Exit_Post |
---|
356 | IGCM_sys_QsubPost create_ts |
---|
357 | EOF |
---|
358 | # |
---|
359 | fi |
---|
360 | # |
---|
361 | export DateBegin=${SavedDateBegin} |
---|
362 | # |
---|
363 | (( i=i+1 )) |
---|
364 | # |
---|
365 | done |
---|
366 | fi |
---|
367 | (( j=j+1 )) |
---|
368 | done |
---|
369 | fi |
---|
370 | |
---|
371 | #============= SEASONAL POST-PROCESSING ============# |
---|
372 | if [ ${SeasonalFrequency} = true ] ; then |
---|
373 | # |
---|
374 | IGCM_debug_Print 1 "SEASONNAL POST-PROCESSING" |
---|
375 | echo |
---|
376 | # |
---|
377 | Script_Post_Output=create_se.${PeriodDateEnd} |
---|
378 | # |
---|
379 | listVarEnv="DEBUG_debug,BigBrother,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" |
---|
380 | |
---|
381 | if [ ${RebuildFrequency} = true ] ; then |
---|
382 | # |
---|
383 | if [ ${PackFrequency} = true ] ; then |
---|
384 | FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
385 | else |
---|
386 | FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
387 | fi |
---|
388 | # |
---|
389 | if [ -f ${FunctionPath} ] ; then |
---|
390 | # |
---|
391 | # if [ X${MASTER} = Xtitane ] ; then |
---|
392 | # echo "IGCM_sys_RshPost <<-EOF" >> ${FunctionPath} |
---|
393 | # fi |
---|
394 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${FunctionPath} |
---|
395 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
396 | echo "export MODIPSL=${MODIPSL} " >> ${FunctionPath} |
---|
397 | echo "export libIGCM_SX=${libIGCM} " >> ${FunctionPath} |
---|
398 | echo "export libIGCM=${libIGCM_POST} " >> ${FunctionPath} |
---|
399 | echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${FunctionPath} |
---|
400 | echo "export POST_DIR=${POST_DIR} " >> ${FunctionPath} |
---|
401 | echo "export MASTER=${MASTER} " >> ${FunctionPath} |
---|
402 | echo "export DateBegin=${DateBegin} " >> ${FunctionPath} |
---|
403 | echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${FunctionPath} |
---|
404 | echo "export StandAlone=false " >> ${FunctionPath} |
---|
405 | echo "export RESOL_ATM=${RESOL_ATM} " >> ${FunctionPath} |
---|
406 | echo "export RESOL_OCE=${RESOL_OCE} " >> ${FunctionPath} |
---|
407 | echo "export RESOL_ICE=${RESOL_ICE} " >> ${FunctionPath} |
---|
408 | echo "export RESOL_MBG=${RESOL_MBG} " >> ${FunctionPath} |
---|
409 | echo "export RESOL_SRF=${RESOL_SRF} " >> ${FunctionPath} |
---|
410 | echo "export RESOL_SBG=${RESOL_SBG} " >> ${FunctionPath} |
---|
411 | echo "export listVarEnv=${listVarEnv} " >> ${FunctionPath} |
---|
412 | echo "export Script_Post_Output=${Script_Post_Output}" >> ${FunctionPath} |
---|
413 | # if [ X${MASTER} = Xtitane ] ; then |
---|
414 | # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath} |
---|
415 | # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${FunctionPath} |
---|
416 | # fi |
---|
417 | echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${FunctionPath} |
---|
418 | echo "IGCM_debug_Verif_Exit_Post " >> ${FunctionPath} |
---|
419 | echo "IGCM_sys_QsubPost create_se " >> ${FunctionPath} |
---|
420 | # if [ X${MASTER} = Xtitane ] ; then |
---|
421 | # echo "EOF" >> ${FunctionPath} |
---|
422 | # fi |
---|
423 | fi |
---|
424 | else |
---|
425 | IGCM_sys_RshPost <<-EOF |
---|
426 | export DEBUG_debug=${DEBUG_debug} |
---|
427 | export BigBrother=${BigBrother} |
---|
428 | export MODIPSL=${MODIPSL} |
---|
429 | export libIGCM_SX=${libIGCM} |
---|
430 | export libIGCM=${libIGCM_POST} |
---|
431 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
432 | export POST_DIR=${POST_DIR} |
---|
433 | export MASTER=${MASTER} |
---|
434 | export DateBegin=${DateBegin} |
---|
435 | export PeriodDateEnd=${PeriodDateEnd} |
---|
436 | export StandAlone=false |
---|
437 | export RESOL_ATM=${RESOL_ATM} |
---|
438 | export RESOL_OCE=${RESOL_OCE} |
---|
439 | export RESOL_ICE=${RESOL_ICE} |
---|
440 | export RESOL_MBG=${RESOL_MBG} |
---|
441 | export RESOL_SRF=${RESOL_SRF} |
---|
442 | export RESOL_SBG=${RESOL_SBG} |
---|
443 | export listVarEnv=${listVarEnv} |
---|
444 | export Script_Post_Output=${Script_Post_Output} |
---|
445 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
446 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
447 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
448 | IGCM_debug_Verif_Exit_Post |
---|
449 | IGCM_sys_QsubPost create_se |
---|
450 | EOF |
---|
451 | fi |
---|
452 | fi |
---|
453 | |
---|
454 | #============== PACK PROCESSING FOR RESTART, DEBUG AND OUTPUT FILES =============# |
---|
455 | if [ ${PackFrequency} = true ] ; then |
---|
456 | IGCM_debug_Print 1 "PACK POST-PROCESSING" |
---|
457 | # ----------------------------------------------------------------------------------- |
---|
458 | # Function IGCM_FlushPost called by pack_output.job has not been closed yet. Do it now |
---|
459 | # Will submit Time Series OR Seasonal Average if needed |
---|
460 | # ----------------------------------------------------------------------------------- |
---|
461 | if [ -f ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh ] ; then |
---|
462 | echo "IGCM_debug_PopStack \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
463 | echo "} " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
464 | fi |
---|
465 | echo |
---|
466 | ## Need to Remember This One |
---|
467 | SavedDateBegin=${DateBegin} |
---|
468 | ## Need to Remember This One |
---|
469 | SavedDateEnd=${DateEnd} |
---|
470 | # |
---|
471 | DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 )) |
---|
472 | # |
---|
473 | PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} ) |
---|
474 | # |
---|
475 | script=pack_debug |
---|
476 | # |
---|
477 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
478 | # |
---|
479 | listVarEnv="DEBUG_debug,BigBrother,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,DateEnd,PeriodPack,StandAlone" |
---|
480 | IGCM_sys_RshPost <<-EOF |
---|
481 | export DEBUG_debug=${DEBUG_debug} |
---|
482 | export BigBrother=${BigBrother} |
---|
483 | export MODIPSL=${MODIPSL} |
---|
484 | export libIGCM_SX=${libIGCM} |
---|
485 | export libIGCM=${libIGCM_POST} |
---|
486 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
487 | export POST_DIR=${POST_DIR} |
---|
488 | export MASTER=${MASTER} |
---|
489 | export DateBegin=${PackDateBegin} |
---|
490 | export DateEnd=${PeriodDateEnd} |
---|
491 | export PeriodPack=${config_Post_PackFrequency} |
---|
492 | export StandAlone=false |
---|
493 | export listVarEnv=${listVarEnv} |
---|
494 | export Script_Post_Output=${Script_Post_Output} |
---|
495 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
496 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
497 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
498 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
499 | IGCM_debug_Verif_Exit_Post |
---|
500 | IGCM_sys_QsubPost ${script} |
---|
501 | IGCM_debug_Verif_Exit |
---|
502 | EOF |
---|
503 | # |
---|
504 | script=pack_restart |
---|
505 | # |
---|
506 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
507 | # |
---|
508 | IGCM_sys_RshPost <<-EOF |
---|
509 | export DEBUG_debug=${DEBUG_debug} |
---|
510 | export BigBrother=${BigBrother} |
---|
511 | export MODIPSL=${MODIPSL} |
---|
512 | export libIGCM_SX=${libIGCM} |
---|
513 | export libIGCM=${libIGCM_POST} |
---|
514 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
515 | export POST_DIR=${POST_DIR} |
---|
516 | export MASTER=${MASTER} |
---|
517 | export DateBegin=${PackDateBegin} |
---|
518 | export DateEnd=${PeriodDateEnd} |
---|
519 | export PeriodPack=${config_Post_PackFrequency} |
---|
520 | export StandAlone=false |
---|
521 | export listVarEnv=${listVarEnv} |
---|
522 | export Script_Post_Output=${Script_Post_Output} |
---|
523 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
524 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
525 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
526 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
527 | IGCM_debug_Verif_Exit_Post |
---|
528 | IGCM_sys_QsubPost ${script} |
---|
529 | IGCM_debug_Verif_Exit |
---|
530 | EOF |
---|
531 | # |
---|
532 | script=pack_output |
---|
533 | # |
---|
534 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
535 | # |
---|
536 | if ( [ ${RebuildFrequency} = true ] && [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ) ; then |
---|
537 | # if [ X${MASTER} = Xtitane ] ; then |
---|
538 | # echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
539 | # fi |
---|
540 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
541 | echo "export BigBrother=${BigBrother} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
542 | echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
543 | echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
544 | echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
545 | echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
546 | echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
547 | echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
548 | echo "export DateBegin=${PackDateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
549 | echo "export DateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
550 | echo "export PeriodPack=${config_Post_PackFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
551 | echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
552 | echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
553 | echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
554 | echo "export script=${script} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
555 | # if [ X${MASTER} = Xtitane ] ; then |
---|
556 | # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
557 | # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
558 | # fi |
---|
559 | echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
560 | echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
561 | echo "IGCM_sys_QsubPost ${script} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
562 | # if [ X${MASTER} = Xtitane ] ; then |
---|
563 | # echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
564 | # fi |
---|
565 | echo "IGCM_debug_Verif_Exit " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
566 | else |
---|
567 | IGCM_sys_RshPost <<-EOF |
---|
568 | export DEBUG_debug=${DEBUG_debug} |
---|
569 | export BigBrother=${BigBrother} |
---|
570 | export MODIPSL=${MODIPSL} |
---|
571 | export libIGCM_SX=${libIGCM} |
---|
572 | export libIGCM=${libIGCM_POST} |
---|
573 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
574 | export POST_DIR=${POST_DIR} |
---|
575 | export MASTER=${MASTER} |
---|
576 | export DateBegin=${PackDateBegin} |
---|
577 | export DateEnd=${PeriodDateEnd} |
---|
578 | export PeriodPack=${config_Post_PackFrequency} |
---|
579 | export StandAlone=false |
---|
580 | export listVarEnv=${listVarEnv} |
---|
581 | export Script_Post_Output=${Script_Post_Output} |
---|
582 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
583 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
584 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
585 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
586 | IGCM_debug_Verif_Exit_Post |
---|
587 | IGCM_sys_QsubPost ${script} |
---|
588 | IGCM_debug_Verif_Exit |
---|
589 | EOF |
---|
590 | export DateBegin=${SavedDateBegin} |
---|
591 | export DateEnd=${SavedDateEnd} |
---|
592 | fi |
---|
593 | fi |
---|
594 | |
---|
595 | #============== REBUILD POST-PROCESSING =============# |
---|
596 | if ( [ X${AsynchronousRebuild} = Xtrue ] && [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ) ; then |
---|
597 | # ----------------------------------------------------------------------------------- |
---|
598 | # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now |
---|
599 | # ----------------------------------------------------------------------------------- |
---|
600 | echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
601 | echo "} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
602 | IGCM_sys_Mv REBUILD_${PeriodDateBegin} ${REBUILD_DIR} |
---|
603 | fi |
---|
604 | # |
---|
605 | if [ ${RebuildFrequency} = true ] ; then |
---|
606 | IGCM_debug_Print 1 "REBUILD POST-PROCESSING FROM WORKDIR" |
---|
607 | echo |
---|
608 | script=rebuild_fromWorkdir |
---|
609 | # |
---|
610 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
611 | # |
---|
612 | listVarEnv="DEBUG_debug,BigBrother,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" |
---|
613 | IGCM_sys_RshPost <<-EOF |
---|
614 | export DEBUG_debug=${DEBUG_debug} |
---|
615 | export BigBrother=${BigBrother} |
---|
616 | export MODIPSL=${MODIPSL} |
---|
617 | export libIGCM_SX=${libIGCM} |
---|
618 | export libIGCM=${libIGCM_POST} |
---|
619 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
620 | export REBUILD_DIR=${REBUILD_DIR} |
---|
621 | export POST_DIR=${POST_DIR} |
---|
622 | export MASTER=${MASTER} |
---|
623 | export DateBegin=${DateBegin} |
---|
624 | export PeriodDateBegin=${PeriodDateBegin} |
---|
625 | export PeriodDateEnd=${PeriodDateEnd} |
---|
626 | export NbRebuildDir=${NbRebuildDir} |
---|
627 | export StandAlone=false |
---|
628 | export RESOL_ATM=${RESOL_ATM} |
---|
629 | export RESOL_OCE=${RESOL_OCE} |
---|
630 | export RESOL_ICE=${RESOL_ICE} |
---|
631 | export RESOL_MBG=${RESOL_MBG} |
---|
632 | export RESOL_SRF=${RESOL_SRF} |
---|
633 | export RESOL_SBG=${RESOL_SBG} |
---|
634 | export listVarEnv=${listVarEnv} |
---|
635 | export Script_Post_Output=${Script_Post_Output} |
---|
636 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
637 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
638 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
639 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
640 | IGCM_debug_Verif_Exit_Post |
---|
641 | IGCM_sys_QsubPost ${script} |
---|
642 | IGCM_debug_Verif_Exit |
---|
643 | EOF |
---|
644 | fi |
---|
645 | IGCM_debug_PopStack "IGCM_post_Submit" |
---|
646 | } |
---|
647 | |
---|
648 | #=================================== |
---|
649 | function IGCM_post_CheckModuloFrequency |
---|
650 | { |
---|
651 | IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $@ |
---|
652 | |
---|
653 | # Used by IGCM_config_Check |
---|
654 | # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d) |
---|
655 | # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero |
---|
656 | # Input parameter are the name of the variable, not the frequency value itself |
---|
657 | # example |
---|
658 | # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength |
---|
659 | |
---|
660 | typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay |
---|
661 | |
---|
662 | # Get the name of the variable |
---|
663 | MasterName=$1 |
---|
664 | SlaveName=$2 |
---|
665 | # Get the value the above name points to |
---|
666 | MasterFrequency=$( eval echo \${${1}} ) |
---|
667 | SlaveFrequency=$( eval echo \${${2}} ) |
---|
668 | |
---|
669 | IGCM_debug_Print 2 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}" |
---|
670 | |
---|
671 | case ${MasterFrequency} in |
---|
672 | *y|*Y) |
---|
673 | PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) |
---|
674 | case ${SlaveFrequency} in |
---|
675 | *Y|*y) |
---|
676 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
677 | if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \ |
---|
678 | [ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] ); then |
---|
679 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
680 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
681 | IGCM_debug_Exit "Check your frequency" |
---|
682 | else |
---|
683 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) |
---|
684 | fi ;; |
---|
685 | *M|*m) |
---|
686 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
687 | if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \ |
---|
688 | [ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then |
---|
689 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
690 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
691 | IGCM_debug_Exit "Check your frequency" |
---|
692 | else |
---|
693 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) |
---|
694 | fi ;; |
---|
695 | *D|*d) |
---|
696 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
697 | NbDays=$( IGCM_date_DaysInYear ${year} ) |
---|
698 | if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then |
---|
699 | if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \ |
---|
700 | [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then |
---|
701 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
702 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
703 | IGCM_debug_Exit "Check your frequency" |
---|
704 | fi |
---|
705 | else |
---|
706 | IGCM_debug_Print 1 "For ${MasterName} with leap calendar:" |
---|
707 | IGCM_debug_Print 1 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}" |
---|
708 | IGCM_debug_Print 1 "No post-treatment. Case not properly handle at this moment by libIGCM. Sorry" |
---|
709 | IGCM_debug_Exit "Check your frequency ${MasterName} and choose a daily frequency for this one too." |
---|
710 | fi ;; |
---|
711 | esac ;; |
---|
712 | *M|*m) |
---|
713 | PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) |
---|
714 | case ${SlaveFrequency} in |
---|
715 | *Y|*y) |
---|
716 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
717 | if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \ |
---|
718 | [ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then |
---|
719 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
720 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
721 | IGCM_debug_Exit "Check your frequency" |
---|
722 | else |
---|
723 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) |
---|
724 | fi ;; |
---|
725 | *M|*m) |
---|
726 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
727 | if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \ |
---|
728 | [ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then |
---|
729 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
730 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
731 | IGCM_debug_Exit "Check your frequency" |
---|
732 | else |
---|
733 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) |
---|
734 | fi ;; |
---|
735 | *D|*d) |
---|
736 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
737 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
738 | IGCM_debug_Exit "Check your frequency" ;; |
---|
739 | esac ;; |
---|
740 | *D|*d) |
---|
741 | PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) |
---|
742 | case ${SlaveFrequency} in |
---|
743 | *Y|*y) |
---|
744 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
745 | IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}" |
---|
746 | IGCM_debug_Exit "Check your frequency" ;; |
---|
747 | *M|*m) |
---|
748 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
749 | IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}" |
---|
750 | IGCM_debug_Exit "Check your frequency" ;; |
---|
751 | *D|*d) |
---|
752 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
753 | if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \ |
---|
754 | [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ; then |
---|
755 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
756 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
757 | IGCM_debug_Exit "Check your frequency" |
---|
758 | else |
---|
759 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) |
---|
760 | fi ;; |
---|
761 | esac ;; |
---|
762 | NONE|none) |
---|
763 | ;; |
---|
764 | *) |
---|
765 | IGCM_debug_Print 1 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card" |
---|
766 | IGCM_debug_Exit "Check your ${MasterName} in config.card" ;; |
---|
767 | esac |
---|
768 | |
---|
769 | IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency" |
---|
770 | } |
---|
771 | |
---|
772 | #=================================== |
---|
773 | function IGCM_post_ModuloRuntimeFrequency |
---|
774 | { |
---|
775 | IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $@ |
---|
776 | |
---|
777 | # Used by IGCM_post_Configure |
---|
778 | # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and |
---|
779 | # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d) |
---|
780 | # --> turn on post-processing submission when their modulo is zero |
---|
781 | # Input parameter are the name of the variable, not the frequency value itself |
---|
782 | # example |
---|
783 | # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength |
---|
784 | |
---|
785 | typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay |
---|
786 | |
---|
787 | # Get the name of the variable |
---|
788 | MasterName=$1 |
---|
789 | SlaveName=$2 |
---|
790 | # Get the value the above name points to |
---|
791 | eval MasterFrequency=\${${1}} |
---|
792 | eval SlaveFrequency=\${${2}} |
---|
793 | |
---|
794 | echo |
---|
795 | IGCM_debug_Print 2 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}" |
---|
796 | |
---|
797 | case ${MasterFrequency} in |
---|
798 | *y|*Y) |
---|
799 | PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) |
---|
800 | case ${SlaveFrequency} in |
---|
801 | *Y|*y) |
---|
802 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
803 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ; then |
---|
804 | if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
805 | eval ${post_freq}=true ; POST=true |
---|
806 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) |
---|
807 | fi |
---|
808 | fi;; |
---|
809 | *M|*m) |
---|
810 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
811 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then |
---|
812 | if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then |
---|
813 | eval ${post_freq}=true ; POST=true |
---|
814 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) |
---|
815 | fi |
---|
816 | fi;; |
---|
817 | *D|*d) |
---|
818 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
819 | NbDays=$( IGCM_date_DaysInYear ${year} ) |
---|
820 | if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then |
---|
821 | if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then |
---|
822 | eval ${post_freq}=true ; POST=true |
---|
823 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} )) |
---|
824 | fi |
---|
825 | fi;; |
---|
826 | esac ;; |
---|
827 | *M|*m) |
---|
828 | PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) |
---|
829 | case ${SlaveFrequency} in |
---|
830 | *Y|*y) |
---|
831 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
832 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then |
---|
833 | if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then |
---|
834 | eval ${post_freq}=true ; POST=true |
---|
835 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) |
---|
836 | fi |
---|
837 | fi;; |
---|
838 | *M|*m) |
---|
839 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
840 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ; then |
---|
841 | if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
842 | eval ${post_freq}=true ; POST=true |
---|
843 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) |
---|
844 | fi |
---|
845 | fi;; |
---|
846 | *D|*d) |
---|
847 | IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" |
---|
848 | IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; |
---|
849 | esac ;; |
---|
850 | *D|*d) |
---|
851 | PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) |
---|
852 | case ${SlaveFrequency} in |
---|
853 | *Y|*y) |
---|
854 | IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" |
---|
855 | IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; |
---|
856 | *M|*m) |
---|
857 | IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" |
---|
858 | IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; |
---|
859 | *D|*d) |
---|
860 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
861 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ; then |
---|
862 | if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
863 | eval ${post_freq}=true ; POST=true |
---|
864 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) |
---|
865 | fi |
---|
866 | fi;; |
---|
867 | esac ;; |
---|
868 | NONE|none) |
---|
869 | ;; |
---|
870 | *) |
---|
871 | IGCM_debug_Print 1 "KeyWord not allowed for ${post_freq} in config.card" |
---|
872 | ;; |
---|
873 | esac |
---|
874 | |
---|
875 | IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency" |
---|
876 | } |
---|