Ignore:
Timestamp:
03/11/13 15:13:11 (11 years ago)
Author:
aclsce
Message:

Fixed some bugs (very small bugs).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/PACK_IPSL/find_size_pack.sh

    r1962 r2027  
    5454 
    5555DEM_write_state ${IGCM_DEM}/config_card.liste ${config_card} FindSizePackRunning 
    56  
    5756# Periodicite du pack (20 ans par defaut)  
    5857period_pack=20Y 
     
    119118# taille qu'aurait le pack de {periodpackinyear}ans 
    120119DEM_log -1 "Debut recherche taille de pack" 
    121  
    122120# Recherche des dates du premier pack 
    123121 
     
    136134 
    137135# on ne fait le calcul que pour les dix premiers pack (donc 20 * 10 =  200 ans)  
    138 # cela doit donner un echantillon suffisant  
     136# cela doit donner un echantillon suffisant 
     137date_begin_pack=`echo $date_begin_pack|sed 's/^0*//'`  
     138date_end_simulation=`echo $date_end_simulation|sed 's/^0*//'`  
    139139while [[ ${date_begin_pack} -le ${date_end_simulation}  && ${number_pack} -le 10 ]] 
    140140do  
    141141     
    142142    month_end_pack=${month_begin_pack} 
    143     year_end_pack=$(( ${year_begin_pack} + ${periodpackinyear} )) 
    144      
     143    year_end_pack=$(( 10#${year_begin_pack} + ${periodpackinyear} )) 
    145144    date_end_pack=${year_end_pack}${month_end_pack}01  
    146145 
     
    202201new_period=999999 
    203202newpackinyear=0 
    204  
    205 for type_file in `awk '{print $0}' ${IGCM_DEM_SIMU}/info_name_file.txt` 
    206 do  
    207     nb_line=$(cat ${IGCM_TMP}/${$}.size_pack_${type_file}.txt | wc -l ) 
    208     if [ ${nb_line} -gt 1 ]  
    209     then  
    210         for taille in `head -n -1  ${IGCM_TMP}/${$}.size_pack_${type_file}.txt` 
    211         do  
    212             [[ ${taille} -lt ${size_pack_min} ]] && period_tmp=$(( ${size_pack_min} * ${periodpackinyear} / ${taille} )) 
    213             [[ ${taille} -gt ${size_pack_max} ]] && period_tmp=$(( ${size_pack_min} * ${periodpackinyear} / ${taille} )) 
    214             [[ ${taille} -ge ${size_pack_min} && ${taille} -le ${size_pack_max} ]] && period_tmp=${periodpackinyear} 
    215             [[ ${period_tmp} -lt ${new_period} ]] && new_period=${period_tmp} 
    216         done 
    217     else 
     203if [[ -f ${IGCM_TMP}/${$}.size_pack_${type_file}.txt ]]; then  
     204    for type_file in `awk '{print $0}' ${IGCM_DEM_SIMU}/info_name_file.txt` 
     205    do 
     206        nb_line=$(cat ${IGCM_TMP}/${$}.size_pack_${type_file}.txt | wc -l ) 
     207        if [ ${nb_line} -gt 1 ]  
     208        then  
     209            for taille in `head -n -1  ${IGCM_TMP}/${$}.size_pack_${type_file}.txt` 
     210            do  
     211                [[ ${taille} -lt ${size_pack_min} ]] && period_tmp=$(( ${size_pack_min} * ${periodpackinyear} / ${taille} )) 
     212                [[ ${taille} -gt ${size_pack_max} ]] && period_tmp=$(( ${size_pack_min} * ${periodpackinyear} / ${taille} )) 
     213                [[ ${taille} -ge ${size_pack_min} && ${taille} -le ${size_pack_max} ]] && period_tmp=${periodpackinyear} 
     214                [[ ${period_tmp} -lt ${new_period} ]] && new_period=${period_tmp} 
     215            done 
     216        else 
    218217        # Dans ce cas la il n'y avait pas assez de fichiers pour remplir une periode complete # 
    219218        # il faut donc commencer par calculer la taille du pack que l'on a fait # 
    220         newpackinyear=$((    ${year_end}  - ${year_begin}        )) 
    221         newpackinyear=$(( $newpackinyear + 1 )) 
    222         [[ ${newpackinyear} -lt 1 ]] && newpackinyear=1 
    223          
    224         for taille in `head  ${IGCM_TMP}/${$}.size_pack_${type_file}.txt` 
    225         do  
    226             [[ ${taille} -lt ${size_pack_min} ]] && period_tmp=${newpackinyear} 
    227             [[ ${taille} -gt ${size_pack_max} ]] && period_tmp=$(( ${size_pack_min} * ${newpackinyear} / ${taille} )) 
    228             [[ ${taille} -ge ${size_pack_min} && ${taille} -le ${size_pack_max} ]] && period_tmp=${newpackinyear} 
    229             [[ ${period_tmp} -lt ${new_period} ]] && new_period=${period_tmp} 
    230         done 
    231          
    232     fi  
    233 done 
    234  
     219            newpackinyear=$((    ${year_end}  - ${year_begin}        )) 
     220            newpackinyear=$(( $newpackinyear + 1 )) 
     221            [[ ${newpackinyear} -lt 1 ]] && newpackinyear=1 
     222            for taille in `head  ${IGCM_TMP}/${$}.size_pack_${type_file}.txt` 
     223            do  
     224                [[ ${taille} -lt ${size_pack_min} ]] && period_tmp=${newpackinyear} 
     225                [[ ${taille} -gt ${size_pack_max} ]] && period_tmp=$(( ${size_pack_min} * ${newpackinyear} / ${taille} )) 
     226                [[ ${taille} -ge ${size_pack_min} && ${taille} -le ${size_pack_max} ]] && period_tmp=${newpackinyear} 
     227                [[ ${period_tmp} -lt ${new_period} ]] && new_period=${period_tmp} 
     228            done 
     229        fi  
     230    done 
     231fi 
    235232DEM_log -1 "taille=${taille}" 
    236233DEM_log -1 "new_period=${new_period}" 
Note: See TracChangeset for help on using the changeset viewer.