Commit 682c4f31 authored by saeed's avatar saeed
Browse files

modified

parent 821ccc7d
......@@ -44,6 +44,15 @@ function output_name(){
echo ${fout}
}
function output_name_cycle(){
fin=${1}
cycle=${2}
fout=${fin/".txt"/}
fout_cycle=${fout}"_cycle""${cycle}"".txt"
echo ${fout_cycle}
}
function ismonthly(){
result=0
......@@ -79,11 +88,12 @@ function do_filter(){
}
do_era5=1
do_precise=1
use_report_file=1
do_precise=0
use_report_file=0
PRECISE_ODB_DIR="/scratch/ms/se/smdk/scratchdir/"
OUTPUT_DIR="/home/ms/se/smdk/odb_panel/OUTPUT"
path_cycle="/home/ms/se/smdk/odb_panel/bin/"
list_report=[]
if [ ${use_report_file} -eq 1 ];then
......@@ -96,7 +106,7 @@ else
list_report=(16001 16005)
fi
startdate="2017-01-01"
enddate="2017-01-05"
enddate="2017-01-02"
time_cycle="00,12"
checkmonthly=`ismonthly ${startdate} ${enddate}`
......@@ -127,18 +137,35 @@ echo ${startdate_out}
echo ${enddate_out}
if [ ${do_era5} -eq 1 ];then
for j in ${!list_report[*]};do
vr=${list_report[j]}
fin="odb_era5_${vr}_${startdate_out}_${enddate_out}.odb"
fout=`output_name ${fin}`
if [ ! -f ${OUTPUT_DIR}/${fout} ];then
lexist=1
nc=`echo ${time_cycle} | awk -F',' '{print NF}'`
for nf in `seq 1 ${nc}`;do
vb=`echo ${time_cycle} | cut -d, -f${nf}`
fout_cycle=`output_name_cycle ${fout} ${vb}`
if [ ! -f ${OUTPUT_DIR}/${fout_cycle} ];then
lexist=0
fi
done
if [ ${lexist} -eq 0 ];then
echo "we are extracting odb for repportype ${vr}"
sed -e "s/<reptype>/${vr}/g" -e "s/<time_cycle>/${time_cycle_out}/g" -e "s/<startdate_out>/${startdate_out}/g" -e "s/<enddate_out>/${enddate_out}/g" -e "s/<startdate>/${startdate}/g" -e "s/<enddate>/${enddate}/g" request_odb_temp_era5 > request_odb_temp
mars request_odb_temp
do_filter ${fin}
rm -f ${fin} 2>/dev/null
mv ${fout} ${OUTPUT_DIR} 2>/dev/null
nc=`echo ${time_cycle} | awk -F',' '{print NF}'`
for nf in `seq 1 ${nc}`;do
vb=`echo ${time_cycle} | cut -d, -f${nf}`
${path_cycle}/era5_cycle.exe ${fout} ${vb}
fout_cycle=`output_name_cycle ${fout} ${vb}`
echo "fout_cycle ${fout_cycle}"
mv ${fout_cycle} ${OUTPUT_DIR} 2>/dev/null
done
rm -f ${fout}
rm -f request_odb_temp 2>/dev/null
else
echo "${OUTPUT_DIR}/${fout} already exists"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment