Changeset 392 for trunk/libIGCM


Ignore:
Timestamp:
12/03/10 15:10:18 (14 years ago)
Author:
sdipsl
Message:

Step 2/3 toward CompletedFlag? auto-detection, part of ticket #40.
Tests OK. For chunck2D and chunck3D time series.

This should close ticket #42

Location:
trunk/libIGCM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_TimeSeries_Checker

    r390 r392  
    101101IGCM_debug_Print 1 "DateBegin for TimeSeries_Checker : "${DateBegin} 
    102102IGCM_debug_Print 1 "DateEnd   for TimeSeries_Checker : "${DateEnd} 
    103 IGCM_debug_Print 1 "YearBegin MonthBegin for TimeSeries_Checker : ${YearBegin} ${MonthBegin}" 
    104 IGCM_debug_Print 1 "YearEnd   MonthEnd   for TimeSeries_Checker : ${YearEnd} ${MonthEnd}" 
    105103IGCM_debug_Print 1 "CompletedFlag = "${CompletedFlag} 
    106104echo 
     
    262260                                FoundCandidat=false 
    263261                                if [ ! "X${Candidat}" = "X" ] ; then 
    264                                     FoundCandidat=true 
    265                                     for i in ${Candidat} ; do 
    266                                         IGCM_debug_Print 1 -e "\033[1;32m[CompletedFlag CANDIDAT MATCH FOUND]\033[m $( basename ${i} )" 
    267                                         CandidatEnd=$( echo ${i}   | awk -F${config_UserChoices_JobName} '{print $3}' | awk -F_ '{print $3}' ) 
     262                                    for candid in ${Candidat} ; do 
     263                                        #IGCM_debug_Print 1 -e "\033[1;32m[CompletedFlag CANDIDAT MATCH FOUND]\033[m $( basename ${candid} )" 
     264                                        CandidatEnd=$( echo ${candid}   | awk -F${config_UserChoices_JobName} '{print $3}' | awk -F_ '{print $3}' ) 
    268265                                        if [ ${CandidatEnd} -gt ${ChunckFin} ] ; then 
    269                                             IGCM_debug_Print 2 -e "File $( basename ${i} ) should be suppress" 
    270                                             set +A RemoveList ${RemoveList[*]} ${i} 
     266                                            #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress" 
     267                                            set +A RemoveList ${RemoveList[*]} ${candid} 
    271268                                        elif [ ${CandidatEnd} -lt ${ChunckFin} ] ; then 
    272                                             IGCM_debug_Print 2 -e "File $( basename ${i} ) should be suppress or used as a CompletedFlag baseline" 
     269                                            #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress or used as a CompletedFlag baseline" 
    273270                                            # We keep the best candidat and remove the others 
    274                                             if [ ${BestCandidat} -lt ${CandidatEnd} ] ; then  
     271                                            if [ ${BestCandidat} -lt ${CandidatEnd} ] ; then 
    275272                                                BestCandidat=${CandidatEnd} 
     273                                                FoundCandidat=true 
    276274                                            else 
    277                                                 set +A RemoveList ${RemoveList[*]} ${i} 
     275                                                set +A RemoveList ${RemoveList[*]} ${candid} 
    278276                                            fi 
    279277                                        fi 
     
    289287                                    IGCM_debug_Print 3 ${DIRECTORY}/${TestedFile} 
    290288                                    # Then we keep a track of the Best Candidat 
    291                                     [ ${FoundCandidat} = true ] && set +A PotentialCompletedFlag ${PotentialCompletedFlag[*]} ${BestCandidat} 
     289                                    if [ ${FoundCandidat} = true ] ; then 
     290                                        if [ ${chunck} = true ] ; then 
     291                                            set +A PotentialCompletedFlag ${PotentialCompletedFlag[*]} ${BestCandidat} 
     292                                        else 
     293                                            eval set +A PotentialCompletedFlag${Dimension} \${PotentialCompletedFlag${Dimension}[*]} \${BestCandidat} 
     294                                        fi 
     295                                    fi 
    292296                                else 
    293297                                    (( countGood = countGood + 1 )) 
    294                                     # Then we do not need the best candidat 
     298                                    # Then we do not need the best candidat if any 
    295299                                    [ ${FoundCandidat} = true ] && set +A RemoveList ${RemoveList[*]} ${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc 
    296300                                fi 
     
    311315                                #IGCM_sys_Rm ${RemoveList[*]} 
    312316                            fi 
    313  
     317                            #[ ${FoundCandidat} = true ] && IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag[*]}" 
    314318                            if ( [ ${chunck} = true ] && [ ${SuccessRate} -ne 100 ] ) ; then 
    315  
    316319                                # 
    317320                                # TO REWRITE BEGIN 
    318321                                # 
    319                                 ChunckCompletedFlag="" 
    320                                 CompletedFlag=${SavedCompletedFlag} 
    321                                 if [ X${CompletedFlag} != X ] ; then 
    322                                         ( [ ${CompletedFlag} -gt ${ChunckDebut} ] && [ ${CompletedFlag} -le ${ChunckFin} ] ) && ChunckCompletedFlag=${CompletedFlag} 
     322                                NbCandidats=${#PotentialCompletedFlag[@]} 
     323                                countCandid=1 
     324                                if [ ${NbCandidats} -eq 0 ] ; then 
     325                                    ChunckCompletedFlag="" 
     326                                    IGCM_debug_Print 2 -e "\033[1;31mNO CompletedFlag\033[m" 
     327                                elif [ ${NbCandidats} -eq 1 ] ; then 
     328                                    ChunckCompletedFlag=${PotentialCompletedFlag[0]} 
     329                                    IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m" 
     330                                elif [ ${NbCandidats} -gt 1 ] ; then 
     331                                    k=1 
     332                                    until [ $k -ge ${NbCandidats} ]; do 
     333                                        ((k_m1=k-1)) 
     334                                        if [ ${PotentialCompletedFlag[${k_m1}]} = ${PotentialCompletedFlag[${k}]} ] ; then 
     335                                            ((countCandid=countCandid+1)) 
     336                                        fi 
     337                                        ((k=k+1)) 
     338                                    done 
     339                                    if [ ${NbCandidats} -eq ${countCandid} ] ; then 
     340                                        ChunckCompletedFlag=${PotentialCompletedFlag[0]} 
     341                                        IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m" 
     342                                    else 
     343                                        IGCM_debug_Print 2 -e "\033[1;31mToo Many Potential CompletedFlag\033[m CASE NOT HANDLE YET" 
     344                                    fi 
    323345                                fi 
    324346                                # 
    325347                                # TO REWRITE END 
    326348                                # 
    327  
    328  
    329                                 IGCM_debug_Print 2 -e "\033[1;31mSubmit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin}" 
     349                                IGCM_debug_Print 2 -e "\033[1;31mSubmit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}" 
    330350                                listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask,CompToRead,FlagToRead" 
    331351                                export libIGCM=${libIGCM} 
     
    359379                                ChunckFin=${DateEnd} 
    360380                            else 
    361                                 #PeriodDateEnd=$(( YearBegin + YearsChunckLength - 1 )) 
    362381                                ChunckFin=$( IGCM_date_AddDaysToGregorianDate ${ChunckDebut} $(( YearsChunckLength * DaysInYear - 1 )) ) 
    363382                            fi 
     
    385404 
    386405if [ X${Launch2D} = Xtrue ] ; then 
     406    #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag2D[*]}" 
    387407    IGCM_debug_Print 2 -e "\033[1;31mSubmit 2D\033[m without chunck period ${DateBegin}-${DateEnd}" 
    388408    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask" 
     
    403423 
    404424if [ X${Launch3D} = Xtrue ] ; then 
     425    #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag3D[*]}" 
    405426    IGCM_debug_Print 2 -e "\033[1;31mSubmit 3D\033[m without chunck period ${DateBegin}-${DateEnd}" 
    406427    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask" 
  • trunk/libIGCM/AA_create_ts

    r389 r392  
    269269# Determine component to take care of depending on kind of task create_ts will perform 
    270270# 
    271 ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents 
     271[ ${CompToRead} ] && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents 
    272272# 
    273273# Determine period for time series. Default : value from AA_job or from launch_TS if any 
     
    324324        # 
    325325        typeset i 
    326         if ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) ; then 
     326        if [ ${FlagToRead} ] ; then 
    327327            ((NbFiles=${FlagToRead})) 
    328328            ((i=${NbFiles})) 
Note: See TracChangeset for help on using the changeset viewer.