2012年7月3日火曜日

気圧の書き出し mk_i_p.sh


#! /bin/tcsh -f

#type yyyymmddhhhh start and end time
: ${start:=200103131200}
: ${end:=200103280000}
#: ${end:=200001051200}
year=`echo ${start} | cut -c 1-4`
month=`echo ${start} | cut -c 5-6`
day=`echo ${start} | cut -c 7-8`
hour=`echo ${start} |cut -c 9-10`
h=00

echo start time ${year} ${month} ${day} ${hour} ${h}
echo end   time ${end}

: ${time:=${start}}
: ${start:=${start}}
: ${time_step=0}
timestep=12 #timestep of output file

title1=large
folder=result_press_12hby
mkdir ${folder}


cp ~/tool/color.gs .


i=0
while [ ${time} -le ${end} ]
do
time_step=`expr ${timestep} \* ${i}`
echo time_step ${time_step}

##decide m
if [ ${month} -eq 01 ]; then
    m=JAN
elif  [ ${month} -eq 02 ]; then
    m=FEB
elif  [ ${month} -eq 03 ]; then
    m=MAR
elif  [ ${month} -eq 04 ]; then
    m=APR
elif  [ ${month} -eq 05 ]; then
    m=MAY
elif  [ ${month} -eq 06 ]; then
    m=JUN
elif  [ ${month} -eq 07 ]; then
    m=JUL
elif  [ ${month} -eq 08 ]; then
    m=AUG
elif  [ ${month} -eq 09 ]; then
    m=SEP
elif  [ ${month} -eq 10 ]; then
    m=OCT
elif  [ ${month} -eq 11 ]; then
    m=NOV
elif  [ ${month} -eq 12 ]; then
    m=DEM
fi
#tim=${hour}z${day}${m}${year}
echo tim $tim
#make press wind, rv700, rvsrf image
    cat > ci.gs <<EOF 
'reinit'
'open _NHMMRPPFCSVSTD1_${time}.ctl'


'set lon -50 50'
'set lat -30 30'
'set mproj off'

*'set gxout shaded'
'set ccolor 4'
'd psea'
*'color '
*'cbarn'
'd skip (Usrf,10,10);Vsrf' 


'draw title ${title1} Press wind timestep=${time_step}[hour]'

'enable print t=${time_step}.gmf'
'print'
'disable print'
'!gxps -c -i t=${time_step}.gmf -o Press_wind_t=${time_step}.ps'
'!rm t='${time_step}'.gmf'

'!ps2pdf Press_wind_t=${time_step}.ps aPress_wind_t='${time_step}'.pdf'
'!rm Press_wind_t=${time_step}.ps'
'c'

'quit'

#157
EOF
    grads -blc ci.gs
#echo "yoshiyoshi"
i=`expr $i + 1`
#echo $i

############################################################
############################################################
cd ${folder}
cp ../aPress_wind_t=${time_step}.pdf .
cd ..
rm aPress_wind_t=${time_step}.pdf
############################################################
############################################################

#### next time step
#hour=`expr $hour + 1`
hour=`expr $hour + $timestep`
hour=`echo ${hour} | awk '{printf("%02d",$1)}'`


if [ $hour -eq 24 ]; then
    hour=00
#    day=`expr $day + 1`
        day=`echo ${day} | awk '{printf("%02d",$1+1)}'`
    
    if [ $day -ge 32 ];then
        day=01
#        month=`expr $month + 1`
        month=`echo ${month} | awk '{printf("%02d",$1+1)}'`
    
        if [ $month -ge 13 ];then
            month=01
            year=`expr $year + 1`

        fi    
    fi    
fi

time=${year}${month}${day}${hour}${h}

done

0 件のコメント:

コメントを投稿