[2] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sebastien Denvil |
---|
[373] | 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 |
---|
[2] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #======================================================================= |
---|
[22] | 15 | |
---|
| 16 | function IGCM_post_Configure |
---|
| 17 | { |
---|
[544] | 18 | IGCM_debug_PushStack "IGCM_post_Configure" |
---|
[22] | 19 | |
---|
[544] | 20 | # Debug Print : |
---|
| 21 | echo |
---|
| 22 | IGCM_debug_Print 1 "IGCM_post_Configure" |
---|
| 23 | # |
---|
| 24 | # Initialize |
---|
| 25 | # |
---|
| 26 | POST=false |
---|
| 27 | RebuildFrequency=false |
---|
[554] | 28 | PackFrequency=false |
---|
[544] | 29 | TimeSeriesFrequency=false |
---|
| 30 | SeasonalFrequency=false |
---|
[554] | 31 | unset list_post |
---|
[544] | 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 | # |
---|
[554] | 39 | if [ X${Pack} = Xtrue ] ; then |
---|
| 40 | list_post="${list_post} PackFrequency" |
---|
| 41 | fi |
---|
| 42 | # |
---|
[653] | 43 | if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] || [ X${TimeSeriesChunck2D} = Xtrue ] || [ X${TimeSeriesChunck3D} = Xtrue ] ) ; then |
---|
[544] | 44 | list_post="${list_post} TimeSeriesFrequency" |
---|
| 45 | fi |
---|
| 46 | # |
---|
| 47 | if [ X${Seasonal} = Xtrue ] ; then |
---|
| 48 | list_post="${list_post} SeasonalFrequency" |
---|
| 49 | fi |
---|
[380] | 50 | |
---|
[1034] | 51 | # Overrule Time Series triggering. Special case 1. |
---|
[544] | 52 | if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ |
---|
[545] | 53 | [ ! X${config_Post_TimeSeriesFrequency} = XNONE ] && \ |
---|
[544] | 54 | [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
| 55 | TimeSeriesFrequency=true |
---|
| 56 | POST=true |
---|
| 57 | fi |
---|
[1034] | 58 | # Overrule Rebuild triggering. Special case 2. |
---|
[545] | 59 | if ( [ X${AsynchronousRebuild} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
[544] | 60 | RebuildFrequency=true |
---|
| 61 | POST=true |
---|
| 62 | fi |
---|
[1034] | 63 | # Overrule Pack triggering. Special case 3. |
---|
| 64 | if ( [ X${Pack} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
| 65 | PackFrequency=true |
---|
| 66 | POST=true |
---|
| 67 | fi |
---|
[544] | 68 | |
---|
[1034] | 69 | # READ REBUILD OR PACK OR TIME SERIES OR SEASONAL FREQUENCY |
---|
[544] | 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 |
---|
[786] | 77 | PeriodOffset=0 |
---|
[544] | 78 | else |
---|
[786] | 79 | PeriodOffset=${config_Post_SeasonalFrequencyOffset} |
---|
[544] | 80 | fi |
---|
| 81 | else |
---|
| 82 | PeriodOffset=0 |
---|
[380] | 83 | fi |
---|
[544] | 84 | # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) |
---|
| 85 | # RebuildFrequency needs additionnal information |
---|
| 86 | if [ ${post_freq} = RebuildFrequency ] ; then |
---|
[639] | 87 | IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbPeriodPerFrequency |
---|
| 88 | NbRebuildDir=${NbPeriodPerFrequency} |
---|
[544] | 89 | else |
---|
| 90 | IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength |
---|
[380] | 91 | fi |
---|
[34] | 92 | # |
---|
[663] | 93 | eval IGCM_debug_Print 1 \" "${post_freq} flag value : \${${post_freq}}" \" |
---|
[544] | 94 | done |
---|
| 95 | # |
---|
| 96 | IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}" |
---|
| 97 | # |
---|
[653] | 98 | # Prepare headers for the shell dedicated to post-processing |
---|
| 99 | if ( [ ${PackFrequency} = true ] && ( [ ${TimeSeriesFrequency} = true ] || [ ${SeasonalFrequency} = true ] ) ) ; then |
---|
[628] | 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 |
---|
[544] | 110 | IGCM_debug_PopStack "IGCM_post_Configure" |
---|
[2] | 111 | } |
---|
| 112 | |
---|
| 113 | function IGCM_post_Submit |
---|
| 114 | { |
---|
[544] | 115 | IGCM_debug_PushStack "IGCM_post_Submit" |
---|
[2] | 116 | |
---|
[555] | 117 | typeset listVarEnv DaysTemp |
---|
[381] | 118 | |
---|
[545] | 119 | POST_DIR=${R_BUF_KSH} |
---|
[622] | 120 | |
---|
[544] | 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 |
---|
[34] | 127 | |
---|
[554] | 128 | #============ TIME SERIES POST-PROCESSING ===========# |
---|
[544] | 129 | if [ ${TimeSeriesFrequency} = true ] ; then |
---|
[2] | 130 | |
---|
[544] | 131 | IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ACTIVATED" |
---|
| 132 | echo |
---|
[149] | 133 | |
---|
| 134 | |
---|
| 135 | |
---|
[544] | 136 | # Get information from last execution |
---|
| 137 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted |
---|
| 138 | CompletedFlag=${run_PostProcessing_TimeSeriesCompleted} |
---|
| 139 | # |
---|
[149] | 140 | |
---|
| 141 | |
---|
| 142 | |
---|
[1113] | 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" |
---|
[544] | 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 |
---|
[786] | 151 | # |
---|
| 152 | IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED" |
---|
| 153 | echo |
---|
[544] | 154 | # |
---|
[786] | 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 | # |
---|
[1257] | 163 | if ( [ ${RebuildFrequency} = true ] || [ ${PackFrequency} = true ] ) ; then |
---|
[786] | 164 | # |
---|
[628] | 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 | # |
---|
[786] | 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} |
---|
[1070] | 176 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
[786] | 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} |
---|
[1206] | 204 | echo "IGCM_debug_Verif_Exit " >> ${FunctionPath} |
---|
[786] | 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 |
---|
[149] | 212 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 213 | export BigBrother=${BigBrother} |
---|
[149] | 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} |
---|
[417] | 226 | unset CompToRead |
---|
[786] | 227 | unset FlagToRead |
---|
[149] | 228 | export RESOL_ATM=${RESOL_ATM} |
---|
| 229 | export RESOL_OCE=${RESOL_OCE} |
---|
| 230 | export RESOL_ICE=${RESOL_ICE} |
---|
[178] | 231 | export RESOL_MBG=${RESOL_MBG} |
---|
[149] | 232 | export RESOL_SRF=${RESOL_SRF} |
---|
[337] | 233 | export RESOL_SBG=${RESOL_SBG} |
---|
[149] | 234 | export listVarEnv=${listVarEnv} |
---|
[387] | 235 | export Script_Post_Output=${Script_Post_Output} |
---|
[149] | 236 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 237 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 238 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 239 | IGCM_debug_Verif_Exit |
---|
[149] | 240 | IGCM_sys_QsubPost create_ts |
---|
| 241 | EOF |
---|
[786] | 242 | fi |
---|
[544] | 243 | fi |
---|
| 244 | # |
---|
| 245 | if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then |
---|
[786] | 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 | # |
---|
[1257] | 279 | if ( [ ${RebuildFrequency} = true ] || [ ${PackFrequency} = true ] ) ; then |
---|
[786] | 280 | # |
---|
[628] | 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 | # |
---|
[786] | 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} |
---|
[1070] | 292 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
[786] | 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} |
---|
[1206] | 320 | echo "IGCM_debug_Verif_Exit " >> ${FunctionPath} |
---|
[786] | 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 |
---|
[149] | 328 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 329 | export BigBrother=${BigBrother} |
---|
[149] | 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} |
---|
[178] | 347 | export RESOL_MBG=${RESOL_MBG} |
---|
[149] | 348 | export RESOL_SRF=${RESOL_SRF} |
---|
[337] | 349 | export RESOL_SBG=${RESOL_SBG} |
---|
[149] | 350 | export listVarEnv=${listVarEnv} |
---|
[387] | 351 | export Script_Post_Output=${Script_Post_Output} |
---|
[149] | 352 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 353 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 354 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 355 | IGCM_debug_Verif_Exit |
---|
[149] | 356 | IGCM_sys_QsubPost create_ts |
---|
[2] | 357 | EOF |
---|
[786] | 358 | # |
---|
| 359 | fi |
---|
| 360 | # |
---|
| 361 | export DateBegin=${SavedDateBegin} |
---|
| 362 | # |
---|
| 363 | (( i=i+1 )) |
---|
| 364 | # |
---|
| 365 | done |
---|
[544] | 366 | fi |
---|
| 367 | (( j=j+1 )) |
---|
| 368 | done |
---|
| 369 | fi |
---|
[149] | 370 | |
---|
[554] | 371 | #============= SEASONAL POST-PROCESSING ============# |
---|
[544] | 372 | if [ ${SeasonalFrequency} = true ] ; then |
---|
| 373 | # |
---|
[554] | 374 | IGCM_debug_Print 1 "SEASONNAL POST-PROCESSING" |
---|
[544] | 375 | echo |
---|
| 376 | # |
---|
| 377 | Script_Post_Output=create_se.${PeriodDateEnd} |
---|
| 378 | # |
---|
[1113] | 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" |
---|
[544] | 380 | |
---|
[1257] | 381 | if ( [ ${RebuildFrequency} = true ] || [ ${PackFrequency} = true ] ) ; then |
---|
[544] | 382 | # |
---|
[628] | 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 |
---|
[786] | 390 | # |
---|
| 391 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 392 | # echo "IGCM_sys_RshPost <<-EOF" >> ${FunctionPath} |
---|
| 393 | # fi |
---|
| 394 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${FunctionPath} |
---|
[1070] | 395 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
[786] | 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} |
---|
[1206] | 418 | echo "IGCM_debug_Verif_Exit " >> ${FunctionPath} |
---|
[786] | 419 | echo "IGCM_sys_QsubPost create_se " >> ${FunctionPath} |
---|
| 420 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 421 | # echo "EOF" >> ${FunctionPath} |
---|
| 422 | # fi |
---|
[544] | 423 | fi |
---|
| 424 | else |
---|
| 425 | IGCM_sys_RshPost <<-EOF |
---|
[36] | 426 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 427 | export BigBrother=${BigBrother} |
---|
[22] | 428 | export MODIPSL=${MODIPSL} |
---|
[1070] | 429 | export libIGCM_SX=${libIGCM} |
---|
[22] | 430 | export libIGCM=${libIGCM_POST} |
---|
| 431 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
| 432 | export POST_DIR=${POST_DIR} |
---|
[72] | 433 | export MASTER=${MASTER} |
---|
[22] | 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} |
---|
[178] | 440 | export RESOL_MBG=${RESOL_MBG} |
---|
[22] | 441 | export RESOL_SRF=${RESOL_SRF} |
---|
[337] | 442 | export RESOL_SBG=${RESOL_SBG} |
---|
[22] | 443 | export listVarEnv=${listVarEnv} |
---|
[387] | 444 | export Script_Post_Output=${Script_Post_Output} |
---|
[22] | 445 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 446 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 447 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 448 | IGCM_debug_Verif_Exit |
---|
[22] | 449 | IGCM_sys_QsubPost create_se |
---|
| 450 | EOF |
---|
| 451 | fi |
---|
[544] | 452 | fi |
---|
[22] | 453 | |
---|
[628] | 454 | #============== PACK PROCESSING FOR RESTART, DEBUG AND OUTPUT FILES =============# |
---|
[554] | 455 | if [ ${PackFrequency} = true ] ; then |
---|
| 456 | IGCM_debug_Print 1 "PACK POST-PROCESSING" |
---|
[628] | 457 | # ----------------------------------------------------------------------------------- |
---|
| 458 | # Function IGCM_FlushPost called by pack_output.job has not been closed yet. Do it now |
---|
[1077] | 459 | # Will submit Time Series OR Seasonal Average if needed |
---|
[628] | 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 |
---|
[554] | 465 | echo |
---|
| 466 | ## Need to Remember This One |
---|
| 467 | SavedDateBegin=${DateBegin} |
---|
| 468 | ## Need to Remember This One |
---|
| 469 | SavedDateEnd=${DateEnd} |
---|
| 470 | # |
---|
[555] | 471 | DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 )) |
---|
[554] | 472 | # |
---|
[565] | 473 | PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} ) |
---|
[555] | 474 | # |
---|
[554] | 475 | script=pack_debug |
---|
| 476 | # |
---|
| 477 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 478 | # |
---|
[1113] | 479 | listVarEnv="DEBUG_debug,BigBrother,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,DateEnd,PeriodPack,StandAlone" |
---|
[554] | 480 | IGCM_sys_RshPost <<-EOF |
---|
| 481 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 482 | export BigBrother=${BigBrother} |
---|
[554] | 483 | export MODIPSL=${MODIPSL} |
---|
| 484 | export libIGCM_SX=${libIGCM} |
---|
| 485 | export libIGCM=${libIGCM_POST} |
---|
| 486 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
[568] | 487 | export POST_DIR=${POST_DIR} |
---|
[554] | 488 | export MASTER=${MASTER} |
---|
| 489 | export DateBegin=${PackDateBegin} |
---|
| 490 | export DateEnd=${PeriodDateEnd} |
---|
[569] | 491 | export PeriodPack=${config_Post_PackFrequency} |
---|
[554] | 492 | export StandAlone=false |
---|
| 493 | export listVarEnv=${listVarEnv} |
---|
| 494 | export Script_Post_Output=${Script_Post_Output} |
---|
| 495 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
[985] | 496 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[554] | 497 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 498 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 499 | IGCM_debug_Verif_Exit |
---|
[565] | 500 | IGCM_sys_QsubPost ${script} |
---|
[985] | 501 | IGCM_debug_Verif_Exit |
---|
[554] | 502 | EOF |
---|
[565] | 503 | # |
---|
| 504 | script=pack_restart |
---|
| 505 | # |
---|
| 506 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 507 | # |
---|
[786] | 508 | IGCM_sys_RshPost <<-EOF |
---|
| 509 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 510 | export BigBrother=${BigBrother} |
---|
[786] | 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 |
---|
[985] | 524 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[786] | 525 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 526 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 527 | IGCM_debug_Verif_Exit |
---|
[786] | 528 | IGCM_sys_QsubPost ${script} |
---|
[985] | 529 | IGCM_debug_Verif_Exit |
---|
[565] | 530 | EOF |
---|
[583] | 531 | # |
---|
| 532 | script=pack_output |
---|
| 533 | # |
---|
| 534 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 535 | # |
---|
[804] | 536 | if ( [ ${RebuildFrequency} = true ] && [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ) ; then |
---|
[786] | 537 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 538 | # echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
| 539 | # fi |
---|
[804] | 540 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
[1070] | 541 | echo "export BigBrother=${BigBrother} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
[804] | 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 |
---|
[786] | 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 |
---|
[804] | 559 | echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
[1206] | 560 | echo "IGCM_debug_Verif_Exit " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
[804] | 561 | echo "IGCM_sys_QsubPost ${script} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
[786] | 562 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 563 | # echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
| 564 | # fi |
---|
[985] | 565 | echo "IGCM_debug_Verif_Exit " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
[590] | 566 | else |
---|
| 567 | IGCM_sys_RshPost <<-EOF |
---|
[786] | 568 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 569 | export BigBrother=${BigBrother} |
---|
[786] | 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 |
---|
[985] | 583 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[786] | 584 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 585 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 586 | IGCM_debug_Verif_Exit |
---|
[786] | 587 | IGCM_sys_QsubPost ${script} |
---|
[985] | 588 | IGCM_debug_Verif_Exit |
---|
[583] | 589 | EOF |
---|
[786] | 590 | export DateBegin=${SavedDateBegin} |
---|
| 591 | export DateEnd=${SavedDateEnd} |
---|
[590] | 592 | fi |
---|
[554] | 593 | fi |
---|
[590] | 594 | |
---|
| 595 | #============== REBUILD POST-PROCESSING =============# |
---|
[804] | 596 | if ( [ X${AsynchronousRebuild} = Xtrue ] && [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ) ; then |
---|
[590] | 597 | # ----------------------------------------------------------------------------------- |
---|
| 598 | # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now |
---|
| 599 | # ----------------------------------------------------------------------------------- |
---|
[1043] | 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} |
---|
[590] | 603 | fi |
---|
| 604 | # |
---|
| 605 | if [ ${RebuildFrequency} = true ] ; then |
---|
[1031] | 606 | IGCM_debug_Print 1 "REBUILD POST-PROCESSING FROM WORKDIR" |
---|
| 607 | echo |
---|
[927] | 608 | script=rebuild_fromWorkdir |
---|
[590] | 609 | # |
---|
| 610 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 611 | # |
---|
[1113] | 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" |
---|
[590] | 613 | IGCM_sys_RshPost <<-EOF |
---|
[786] | 614 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 615 | export BigBrother=${BigBrother} |
---|
[786] | 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 |
---|
[985] | 637 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[786] | 638 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 639 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 640 | IGCM_debug_Verif_Exit |
---|
[786] | 641 | IGCM_sys_QsubPost ${script} |
---|
[985] | 642 | IGCM_debug_Verif_Exit |
---|
[590] | 643 | EOF |
---|
| 644 | fi |
---|
[544] | 645 | IGCM_debug_PopStack "IGCM_post_Submit" |
---|
[2] | 646 | } |
---|
[380] | 647 | |
---|
| 648 | #=================================== |
---|
| 649 | function IGCM_post_CheckModuloFrequency |
---|
| 650 | { |
---|
[1057] | 651 | IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $@ |
---|
[380] | 652 | |
---|
[544] | 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 |
---|
[380] | 659 | |
---|
[544] | 660 | typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay |
---|
[380] | 661 | |
---|
[544] | 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}} ) |
---|
[380] | 668 | |
---|
[544] | 669 | IGCM_debug_Print 2 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}" |
---|
[380] | 670 | |
---|
[544] | 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} ] || \ |
---|
[786] | 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" |
---|
[639] | 682 | else |
---|
| 683 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) |
---|
[544] | 684 | fi ;; |
---|
| 685 | *M|*m) |
---|
| 686 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 687 | if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \ |
---|
[786] | 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" |
---|
[639] | 692 | else |
---|
| 693 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) |
---|
[544] | 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 |
---|
[786] | 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 |
---|
[544] | 705 | else |
---|
[786] | 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." |
---|
[544] | 710 | fi ;; |
---|
| 711 | esac ;; |
---|
| 712 | *M|*m) |
---|
| 713 | PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) |
---|
[590] | 714 | case ${SlaveFrequency} in |
---|
[544] | 715 | *Y|*y) |
---|
| 716 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
| 717 | if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \ |
---|
[786] | 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" |
---|
[639] | 722 | else |
---|
| 723 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) |
---|
[544] | 724 | fi ;; |
---|
| 725 | *M|*m) |
---|
| 726 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 727 | if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \ |
---|
[1077] | 728 | [ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then |
---|
[786] | 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" |
---|
[639] | 732 | else |
---|
| 733 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) |
---|
[544] | 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}" |
---|
[786] | 757 | IGCM_debug_Exit "Check your frequency" |
---|
[639] | 758 | else |
---|
| 759 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) |
---|
[544] | 760 | fi ;; |
---|
| 761 | esac ;; |
---|
[545] | 762 | NONE|none) |
---|
[544] | 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 |
---|
[380] | 768 | |
---|
[544] | 769 | IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency" |
---|
[380] | 770 | } |
---|
| 771 | |
---|
| 772 | #=================================== |
---|
| 773 | function IGCM_post_ModuloRuntimeFrequency |
---|
| 774 | { |
---|
[1057] | 775 | IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $@ |
---|
[380] | 776 | |
---|
[544] | 777 | # Used by IGCM_post_Configure |
---|
[1077] | 778 | # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and |
---|
[544] | 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 |
---|
[380] | 784 | |
---|
[544] | 785 | typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay |
---|
[380] | 786 | |
---|
[544] | 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}} |
---|
[380] | 793 | |
---|
[544] | 794 | echo |
---|
| 795 | IGCM_debug_Print 2 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}" |
---|
[380] | 796 | |
---|
[544] | 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 |
---|
[786] | 804 | if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
| 805 | eval ${post_freq}=true ; POST=true |
---|
| 806 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) |
---|
| 807 | fi |
---|
[544] | 808 | fi;; |
---|
| 809 | *M|*m) |
---|
| 810 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 811 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then |
---|
[786] | 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 |
---|
[544] | 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 |
---|
[786] | 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 |
---|
[544] | 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 |
---|
[786] | 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 |
---|
[544] | 837 | fi;; |
---|
| 838 | *M|*m) |
---|
| 839 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 840 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ; then |
---|
[1077] | 841 | if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
[786] | 842 | eval ${post_freq}=true ; POST=true |
---|
| 843 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) |
---|
| 844 | fi |
---|
[544] | 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 |
---|
[786] | 863 | eval ${post_freq}=true ; POST=true |
---|
| 864 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) |
---|
| 865 | fi |
---|
[544] | 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 |
---|
[380] | 874 | |
---|
[544] | 875 | IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency" |
---|
[380] | 876 | } |
---|