#!/bin/ksh  

MOD=GFS

datai=20200802

datai=20200828
dataf=20210131

mod=00

while [ $datai -le $dataf ] ; do
 
 ctl_gfs=/dados/ioper/tempo/GFS/0p25/brutos/${datai:0:4}/${datai:4:2}/${datai:6:2}/$mod/gfs025gr.pgrb2.${datai}00.ctl
 /home/roberto.rozante/grads-2.0.2.oga.1/Contents/grads -blc "run calc_temp_gfs.gs $ctl_gfs $datai F24 $MOD"

 d_1=`date -d "${datai:0:8} 00:00 24 hours ago " +"%Y%m%d"`
 ctl_gfs=/dados/ioper/tempo/GFS/0p25/brutos/${d_1:0:4}/${d_1:4:2}/${d_1:6:2}/$mod/gfs025gr.pgrb2.${d_1}00.ctl
 /home/roberto.rozante/grads-2.0.2.oga.1/Contents/grads -blc "run calc_temp_gfs.gs $ctl_gfs $datai F48 $MOD"

 datai=`date -d "${datai:0:8} 00:00 24 hours" +"%Y%m%d"`
 exit
done
