用到中文社區(qū)的兩個(gè)例子拼合起來(lái)的,用到awk
#!/bin/bash
PS=map.ps
R=g
# 假定臺(tái)站位于 105/30 處
stlo=120.19
stla=30.26
max_distance=90
width=10c # 圖片寬度
# 使用-JE投影,其后面的四個(gè)參數(shù)分別是:
# 中心經(jīng)度/中心緯度/最大震中距/圖片寬度
J=E$stlo/$stla/$max_distance/$width
eqfile=zuobiao.txt
# 繪制底圖
gmt pscoast -J$J -R$R -A10000 -Ggrey -K > $PS
# 利用 psbasemap 繪制圖中的徑向線
gmt set FORMAT_GEO_MAP=+D
gmt psbasemap -R0/360/0/90 -JPa$width -Bxa60g60 -Bya180 -K -O >> $PS
# 繪制臺(tái)站位置(紅色三角形)
echo $stlo $stla | gmt psxy -J$J -R$R -St0.15i -Gred -K -O >> $PS
# 繪制地震震源位置
awk '$3>=5.0 && $3<5.5 {print $1,$2,$3*0.04}' $eqfile | gmt psxy -R -J -Sc0.1i -Gblue -O -K >> $PS
M55=`awk '$3>=5.0 && $3<5.5' $eqfile | wc -l | cut -d" " -f1`
awk '$3>=5.5 && $3<6.0 {print $1,$2,$3*0.04}' $eqfile | gmt psxy -R -J -Sc0.13i -Gyellow -K -O >> $PS
M6=`awk '$3>=5.5 && $3<6.0' $eqfile | wc -l | cut -d" " -f1`
awk '$3>=6.0 && $3<6.5 {print $1,$2,$3*0.04}' $eqfile | gmt psxy -R -J -Sc0.16i -Gred -K -O >> $PS
M65=`awk '$3>=6.0 && $3<6.5' $eqfile | wc -l | cut -d" " -f1`
awk '$3>=6.5 && $3<7.0 {print $1,$2,$3*0.04}' $eqfile | gmt psxy -R -J -Sc0.19i -Ggreen -O -K >> $PS
M7=`awk '$3>=6.5 && $3<7.0' $eqfile | wc -l | cut -d" " -f1`
awk '$3>=7.0 && $3<7.5 {print $1,$2,$3*0.04}' $eqfile | gmt psxy -R -J -Sc0.22i -Gpurple -O -K >> $PS
M75=`awk '$3>=7.0 && $3<7.5' $eqfile | wc -l | cut -d" " -f1`
awk '$3>=7.5 && $3<8.0 {print $1,$2,$3*0.04}' $eqfile | gmt psxy -R -J -Sc0.22i -Gred4 -O -K >> $PS
M8=`awk '$3>=7.5 && $3<8.0' $eqfile | wc -l | cut -d" " -f1`
awk '$3>=8.0 {print $1,$2,$3*0.06}' $eqfile | gmt psxy -R -J -Sc0.24i -Gpurple -W0.4p,black -O -K >> $PS
M8a=`awk '$3>=8.0' $eqfile | wc -l | cut -d" " -f1`
# 繪制30和60度等震中距線
echo $stlo $stla 6672 | gmt psxy -J$J -R$R -SE- -K -O -W1p,red >> $PS
echo $stlo $stla 13344 | gmt psxy -J$J -R$R -SE- -K -O -W1p,red >> $PS
# 在30, 60, 90處添加文字
# !!! 輸入文件的第二列0, -30, -60 需要根據(jù)臺(tái)站的實(shí)際緯度進(jìn)行微調(diào) !!!
gmt pstext -J$J -R$R -D0c/0.3c -K -O >> $PS << EOF
$stlo 0 30\232
$stlo -30 60\232
$stlo -60 90\232
EOF
#-DjBL+w4c+o0.2c/0.2c
#gmt pslegend -R -J -DjBR+w1.2i+l1.0+o0 -F+g200+p0.25p -O -K >> $PS <<EOF
gmt pslegend -R$R -J$J -DjBL+w2.9c+o4.4c/0c -F+g200+p0.05p -O -K >> $PS <<EOF
G 0.01i
#S 0.1i c 0.15i 0.25p 0.3i This circle is hachured
H 8 4 MAGNITUDE
C blue
S 0.1i c 0.20 blue 0.25p,blue 0.18i 5~5.4($M55)
C yellow
S 0.1i c 0.22 yellow 0.25p,yellow 0.18i 5.5~5.9($M6)
C red
S 0.1i c 0.24 red 0.25p,red 0.18i 6.0~6.4($M65)
C green
S 0.1i c 0.26 green 0.25p,green 0.18i 6.5~6.9($M7)
C purple
S 0.1i c 0.28 purple 0.25p,purple 0.18i 7.0~7.4($M75)
C red4
S 0.1i c 0.30 red4 0.25p,red4 0.18i 7.5~7.9($M8)
C black
S 0.1i c 0.32 black 0.25p,black 0.18i 8.0~($M8a)
EOF
gmt psxy -J$J -R$R -T -O >> $PS
gmt psconvert -A -P -Tg $PS
rm gmt.*
坐標(biāo)如下
177.9976 -16.2713 5.1
171.8204 -22.7929 5.1
171.8533 -22.704 5.1
146.0337 -3.6414 6
171.6489 -22.8781 5.4
101.7894 -5.6329 6
171.7258 -22.7558 5.5
171.524 -22.8727 7.1
171.3831 -22.7931 5.4
171.4122 -22.7235 5.5
171.2249 -22.7056 5.9
171.8566 -22.643 5.3
171.6384 -23.1526 5.1
171.2221 -22.6225 5.9
171.2902 -22.7196 5.1
171.6474 -23.214 5.9
171.591 -23.1122 5.3
170.9936 -22.5744 5
171.6953 -23.1612 5.4
171.7129 -23.1046 5.3
171.1029 -22.6772 5.1
171.4389 -23.1022 5.6
171.9638 -23.18 5.2
171.1874 -22.9285 5.4
171.5996 -23.2079 5.2
171.5409 -23.1397 5.2
171.7471 -23.2399 5.2
73.71 38.05 5
-155.2216 57.2303 5.2
123.3114 -10.2701 5.2
149.3735 -7.2829 5.2
171.6259 -23.2493 5.3
167.5975 -17.6662 6.1
167.8142 -17.6403 5.3
167.7555 -17.7398 5.5
21.95 38.35 5
167.9065 -17.5271 5.1
171.8076 -23.154 5.5
168.02 -18.9 5.9
-176.5142 -15.0003 6.1
-173.8296 -19.5263 5
144.2412 -54.507 5
144.2402 -54.7116 5.2
168.1633 -18.898 5
-179.1942 51.1432 5.1
167.8289 -17.595 5
172.8746 -22.946 5.5
-22.2771 63.9566 5.6
100.0856 -47.2476 5.5