Changeset 1922


Ignore:
Timestamp:
11/15/12 16:00:27 (10 years ago)
Author:
acosce
Message:

Correct several bugs

  • add a test on file to check if it exists or not
  • fixed bug about integer "08" and "09" that appear in simulation before year 1000
Location:
TOOLS/PACK_IPSL
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/PACK_IPSL/archive_debug.sh

    r1913 r1922  
    147147#la date du dernier fichier donnera la date de fin du pack 
    148148   sort ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt > ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp 
     149 
     150   first_file=$(head -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp ) 
     151   extract_date_file=$( echo ${first_file}  | sed -e "s/.*${JobName}_//" ) 
     152   DateBegin_Debug=$(echo ${extract_date_file}| sed 's%\([0-9]\{8\}\)_.*$%\1%g' ) 
     153 
    149154   last_file=$(tail -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp ) 
    150155   extract_date_file=$( echo ${last_file}  | sed -e "s/.*${JobName}_//" ) 
    151156   DateEnd_Debug=$(   echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 
    152    mv ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp ${DEBUG_TAR}/${JobName}_debug_${date_begin_pack}_${DateEnd_Debug}.list 
     157   mv ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp ${DEBUG_TAR}/${JobName}_debug_${DateBegin_Debug}_${DateEnd_Debug}.list 
    153158 
    154159 
  • TOOLS/PACK_IPSL/archive_restart.sh

    r1911 r1922  
    159159#la date du dernier fichier donnera la date de fin du pack 
    160160   sort ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt > ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp 
     161 
     162   first_file=$(head -n 1 ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp ) 
     163   extract_date_file=$( echo ${first_file}  | sed -e "s/.*${JobName}_//" ) 
     164   DateBegin_Restart=$(echo ${extract_date_file}| sed 's%\([0-9]\{8\}\)_.*$%\1%g' ) 
     165 
    161166   last_file=$(tail -n 1 ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp ) 
    162167   extract_date_file=$( echo ${last_file}  | sed -e "s/.*${JobName}_//" ) 
    163168   DateEnd_Restart=$(   echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 
    164    mv ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp ${RESTART_TAR}/${JobName}_restart_${date_begin_pack}_${DateEnd_Restart}.list 
     169   mv ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp ${RESTART_TAR}/${JobName}_restart_${DateBegin_Restart}_${DateEnd_Restart}.list 
    165170 
    166171 
  • TOOLS/PACK_IPSL/write_liste_pack.sh

    r1913 r1922  
    8888    [[ "${clean_tmp}" = "yes" ]] && rm -f ${IGCM_TMP}/${$}.tmp_info_${type_file}.txt.tmp 
    8989done 
    90  
    9190 
    9291# 3- Maintenant pour chaque type de fichier de sortie nous allons creer la liste 
     
    151150 
    152151#On renomme le fichier ncrcat avec la date reelle de fin et non pas la premiere date suivant la fin  
    153        sort ${OUTPUT_NCRCAT}/ncrcat_${type_file}_${date_begin_pack}_${date_end_pack}.list > ${IGCM_TMP}/${$}.ncrcat.tmp 
    154        last_file=$(tail -n 1 ${IGCM_TMP}/${$}.ncrcat.tmp ) 
    155        extract_date_file=$( echo ${last_file}  | sed -e "s/.*${JobName}_//" ) 
    156        date_fin=$(echo ${extract_date_file}| sed 's%.*_\([0-9]\{8\}\)_.*$%\1%g' ) 
    157        mv ${OUTPUT_NCRCAT}/ncrcat_${type_file}_${date_begin_pack}_${date_end_pack}.list ${OUTPUT_NCRCAT}/${JobName}_${date_begin_pack}_${date_fin}_${type_file}.list 
     152#on renomme egalement en fonction de la date reelle de debut pour le cas des annees < 1000 qui perdent leurs zeros en cour de route 
     153       if [[ -f ${OUTPUT_NCRCAT}/ncrcat_${type_file}_${date_begin_pack}_${date_end_pack}.list ]]; then  
     154           sort ${OUTPUT_NCRCAT}/ncrcat_${type_file}_${date_begin_pack}_${date_end_pack}.list > ${IGCM_TMP}/${$}.ncrcat.tmp 
     155 
     156           first_file=$(head -n 1 ${IGCM_TMP}/${$}.ncrcat.tmp ) 
     157           extract_date_file=$( echo ${first_file}  | sed -e "s/.*${JobName}_//" ) 
     158           date_debut=$(echo ${extract_date_file}| sed 's%\([0-9]\{8\}\)_.*$%\1%g' ) 
     159 
     160           last_file=$(tail -n 1 ${IGCM_TMP}/${$}.ncrcat.tmp ) 
     161           extract_date_file=$( echo ${last_file}  | sed -e "s/.*${JobName}_//" ) 
     162           date_fin=$(echo ${extract_date_file}| sed 's%.*_\([0-9]\{8\}\)_.*$%\1%g' ) 
     163           mv ${OUTPUT_NCRCAT}/ncrcat_${type_file}_${date_begin_pack}_${date_end_pack}.list ${OUTPUT_NCRCAT}/${JobName}_${date_debut}_${date_fin}_${type_file}.list 
     164       fi 
    158165   done 
    159     
    160     
     166 
    161167   month_begin_pack=${month_end_pack} 
    162168   year_begin_pack=${year_end_pack} 
     
    243249                        date_debut=$( echo ${extract_date_file} | sed 's%\([0-9]\{8\}\)_.*$%\1%g'     | cut -c 1-6  ) 
    244250                        date_fin=$(   echo ${extract_date_file} | sed 's%.*_\([0-9]\{8\}\)_.*$%\1%g' | cut -c 1-6  ) 
     251                        #on retire les eventuels zero pour eviter de tomber sur des dates de type 08 ou 09  
     252                        date=`echo $date|sed 's/^0*//'` 
     253                        date_debut=`echo $date_debut|sed 's/^0*//'` 
     254                        date_fin=`echo $date_fin|sed 's/^0*//'` 
    245255                        if [[ ${date} -ge ${date_debut} && ${date} -lt ${date_fin} ]]; then 
    246256                            mv ${pack} ${OUTPUT_TAR}/. 
Note: See TracChangeset for help on using the changeset viewer.