2011年6月11日土曜日

mk_prv.sh 気圧、700hPa渦度作成 fromNHM計算結果

以下プログラム
time_step;出力させる時間間隔

#! /bin/tcsh -f

#type yyyymmddhhhh start and end time
: ${start:=199201010000}
: ${end:=199201020000}
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


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 rv image
    cat > ci.gs <<EOF
'reinit'
'open _NHMMRPPFCSVSTD1_${time}.ctl'


'set lon 130 200'
'set lat -25 25'

'd psea/100'
'd skip (Usrf,10,10);Vsrf'


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

'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 Press_wind_t='${time_step}'.pdf'
'!rm Press_wind_t=${time_step}.ps'
'c'

'set lon 130 200'
'set lat -25 25'


'set gxout shaded'
'set display color white'
'c'

*'draw relative vorticity :shade'
'set z 8'
'a=hcurl(Usrf,Vsrf)'

'color -3 3 0.5 -kind blue->white->red'
'd a*10000'
'cbar'
'set gxout contour'
'd a*10000'

'set z 1'
'd psea/100'
'd skip (Usrf,10,10);Vsrf'

'draw title rv700 wind timestep=${time_step}[hour] rv[1e-4]\start ${start}'

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

'!ps2pdf rv700_wind_t=${time_step}.ps rv700_wind_t=${time_step}.pdf'
'!rm rv700_wind_t=${time_step}.ps'


'quit'

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

#### 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 件のコメント:

コメントを投稿