Changeset 380 for trunk/libIGCM/libIGCM_post
- Timestamp:
- 11/09/10 16:02:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_post/libIGCM_post.ksh
r373 r380 22 22 IGCM_debug_Print 1 "IGCM_post_Configure :" 23 23 echo 24 25 typeset NbDays PeriodEndJul PostEndJul PeriodPost 24 # 25 # Initialize 26 # 27 POST=false 26 28 RebuildFrequency=false 27 28 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then29 30 IGCM_debug_Print 1 "Asynchronous rebuild has been activated."31 echo32 33 case ${config_Post_RebuildFrequency} in34 *y|*Y)35 PeriodYear=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[yY]//" )36 case ${config_UserChoices_PeriodLength} in37 *Y|*y)38 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )39 if [ ${PeriodPost} -le ${PeriodYear} ] ; then40 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear} ) -eq 0 ] ; then41 RebuildFrequency=true42 NbRebuildDir=$( expr ${PeriodYear} / ${PeriodPost} )43 fi44 else45 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"46 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"47 fi ;;48 *M|*m)49 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )50 if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then51 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then52 RebuildFrequency=true53 NbRebuildDir=$( expr $(( 12 * ${PeriodYear} )) / ${PeriodPost} )54 fi55 else56 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"57 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"58 fi ;;59 *D|*d)60 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )61 NbDays=$( IGCM_date_DaysInYear ${year} )62 if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then63 if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then64 if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then65 RebuildFrequency=true66 NbRebuildDir=$( expr $(( ${NbDays} * ${PeriodYear} )) / ${PeriodPost} )67 fi68 else69 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"70 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"71 fi72 else73 # if [ ${PeriodYear} -eq 1 ] ; then74 # PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )75 # PostEndJul=${year}${NbDays}76 # #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"77 # #echo "PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"78 # if [ ${PostEndJul} -eq ${PeriodEndJul} ] ; then79 # RebuildFrequency=true80 # NbRebuildDir=$( expr ${NbDays} / ${PeriodPost} )81 # fi82 # else83 IGCM_debug_Print 3 "For RebuildFrequency with leap calendar:"84 IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."85 IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."86 # fi87 fi;;88 esac ;;89 *M|*m)90 PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" )91 case ${config_UserChoices_PeriodLength} in92 *Y|*y)93 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"94 IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;95 *M|*m)96 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )97 if [ ${PeriodPost} -le ${PeriodMonth} ] ; then98 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth} ) -eq 0 ] ; then99 RebuildFrequency=true100 NbRebuildDir=$( expr ${PeriodMonth} / ${PeriodPost} )101 fi102 else103 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"104 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"105 fi ;;106 *D|*d)107 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"108 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" ;;109 esac110 ;;111 *D|*d)112 PeriodDay=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[dD]//" )113 case ${config_UserChoices_PeriodLength} in114 *Y|*y)115 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"116 IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;117 *M|*m)118 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"119 IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;120 *D|*d)121 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )122 if [ ${PeriodPost} -le ${PeriodDay} ] ; then123 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodDay} ) -eq 0 ] ; then124 RebuildFrequency=true125 NbRebuildDir=$( expr ${PeriodDay} / ${PeriodPost} )126 fi127 else128 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"129 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"130 fi ;;131 132 esac133 ;;134 NONE|none)135 ;;136 *)137 IGCM_debug_Print 3 "KeyWord not allowed for RebuildFrequency in config.card"138 ;;139 esac140 else141 #142 IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"143 IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"144 echo145 #146 fi147 148 IGCM_debug_Print 1 "RebuildFrequency flag value : ${RebuildFrequency}"149 IGCM_post_Initialize150 151 IGCM_debug_PopStack "IGCM_post_Configure"152 }153 154 function IGCM_post_Initialize155 {156 IGCM_debug_PushStack "IGCM_post_Initialize"157 158 # Debug Print :159 echo160 IGCM_debug_Print 1 "IGCM_post_Initialize :"161 echo162 163 typeset NbDays PeriodEndJul PostEndJul164 #165 # Initialize166 #167 POST=false168 29 TimeSeriesFrequency=false 169 30 SeasonalFrequency=false … … 171 32 # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS 172 33 # 34 if [ X${AsynchronousRebuild} = Xtrue ] ; then 35 list_post="RebuildFrequency" 36 fi 37 # 173 38 if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then 174 list_post= TimeSeriesFrequency39 list_post="${list_post} TimeSeriesFrequency" 175 40 fi 176 41 # … … 178 43 list_post="${list_post} SeasonalFrequency" 179 44 fi 180 # 181 # READ TIME SERIES OR SEASONAL FREQUENCY 45 46 # Overrule special cases 47 if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ 48 [ ! X${config_Post_TimeSeriesFrequency} = XNONE ] && \ 49 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 50 TimeSeriesFrequency=true 51 POST=true 52 fi 53 # 54 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \ 55 [ ! X${config_Post_RebuildFrequency} = XNONE ] && \ 56 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 57 RebuildFrequency=true 58 POST=true 59 fi 60 61 # READ REBUILD OR TIME SERIES OR SEASONAL FREQUENCY 182 62 # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO 183 #184 63 for post_freq in ${list_post} ; do 185 #186 64 # Extract frequency from previously defined variable 187 #188 65 config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} ) 189 #190 66 # Offset for Seasonal Average starting period 191 #192 67 if [ ${post_freq} = SeasonalFrequency ] ; then 193 68 if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then … … 199 74 PeriodOffset=0 200 75 fi 201 # 202 if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then 203 # 204 continue 205 # 206 fi 207 # 208 case ${config_Post_post_freq} in 209 *y|*Y) 210 PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" ) 211 # 212 case ${config_UserChoices_PeriodLength} in 213 *Y|*y) 214 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" ) 215 if [ ${PeriodPost} -le ${PeriodYear} ] ; then 216 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodYear} ) -eq 0 ] ; then 217 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true 218 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true 219 fi 220 else 221 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 222 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 223 fi ;; 224 *M|*m) 225 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 226 if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then 227 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 228 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && eval ${post_freq}=true 229 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && POST=true 230 fi 231 else 232 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 233 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 234 fi ;; 235 *D|*d) 236 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 237 NbDays=$( IGCM_date_DaysInYear ${year} ) 238 if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then 239 if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then 240 if [ $( expr $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) % \ 241 $(( ${NbDays} * ${PeriodYear} / ${PeriodPost} )) ) -eq 0 ] ; then 242 [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] && eval ${post_freq}=true 243 [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] POST=true 244 fi 245 else 246 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 247 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 248 fi 249 else 250 # if [ ${PeriodYear} -eq 1 ] ; then 251 # PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 252 # PostEndJul=${year}${NbDays} 253 # #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}" 254 # #echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 255 # if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then 256 # eval ${post_freq}=true 257 # POST=true 258 # fi 259 # else 260 IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :" 261 IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y." 262 IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 263 # fi 264 fi;; 265 esac ;; 266 *M|*m) 267 PeriodMonth=$( echo ${config_Post_post_freq} | sed -e "s/[mM]//" ) 268 case ${config_UserChoices_PeriodLength} in 269 *Y|*y) 270 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 271 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 272 *M|*m) 273 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 274 if [ ${PeriodPost} -le ${PeriodMonth} ] ; then 275 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodMonth} ) -eq 0 ] ; then 276 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true 277 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true 278 fi 279 else 280 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 281 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 282 fi;; 283 *D|*d) 284 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 285 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 286 esac ;; 287 *D|*d) 288 PeriodDay=$( echo ${config_Post_post_freq} | sed -e "s/[dD]//" ) 289 case ${config_UserChoices_PeriodLength} in 290 *Y|*y) 291 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 292 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 293 *M|*m) 294 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 295 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 296 *D|*d) 297 PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 298 if [ ${PeriodPost} -le ${PeriodDay} ] ; then 299 if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodDay} ) -eq 0 ] ; then 300 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true 301 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true 302 fi 303 else 304 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 305 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 306 fi;; 307 esac ;; 308 NONE|none) 309 ;; 310 *) 311 IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card" 312 ;; 313 esac 76 # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) 77 # RebuildFrequency needs additionnal information 78 if [ ${post_freq} = RebuildFrequency ] ; then 79 IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbRebuildDir 80 else 81 IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength 82 fi 83 # 84 IGCM_debug_Print 1 "${post_freq} flag value : ${RebuildFrequency}" 314 85 done 315 86 # 316 if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ 317 [ ! X${config_Post_TimeSeriesFrequency} = XNONE ] && \ 318 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 319 TimeSeriesFrequency=true 320 POST=true 321 fi 322 323 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \ 324 [ ! X${config_Post_RebuildFrequency} = XNONE ] && \ 325 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 326 RebuildFrequency=true 327 POST=true 328 fi 329 330 # 87 echo 331 88 IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}" 332 89 # 333 IGCM_post_Submit 334 335 IGCM_debug_PopStack "IGCM_post_Initialize" 90 IGCM_debug_PopStack "IGCM_post_Configure" 336 91 } 337 92 … … 365 120 366 121 typeset listVarEnv 367 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG ,config_UserChoices_JobName,R_SAVE"122 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 368 123 # 369 124 jLoop=${#ListDimension[*]} … … 405 160 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 406 161 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 407 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh408 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh409 162 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 410 163 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh … … 435 188 export RESOL_SRF=${RESOL_SRF} 436 189 export RESOL_SBG=${RESOL_SBG} 437 export config_UserChoices_JobName=${config_UserChoices_JobName}438 export R_SAVE=${R_SAVE}439 190 export listVarEnv=${listVarEnv} 440 191 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh … … 502 253 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 503 254 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 504 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh505 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh506 255 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 507 256 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh … … 534 283 export RESOL_SRF=${RESOL_SRF} 535 284 export RESOL_SBG=${RESOL_SBG} 536 export config_UserChoices_JobName=${config_UserChoices_JobName}537 export R_SAVE=${R_SAVE}538 285 export listVarEnv=${listVarEnv} 539 286 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh … … 563 310 # 564 311 typeset listVarEnv 565 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG ,config_UserChoices_JobName,R_SAVE"312 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 566 313 567 314 if [ ${RebuildFrequency} = true ] && [ ${DRYRUN} -le 1 ] ; then … … 584 331 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 585 332 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 586 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh587 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh588 333 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 589 334 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh … … 611 356 export RESOL_SRF=${RESOL_SRF} 612 357 export RESOL_SBG=${RESOL_SBG} 613 export config_UserChoices_JobName=${config_UserChoices_JobName}614 export R_SAVE=${R_SAVE}615 358 export listVarEnv=${listVarEnv} 616 359 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh … … 648 391 # 649 392 typeset listVarEnv 650 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG ,config_UserChoices_JobName,R_SAVE"393 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 651 394 IGCM_sys_RshPost <<-EOF 652 395 export DEBUG_debug=${DEBUG_debug} … … 670 413 export RESOL_SRF=${RESOL_SRF} 671 414 export RESOL_SBG=${RESOL_SBG} 672 export config_UserChoices_JobName=${config_UserChoices_JobName}673 export R_SAVE=${R_SAVE}674 415 export listVarEnv=${listVarEnv} 675 416 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh … … 685 426 # 686 427 typeset listVarEnv 687 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG ,config_UserChoices_JobName,R_SAVE"428 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 688 429 IGCM_sys_RshPost <<-EOF 689 430 export DEBUG_debug=${DEBUG_debug} … … 707 448 export RESOL_SRF=${RESOL_SRF} 708 449 export RESOL_SBG=${RESOL_SBG} 709 export config_UserChoices_JobName=${config_UserChoices_JobName}710 export R_SAVE=${R_SAVE}711 450 export listVarEnv=${listVarEnv} 712 451 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh … … 721 460 IGCM_debug_PopStack "IGCM_post_Submit" 722 461 } 462 463 #=================================== 464 function IGCM_post_CheckModuloFrequency 465 { 466 IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $* 467 468 set -vx 469 470 # Used by IGCM_config_Check 471 # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d) 472 # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero 473 # Input parameter are the name of the variable, not the frequency value itself 474 # example 475 # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 476 477 typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay 478 479 # Get the name of the variable 480 MasterName=$1 481 SlaveName=$2 482 # Get the value the above name points to 483 MasterFrequency=$( eval echo \${${1}} ) 484 SlaveFrequency=$( eval echo \${${2}} ) 485 486 echo 487 IGCM_debug_Print 1 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}" 488 echo 489 490 case ${MasterFrequency} in 491 *y|*Y) 492 PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) 493 case ${SlaveFrequency} in 494 *Y|*y) 495 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 496 if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \ 497 [ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] ); then 498 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 499 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 500 IGCM_debug_Exit "Check your frequency" 501 fi ;; 502 *M|*m) 503 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 504 if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \ 505 [ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then 506 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 507 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 508 IGCM_debug_Exit "Check your frequency" 509 fi ;; 510 *D|*d) 511 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 512 NbDays=$( IGCM_date_DaysInYear ${year} ) 513 if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then 514 if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \ 515 [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then 516 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 517 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 518 IGCM_debug_Exit "Check your frequency" 519 fi 520 else 521 IGCM_debug_Print 3 "For ${MasterName} with leap calendar:" 522 IGCM_debug_Print 3 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}" 523 IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 524 IGCM_debug_Exit "Check your frequency" 525 fi ;; 526 esac ;; 527 *M|*m) 528 PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) 529 case ${SlaveFrequency} in 530 *Y|*y) 531 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 532 if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \ 533 [ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then 534 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 535 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 536 IGCM_debug_Exit "Check your frequency" 537 fi ;; 538 *M|*m) 539 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 540 if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \ 541 [ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then 542 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 543 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 544 IGCM_debug_Exit "Check your frequency" 545 fi ;; 546 *D|*d) 547 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 548 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 549 IGCM_debug_Exit "Check your frequency" ;; 550 esac ;; 551 *D|*d) 552 PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) 553 case ${SlaveFrequency} in 554 *Y|*y) 555 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 556 IGCM_debug_Print 3 "${MasterName} frequency ${MasterFrequency}" 557 IGCM_debug_Exit "Check your frequency" ;; 558 *M|*m) 559 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 560 IGCM_debug_Print 3 "${MasterName} frequency ${MasterFrequency}" 561 IGCM_debug_Exit "Check your frequency" ;; 562 *D|*d) 563 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 564 if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \ 565 [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ; then 566 IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 567 IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 568 IGCM_debug_Exit "Check your frequency" 569 fi ;; 570 esac ;; 571 NONE|none) 572 ;; 573 *) 574 IGCM_debug_Print 3 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card" 575 IGCM_debug_Exit "Check your ${MasterName} in config.card" ;; 576 esac 577 578 IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency" 579 } 580 581 #=================================== 582 function IGCM_post_ModuloRuntimeFrequency 583 { 584 IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $* 585 586 set -vx 587 588 # Used by IGCM_post_Configure 589 # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and 590 # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d) 591 # --> turn on post-processing submission when their modulo is zero 592 # Input parameter are the name of the variable, not the frequency value itself 593 # example 594 # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength 595 596 typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay 597 598 # Get the name of the variable 599 MasterName=$1 600 SlaveName=$2 601 602 # Get the value the above name points to 603 eval MasterFrequency=\${${1}} 604 eval SlaveFrequency=\${${2}} 605 606 echo 607 IGCM_debug_Print 1 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}" 608 echo 609 610 case ${MasterFrequency} in 611 *y|*Y) 612 PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) 613 case ${SlaveFrequency} in 614 *Y|*y) 615 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 616 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ; then 617 if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then 618 eval ${post_freq}=true ; POST=true 619 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) 620 fi 621 fi;; 622 *M|*m) 623 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 624 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then 625 if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then 626 eval ${post_freq}=true ; POST=true 627 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) 628 fi 629 fi;; 630 *D|*d) 631 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 632 NbDays=$( IGCM_date_DaysInYear ${year} ) 633 if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then 634 if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then 635 eval ${post_freq}=true ; POST=true 636 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} )) 637 fi 638 fi;; 639 esac ;; 640 *M|*m) 641 PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) 642 case ${SlaveFrequency} in 643 *Y|*y) 644 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 645 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then 646 if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then 647 eval ${post_freq}=true ; POST=true 648 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) 649 fi 650 fi;; 651 *M|*m) 652 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 653 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ; then 654 if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} )) -ne 0 ] ; then 655 eval ${post_freq}=true ; POST=true 656 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) 657 fi 658 fi;; 659 *D|*d) 660 IGCM_debug_Print 3 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 661 IGCM_debug_Print 3 "${flag_post} frequency : ${MasterFrequency} " ;; 662 esac ;; 663 *D|*d) 664 PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) 665 case ${SlaveFrequency} in 666 *Y|*y) 667 IGCM_debug_Print 3 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 668 IGCM_debug_Print 3 "${flag_post} frequency : ${MasterFrequency} " ;; 669 *M|*m) 670 IGCM_debug_Print 3 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 671 IGCM_debug_Print 3 "${flag_post} frequency : ${MasterFrequency} " ;; 672 *D|*d) 673 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 674 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ; then 675 if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then 676 eval ${post_freq}=true ; POST=true 677 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) 678 fi 679 fi;; 680 esac ;; 681 NONE|none) 682 ;; 683 *) 684 IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card" 685 ;; 686 esac 687 688 IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency" 689 }
Note: See TracChangeset
for help on using the changeset viewer.