[385] | 1 | #!/bin/ksh |
---|
[271] | 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sebastien Denvil |
---|
[396] | 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 |
---|
[271] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
[712] | 14 | #D- Task type (computing or post-processing) |
---|
| 15 | TaskType=post-processing |
---|
| 16 | |
---|
[387] | 17 | # Check that everything went well during seasonal average production |
---|
[271] | 18 | # Display a short report |
---|
| 19 | # Launch what's missing |
---|
[338] | 20 | # For use during a run (not on the end : PeriodState=Completed), it will complete |
---|
| 21 | # all TS to last PeriodDateEnd value, give by run.card->Configuration->OldPrefix string. |
---|
[271] | 22 | |
---|
[554] | 23 | #D- Path to libIGCM |
---|
| 24 | #D- Default : value from AA_job if any |
---|
| 25 | # WARNING For StandAlone use : To run this script on some machine (ulam and cesium) |
---|
| 26 | # WARNING you must check MirrorlibIGCM variable in sys library. |
---|
| 27 | # WARNING If this variable is true, you must use libIGCM_POST path instead |
---|
| 28 | # WARNING of your running libIGCM directory. |
---|
[271] | 29 | libIGCM=${libIGCM:=::modipsl::/libIGCM} |
---|
| 30 | |
---|
[344] | 31 | # Expericence class of the run |
---|
| 32 | ExperimentName=${ExperimentName:=historical} |
---|
| 33 | |
---|
| 34 | # Name of this job |
---|
[362] | 35 | JobName=${JobName:=v2.historical1} |
---|
[271] | 36 | |
---|
[338] | 37 | # répertoire courrant |
---|
[271] | 38 | CURRENT_DIR=$( pwd ) |
---|
| 39 | |
---|
[338] | 40 | # Emplacement des cartes |
---|
[344] | 41 | CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}} |
---|
[271] | 42 | |
---|
[344] | 43 | # répertoire de stockage des sorties des create_ts |
---|
[338] | 44 | POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript} |
---|
| 45 | |
---|
[271] | 46 | if [ ! -d ${CARD_DIR} ]; then |
---|
[785] | 47 | echo "No ${CARD_DIR}, we stop here" |
---|
| 48 | exit |
---|
[271] | 49 | fi |
---|
| 50 | |
---|
| 51 | ######################################################################## |
---|
| 52 | |
---|
[731] | 53 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 54 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
| 55 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
| 56 | #------- |
---|
| 57 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 58 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
[832] | 59 | #------- |
---|
| 60 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
| 61 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
| 62 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
[271] | 63 | |
---|
| 64 | ######################################################################## |
---|
| 65 | |
---|
[362] | 66 | #set -vx |
---|
| 67 | |
---|
[616] | 68 | #================================== |
---|
[271] | 69 | # First of all |
---|
[616] | 70 | # |
---|
[727] | 71 | # Read libIGCM compatibility version in config.card |
---|
| 72 | # Read UserChoices section |
---|
| 73 | # Read Ensemble section |
---|
| 74 | # Read Post section |
---|
| 75 | # Define all netcdf output directories |
---|
[616] | 76 | #================================== |
---|
[727] | 77 | IGCM_config_CommonConfiguration ${CARD_DIR}/config.card |
---|
[271] | 78 | |
---|
[616] | 79 | #================================== |
---|
[727] | 80 | # Read ListOfComponents section: |
---|
| 81 | IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents |
---|
[658] | 82 | |
---|
| 83 | #================================== |
---|
[727] | 84 | # Read SeasonalFrequency: |
---|
| 85 | IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency |
---|
[338] | 86 | |
---|
[616] | 87 | # |
---|
[385] | 88 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
[362] | 89 | DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) |
---|
[338] | 90 | |
---|
[362] | 91 | IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin |
---|
[338] | 92 | IGCM_date_GetYearMonth ${DateEnd} YearEnd MonthEnd |
---|
[362] | 93 | |
---|
[385] | 94 | IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin} |
---|
| 95 | IGCM_debug_Print 1 "DateEnd for SE_Checker : "${DateEnd} |
---|
[362] | 96 | echo |
---|
[385] | 97 | # |
---|
| 98 | [ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit |
---|
[271] | 99 | |
---|
[385] | 100 | freq=$( echo ${config_Post_SeasonalFrequency} | sed -e "s/[yY]//" ) |
---|
[271] | 101 | |
---|
[385] | 102 | an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) ) |
---|
| 103 | an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) ) |
---|
| 104 | an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) ) |
---|
| 105 | |
---|
| 106 | # |
---|
| 107 | while [ ${an_fin} -le ${an_fin_all} ] ; do |
---|
| 108 | |
---|
[785] | 109 | countTotal=0 |
---|
| 110 | countGood=0 |
---|
| 111 | countBad=0 |
---|
[385] | 112 | |
---|
[785] | 113 | IGCM_debug_Print 1 " DateBegin/End for SE : ${an_deb}_${an_fin} " |
---|
[271] | 114 | |
---|
[785] | 115 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 116 | localcountBad=0 |
---|
| 117 | # Debug Print |
---|
| 118 | IGCM_debug_Print 1 ${comp} |
---|
| 119 | # Define component |
---|
| 120 | IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} |
---|
| 121 | eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 |
---|
| 122 | |
---|
| 123 | # Read libIGCM compatibility version in ${compname}.card |
---|
| 124 | card=${CARD_DIR}/COMP/${compname}.card |
---|
| 125 | |
---|
| 126 | # Read and Build Output File stuff |
---|
| 127 | #IGCM_debug_Print 1 "DefineArrayFromOption : ${compname}_OutputFiles ${card}" |
---|
| 128 | IGCM_card_DefineArrayFromOption ${card} OutputFiles List |
---|
| 129 | ListFilesName=${compname}_OutputFiles_List |
---|
| 130 | eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 |
---|
| 131 | # |
---|
| 132 | if [ X${FileName0} != X${NULL_STR} ] ; then |
---|
| 133 | # |
---|
| 134 | # INITIALISATION |
---|
| 135 | # |
---|
| 136 | eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 |
---|
| 137 | typeset i=2 |
---|
| 138 | # |
---|
| 139 | until [ $i -gt $NbFiles ]; do |
---|
| 140 | # |
---|
| 141 | eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1 |
---|
| 142 | # |
---|
| 143 | if [ X${flag_post} != XNONE ] ; then |
---|
| 144 | # |
---|
| 145 | # Check if seasonal is required for this file |
---|
| 146 | # |
---|
| 147 | IGCM_card_DefineArrayFromSection ${card} ${flag_post} |
---|
| 148 | # |
---|
| 149 | # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default |
---|
| 150 | # |
---|
| 151 | # variable option allready typeset above |
---|
| 152 | for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do |
---|
| 153 | if [ ${option} = Seasonal ] ; then |
---|
| 154 | FoundSeasonal=true |
---|
| 155 | IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal |
---|
| 156 | fi |
---|
| 157 | done |
---|
| 158 | # |
---|
| 159 | if [ ! X${FoundSeasonal} = Xtrue ] ; then |
---|
| 160 | eval ${compname}_${flag_post}_Seasonal=ON |
---|
| 161 | fi |
---|
| 162 | # |
---|
| 163 | if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then |
---|
| 164 | (( i=i+3 )) |
---|
| 165 | continue |
---|
| 166 | fi |
---|
| 167 | # |
---|
| 168 | # CREATE LIST |
---|
| 169 | # |
---|
| 170 | FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' ) |
---|
| 171 | # |
---|
| 172 | DIRECTORY=${R_SAVE}/${comp}/Analyse/SE |
---|
| 173 | # |
---|
| 174 | TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc |
---|
| 175 | # |
---|
| 176 | (( countTotal = countTotal + 1 )) |
---|
| 177 | IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1 |
---|
| 178 | if [ ! $? = 0 ] ; then |
---|
| 179 | eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile} |
---|
| 180 | (( countBad = countBad + 1 )) |
---|
| 181 | (( localcountBad = localcountBad + 1 )) |
---|
| 182 | else |
---|
| 183 | (( countGood = countGood + 1 )) |
---|
| 184 | fi |
---|
| 185 | fi |
---|
| 186 | (( i=i+3 )) # to explore file list |
---|
| 187 | done # until [ $i -eq $NbFiles ] |
---|
| 188 | fi # [ X${FileName0} != X${NULL_STR} ] |
---|
| 189 | |
---|
| 190 | [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} ) |
---|
| 191 | done |
---|
| 192 | |
---|
| 193 | # create_se submit if files don't exist |
---|
| 194 | if [ $countGood != $countTotal ] ; then |
---|
| 195 | IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}" |
---|
| 196 | |
---|
| 197 | listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG" |
---|
| 198 | export libIGCM=${libIGCM} |
---|
| 199 | export SUBMIT_DIR=${CARD_DIR} |
---|
| 200 | export POST_DIR=${POST_DIR} |
---|
| 201 | export DateBegin=${an_deb} |
---|
| 202 | export PeriodDateEnd=${an_fin}1231 |
---|
| 203 | export RebuildFrequency=${RebuildFrequency} |
---|
| 204 | export RESOL_ATM=${RESOL_ATM} |
---|
| 205 | export RESOL_SRF=${RESOL_SRF} |
---|
| 206 | export RESOL_SBG=${RESOL_SBG} |
---|
| 207 | export RESOL_OCE=${RESOL_OCE} |
---|
| 208 | export RESOL_ICE=${RESOL_ICE} |
---|
| 209 | export RESOL_MBG=${RESOL_MBG} |
---|
| 210 | export listVarEnv=${listVarEnv} |
---|
| 211 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
| 212 | IGCM_debug_Verif_Exit_Post |
---|
| 213 | Script_Post_Output=create_se.${PeriodDateEnd} |
---|
| 214 | IGCM_sys_QsubPost create_se |
---|
| 215 | |
---|
| 216 | echo |
---|
| 217 | fi |
---|
| 218 | |
---|
| 219 | (( an_deb = an_deb + freq )) |
---|
| 220 | (( an_fin = an_fin + freq )) |
---|
| 221 | |
---|
[385] | 222 | done # while |
---|