2011年7月5日火曜日

JRA25 SST

JRA25 から SST
mk_sst_jra25.sh @yoshi/tool/jra25
#! /bin/tcsh -f

#type yyyymmddhhhh start and end time
: ${start:=199201010000}
: ${end:=199201160000}
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
: ${prefix:=fcst_phy2m25}  
: ${suffix:=gr}

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

: ${time:=${start}}

#timestep
timestep=12
cp ~/tool/color.gs .

i=1
while [ ${time} -le ${end} ]
do

##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=DEC
fi

time=${year}${month}${day}${hour}
tim=${hour}z${day}${m}${year}
echo time $time

##change 3 time
    t=`expr ${day} \* 4 - 3`
    t=`expr ${hour} / 6 + ${t}`


#make press wind rv image
    cat > sst1.gs <<EOF
'reinit'
'open ${prefix}.ctl'

'set t ${t}'

#
'set lon 100 200'
'set lat -25 25'

'set gxout shaded'
'set display color white'
'c'
'color 0 33 3 -kind white->yellow->orange->red'
'd wtmpsfc-273.15'
'cbar'
'set gxout contour'
'd wtmpsfc-273.15'

'q dims'
 temp=sublin(result,5)
 tim=subwrd(temp,6)

'draw title SST[deg C] time='tim''

'enable print t='tim'.gmf'
'print'
'disable print'
'!gxps -c -i t='tim'.gmf -o sst_t='tim'.ps'
'!rm t='tim'.gmf'
'!ps2pdf sst_t='tim'.ps ${i}_sst_t='tim'.pdf'
'!rm sst_t='tim'.ps'

'quit'
EOF
    grads -blc sst1.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 件のコメント:

コメントを投稿