#! /bin/bash #================================================================ # : source directory of input OLR pentad data yearly files #================================================================ isrc=${CBO}/BLD_OLR/work #------------------------------------------ # : target day (yesterday) # : year of target day # : 10 days before target day #------------------------------------------ cdate=$(date -u) yyyymmdd=$(date -u "+%Y%m%d" --date="-1 days") yyyy=$(echo ${yyyymmdd} | cut -c1-4) yyyymmdd_10=$(date -u "+%Y%m%d" --date="${yyyymmdd} -10 days") #-------------------------------------------- # : base directory of CMAP_PEN project #-------------------------------------------- base=$CMAP_PEN_RT #---------------------------------------------- # : sub-directory of executables # : sub-directory of input data files # : sub-directory of output data files # : sub-directory of log files #---------------------------------------------- prog=${base}/prog input=${base}/input output=${base}/output dlog=${base}/log if [ ! -d ${input} ]; then mkdir -p ${input} fi if [ ! -d ${output} ]; then mkdir -p ${output} fi if [ ! -d ${dlog} ]; then mkdir -p ${dlog} fi #------------------------ # : log file # : old log file #------------------------ ymd=$(date -u "+%Y%m%d" --date="${cdate}") ymd_rm=$(date -u "+%Y%m%d" --date="${cdate} -30 days") log=${dlog}/OPI.log_${ymd} log_rm=${dlog}/OPI.log_${ymd_rm} rm -f ${log_rm} #-------------------------------------------------------------- # set up output data sub-directories #-------------------------------------------------------------- # : sub-directory of OPI 2.5deg pentad data yearly file #-------------------------------------------------------------- d_opi=${output}/OPI/${yyyy} if [ ! -d ${d_opi} ]; then mkdir -p ${d_opi} fi #-------------------------------------------- # : input OLR pentad data yearly file #-------------------------------------------- f_olr=pent.olr.y${yyyy} #--------- # log time #--------- echo "############################ [Start]" >> ${log} date -u >> ${log} echo "----------------------------" >> ${log} echo >> ${log} #------------------------------- # clean up sub-directory #------------------------------- cd ${input} rm -f ${f_olr} #---------------------------------------------------------------------- # copy OLR pentad data yearly file from source to sub-directory #---------------------------------------------------------------------- cd ${input} cp -p ${isrc}/${f_olr} ${input} #------------------------------------------ # update OPI 2.5deg pentad data yearly file #------------------------------------------ cd ${prog} ./OPI_def_pen_2.5deg.x ${yyyymmdd} >> ${log} echo >> ${log} #------------------------------- # clean up sub-directory #------------------------------- cd ${input} rm -f ${f_olr} echo "----------------------------" >> ${log} date -u >> ${log} echo "############################ [Done]" >> ${log} echo >> ${log} exit