12. 基盤地図情報からgeotiffリサンプル& GMT gridへ
・スクリプト例
rem This sample plot batch file for GMT6 windows.
set srange=141:00:00/142:15:00/42:00:00/43:00:00
set srange2=141:00:00/142:15:00/41:30:00/43:00:00
set proj=M15
set wd_txt=jodc-depth500mesh-tomakomai-s.txt
set wd_tmp1=tempwd1.txt
set wd_tmpgrd1=tempwd1.nc
set wd_tmpgrd2=tempwd2.nc
set lnd_txt=toma_merge.csv
set lnd_tmpgrd1=temp_land1.nc
set lnd_tmpgrd2=temp_land2.nc
set merge_grd=toma_merge1.nc
set pref_boundary=hokkaido_region.gmt
set lake_polygon=shikotsu_lake.gmt
echo "141.6 41.9" > M1.txt
rem preprocessing for JODC 500m mesh water depth data
gawk -f convert_XY_jegg_negative.awk %wd_txt% > %wd_tmp1%
rem calc plot diameter
gawk -f refromat_for_psxy.awk hypo_plot_sample.txt > plot_dat.txt
gmt begin test_plot
gmt set FONT_ANNOT_PRIMARY 10p,Times-Roman,black
gmt set FONT_LABEL Times-Roman,black
gmt set FONT_TITLE 10p,Times-Roman,black
gmt set MAP_SCALE_HEIGHT 10p
gmt basemap -R%srange% -J%proj% -V -Ba10mf05m -LjBL+o0.0c/-2c+c41+w20k+l+f
rem make gmt grid data from land area text dem.
gmt xyz2grd %lnd_txt% -G%lnd_tmpgrd1% -R%srange% -I8s -di-9999 -V
gmt grdclip %lnd_tmpgrd1% -G%lnd_tmpgrd2% -Sb0/NaN -V
rem make gmt grid data from sea area text dem(JEGG 500m mesh)
gmt surface %wd_tmp1% -G%wd_tmpgrd1% -I8s -R%srange% -di-9999 -V
gmt grdclip %wd_tmpgrd1% -G%wd_tmpgrd2% -Sa0/0 -V
rem merge land area grid and sea area grid
gmt grdmath %lnd_tmpgrd2% %wd_tmpgrd2% AND = %merge_grd% -V
gmt makecpt -Cglobe -Z -H -T-2000/2000/20 -V > color.cpt
gmt makecpt -Cseis -Z -H -T0/50/5 -V > eq_depth.cpt
gmt grdimage %merge_grd% -J%proj% -R%srange% -Ccolor.cpt -V
rem plot prefecture boundary
gmt plot %pref_boundary% -W0.1p -V
rem plot shikotsu lake
gmt plot %lake_polygon% -G135/206/250 -W0.1p -V
rem plot hypocenter
gmt plot plot_dat.txt -Sc -Ceq_depth.cpt -W0.1p -V
rem plot color bar
gmt colorbar -Ccolor.cpt -DJBC+o3.5c/5.5c+w7c/0.3c -I0.2 -By+lm -Bxaf+l"Height from MSL." -V
gmt colorbar -Ceq_depth.cpt -DJBC+o3.5c/3.5c+w7c/0.3c -By+lkm -Bxaf+l"Depth(km)" -V
rem legend
rem M1 circle 0.04*(1.0+2.0)**1.2 = 0.149
rem M2 circle 0.04*(2.0+2.0)**1.2 = 0.211
rem M3 circle 0.04*(3.0+2.0)**1.2 = 0.276
rem M4 circle 0.04*(4.0+2.0)**1.2 = 0.343
echo N 4 > legend.txt
echo V 0 1p >> legend.txt
echo S 0.25c c 0.0785c red 0.25p 0.75c M 1 >> legend.txt
echo S 0.25c c 0.1109c red 0.25p 0.75c M 2 >> legend.txt
echo S 0.25c c 0.1445c red 0.25p 0.75c M 3 >> legend.txt
echo S 0.25c c 0.1804c red 0.25p 0.75c M 4 >> legend.txt
gmt legend -DJBC+o3.5c/1.5c+w7c/1.0c -F+pwhite+gwhite legend.txt
gmt end show