psxyのSオプション

S 直線
Sa 星形
Sc
SV ベクトル

ベクトルで風の分布を描く

アメダスデータのような地点の風の分布を描く場合には、psxy -SVを使う。
入力データ: amedas0000.txt, amedas0010.txt....

#!/bin/bash

#data discription
#$1:longitude, $2:lattitude, $3:Temperature, $4:rainfall
#$5:wind_direction, $6:wind_speed
#!!!Due to large size of psxy vector windspeed was devided by 5!!!

#gmtdefaults -D > .gmtdefaults
gmtset PAPER_MEDIA A4+
gmtset PAGE_ORIENTATION portrait
gmtset PLOT_DEGREE_FORMAT +D D_FORMAT %.1f
gmtset BASEMAP_TYPE plain

for HOUR in 0 1 2 3 4 5 6 7 8 9 10
do

for MINUTE in 0 10 20 30 40 50
do
JST=`expr $HOUR + 9`
echo $JST JST
JST2=`printf %02d $JST`
HOUR2=`printf %02d $HOUR`
MINUTE2=`printf %02d $MINUTE`
INPUT="amedas${HOUR2}${MINUTE2}.txt"
OUT="newamedas${HOUR2}${MINUTE2}.eps"
PNG="newamedas${HOUR2}${MINUTE2}.png"
RANGE='139/140.9/36/37.2'
PROJ='M20'

#Draw wind barb at amedas location (wind speed was devided by 5)
awk '($6>0.5){print $1,$2,$5+180,$6/5}' $INPUT | \
psxy -R$RANGE -J$PROJ -SV0.02/0.2/0.1 -Gblack -V -P -K > hoge.ps

#Draw circle to amedas location
awk '{print $1,$2}' $INPUT | \
psxy -R$RANGE -J$PROJ -Sc0.2 -V -O -K >> hoge.ps

#draw wind barb legend
psxy -R$RANGE -J$PROJ -SV0.02/0.2/0.1 -Gblack -V -P -O -K <<EOF >> hoge.ps
140.7 36.1 90 1
EOF

#draw wind barb legend value (5m/s)
pstext -R$RANGE -J$PROJ -O -K -V <<EOF >> hoge.ps
140.85 36.1 14 0 1 MC 5m/s
EOF

#draw coastline
pscoast -R$RANGE -J$PROJ -Ba0.4f0.2:."${JST2}${MINUTE2} JST":SWen -W2 -Df -V -O >> hoge.ps 

#rename and convert figure
ps2epsi hoge.ps $OUT
rm hoge.ps
convert -quality 100 $OUT $PNG
echo "$INPUT end"
done
done

psxyのベクトルの長さは、Jオプションの大きさに対応している。
Jオプションで大きな値を設定すれば、ベクトルの長さは短くなるが図のサイズが大きくなってしまう。
対処法として、上の例ではデータを5で割って1/5の長さに変更している。
同様に、凡例も1/5=1m/sの長さを5m/sとして描いている。

最終更新:2012年02月22日 12:44
添付ファイル