04_2 Monthly seismic plotting(GMT5)/月別震源分布図のスクリプト(GMT5)
ここでは1年間の地震発生データを月別にプロットするというスクリプトを紹介します。
gawkの条件判断で月別にデータを吐き出し、それをプロットしています。
きちんと精査してないので、使ってない変数もあるかもしれませんが、ご容赦ください。
末尾に圧縮ファイルでスクリプトとデータを置いてありますので参考にしてください。
rem ----------------------------------------------
rem monthly seismic coded by Y.M.
REM
REM http://earthquake.usgs.gov/earthquakes/search/
REM にてダウンロードした1年間の地震データを月別にプロットするスクリプト
rem ----------------------------------------------
set path=%PATH%;c:\programs\gawk\bin
rem gmtset HEADER_FONT_SIZE = 8p
gmtset -Ds
set cpo=GMT_globe.cpt
set cpt=depth.cpt
rem set grddata=..\..\..\01_GEBCO\30arcsec\gebco_08\gebco_08.nc
set out2014=out2014.dat
set grad=grad.grd
set seisdat=2014data.prn
set outseis=seisout.dat
set testseis=testseis.dat
set waku=120/150/20/50
set outfile=seis2014monthlyGMT5.eps
set bp=a20f10g0
set r=0.15
set bp1=a20f10g0:"longitude":/a20f10g0:"latitude"::." ":WSne
set title01=january
set title12=December
gawk "{if($2==1) {print $5,$4,$6,$7} }" %seisdat% > out01.dat
gawk "{if($2==2) {print $5,$4,$6,$7} }" %seisdat% > out02.dat
gawk "{if($2==3) {print $5,$4,$6,$7} }" %seisdat% > out03.dat
gawk "{if($2==4) {print $5,$4,$6,$7} }" %seisdat% > out04.dat
gawk "{if($2==5) {print $5,$4,$6,$7} }" %seisdat% > out05.dat
gawk "{if($2==6) {print $5,$4,$6,$7} }" %seisdat% > out06.dat
gawk "{if($2==7) {print $5,$4,$6,$7} }" %seisdat% > out07.dat
gawk "{if($2==8) {print $5,$4,$6,$7} }" %seisdat% > out08.dat
gawk "{if($2==9) {print $5,$4,$6,$7} }" %seisdat% > out09.dat
gawk "{if($2==10) {print $5,$4,$6,$7} }" %seisdat% > out10.dat
gawk "{if($2==11) {print $5,$4,$6,$7} }" %seisdat% > out11.dat
gawk "{if($2==12) {print $5,$4,$6,$7} }" %seisdat% > out12.dat
makecpt -Crainbow -T0/700/20 -I > %cpt%
rem -Y23 :A4版左上隅にjanuaryを描画
gmt psbasemap -Jm%r% -R%waku% -Y23 -B%bp1% -P -K > %outfile%
gawk "{print $1 , $2 , $3 ,$4/36 }" out01.dat | gmt psxy -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Jan. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の右6cmにFebuary
gawk "{print $1 , $2 , $3 ,$4/36 }" out02.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Feb. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の右6cmにMarch
gawk "{print $1 , $2 , $3 ,$4/36 }" out03.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Mar. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の右6cmにApril
gawk "{print $1 , $2 , $3 ,$4/36 }" out04.dat | gmt psxy -Y-7 -X-12 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Apr. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の右6cmにMay
gawk "{print $1 , $2 , $3 ,$4/36 }" out05.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB May | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の左-12cm、下7cmにJune
gawk "{print $1 , $2 , $3 ,$4/36 }" out06.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Jun. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の右6cmにJuly
gawk "{print $1 , $2 , $3 ,$4/36 }" out07.dat | gmt psxy -Y-7 -X-12 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Jul. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の右6cmにAugust
gawk "{print $1 , $2 , $3 ,$4/36 }" out08.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Aug. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem 上図の左-12cm、下7cmにSeptember
gawk "{print $1 , $2 , $3 ,$4/36 }" out09.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Sep. | gmt pstext -R -J -P -O -K -N >> %outfile%
gawk "{print $1 , $2 , $3 ,$4/36 }" out10.dat | gmt psxy -Y-7 -X-12 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Oct. | gmt pstext -R -J -P -O -K -N >> %outfile%
gawk "{print $1 , $2 , $3 ,$4/36 }" out11.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Nov. | gmt pstext -R -J -P -O -K -N >> %outfile%
gawk "{print $1 , $2 , $3 ,$4/36 }" out12.dat | gmt psxy -X6 -J -R -B -C%cpt% -Sc -Wthinnest -V -P -O -K >> %outfile%
gmt pscoast -J -R -Wthinnest -Df -V -P -O -K >> %outfile%
echo 122 51 10 0 15 LB Dec. | gmt pstext -R -J -P -O -K -N >> %outfile%
rem $4/36 マグニチュード9のとき、9/36=0.25cmが直径となる様にしている
echo 90 12 10 0 15 LB Earthquake depth(km) | gmt pstext -R -J -P -O -K -N >> %outfile%
psscale -D2/-1/5/0.2h -Ba200f100g50:Depth(km): -C%cpt% -P -V -O -K >> %outfile%
gmt pslegend legendm.txt -R -J -Dx0.05/5.6/1.6c/2.5c/TL -G255 -O -V -S >> %outfile%