Changeset 890


Ignore:
Timestamp:
07/08/13 17:56:38 (11 years ago)
Author:
sdipsl
Message:
  • introduce IGCM_config_DateCoherency function see #79
  • start cleaning IGCM_config_PeriodStart
  • rename IGCM_config_Analyse_PeriodLength by IGCM_config_DaysInPeriodLength
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r873 r890  
    353353 
    354354#=================================== 
    355 function IGCM_config_Analyse_PeriodLength 
     355function IGCM_config_DaysInPeriodLength 
    356356{ 
    357   IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength" 
     357  IGCM_debug_PushStack "IGCM_config_DaysInPeriodLength" 
    358358 
    359359  typeset i 
     
    393393    IGCM_debug_Print 2 "Number of days for PeriodLength : ${PeriodLengthInDays}";; 
    394394  *) 
    395     IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." 
     395    IGCM_debug_Exit "IGCM_config_DaysInPeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." 
    396396    IGCM_debug_Verif_Exit ;; 
    397397  esac 
    398398 
    399   IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength" 
     399  IGCM_debug_PopStack "IGCM_config_DaysInPeriodLength" 
    400400} 
     401 
     402#=================================== 
     403function IGCM_config_DateCoherency 
     404 
     405  IGCM_debug_PushStack "IGCM_config_DateCoherency" 
     406 
     407  # If one of the following modulo is not zero : 
     408  # we will issue an error then explain and exit in 
     409  # AA_job IGCM_debug_Verif_Exit call before binary submission 
     410 
     411  echo 
     412  IGCM_debug_Print 1 "IGCM_config_DateCoherency" 
     413  echo 
     414 
     415  typeset Length VerifiedPeriodDateBegin VerifiedPeriodDateEnd 
     416 
     417  # check coherency between (PeriodDateBegin, PeriodDateEnd) and (DateBegin, CumulPeriod, PeriodLength) 
     418  # DateBegin + CumulPeriod*PeriodLength = PeriodDateBegin 
     419  echo 
     420   
     421  case ${config_UserChoices_PeriodLength} in 
     422  *Y|*y) 
     423    Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInYears} ))Y ) 
     424    ;; 
     425  *M|*m) 
     426    Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInMonths} ))M ) 
     427    ;; 
     428  *D|*d) 
     429    Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInDays} ))D ) 
     430    ;; 
     431  esac 
     432  VerifiedPeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Length} ) 
     433 
     434  # PeriodDateBegin + PeriodLength = PeriodDateEnd 
     435  VerifiedPeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${VerifiedPeriodDateEnd} $(( ${PeriodLengthInDays} * -1 )) ) 
     436 
     437  IGCM_debug_PopStack "IGCM_config_DateCoherency" 
     438} 
     439 
    401440 
    402441#=================================== 
     
    456495  fi 
    457496 
    458   #modulo (TimeSeriesFrequency and all Chunck2D) must be zero 
     497  # modulo (TimeSeriesFrequency and all Chunck2D) must be zero 
    459498  NbJob=${#CHUNCK2D_SIZE[@]} 
    460499  i=0 
     
    472511  done 
    473512 
    474   #modulo (TimeSeriesFrequency and all Chunck3D) must be zero 
     513  # modulo (TimeSeriesFrequency and all Chunck3D) must be zero 
    475514  NbJob=${#CHUNCK3D_SIZE[@]} 
    476515  i=0 
     
    488527  done 
    489528 
    490   #check to be sure there is enough space on temporary filesystems to run 
     529  # check to be sure there is enough space on temporary filesystems to run 
    491530  echo 
    492531  IGCM_debug_Print 1 "Check if there is enough space on temporary filesystem" 
     
    510549    #================================================# 
    511550 
    512     IGCM_date_GetYearMonthDay $DateBegin year month day 
    513     IGCM_config_Analyse_PeriodLength 
     551    IGCM_date_GetYearMonthDay ${DateBegin} year month day 
     552    IGCM_config_DaysInPeriodLength 
    514553 
    515554    eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1 
     
    561600 
    562601    LastPeriodDateEnd=$( echo ${run_Configuration_OldPrefix} | sed -e "s/${config_UserChoices_JobName}_//" ) 
    563  
    564     typeset LastDate 
    565     set +A LastDate -- $( echo ${LastPeriodDateEnd} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3/" ) 
    566     LastYearDateEnd=${LastDate[0]} 
    567     LastMonthDateEnd=${LastDate[1]} 
    568     LastDayDateEnd=${LastDate[2]} 
    569602 
    570603    if [ ${Period} = 1 ]; then 
     
    596629    fi 
    597630 
     631    #  
    598632    IGCM_date_GetYearMonthDay $PeriodDateBegin year month day 
    599     IGCM_config_Analyse_PeriodLength 
     633    IGCM_config_DaysInPeriodLength 
    600634 
    601635    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 
    602  
    603   fi 
     636  fi 
     637 
     638  # Save for futur use 
    604639  OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} 
    605640 
     
    11371172  year_m1=$(( year - 1 )) 
    11381173  year_p1=$(( year + 1 )) 
    1139   IGCM_config_Analyse_PeriodLength 
     1174  IGCM_config_DaysInPeriodLength 
    11401175  PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) ) 
    11411176 
Note: See TracChangeset for help on using the changeset viewer.