Skip to content

Instantly share code, notes, and snippets.

@komasaru
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/02b4bf225e8834653f1f to your computer and use it in GitHub Desktop.
Save komasaru/02b4bf225e8834653f1f to your computer and use it in GitHub Desktop.
Bash script to paint a map with elevation data.
#! /bin/bash
# 各種定数
GRD_SRC="ETOPO1_Bed_g_gmt4.grd"
F_NAME="JAPAN_ETOPO1"
RANGE=126/149/25/46
SIZE=12c
# 用紙サイズ
gmtset PS_MEDIA = Custom_18cx20c
# 範囲抽出
grdcut $GRD_SRC -R${RANGE} -G${F_NAME}.grd
# 配色設定
makecpt -Crelief -T-8000/8000/100 -Z > ${F_NAME}.cpt
# 図描画
grdimage ${F_NAME}.grd -R${RANGE} -JM${SIZE} -C${F_NAME}.cpt -E100 -P -K > ${F_NAME}.ps
# 等高線描画(不要ならコメントアウト)
grdcontour ${F_NAME}.grd -JM${SIZE} -C1000 -W0.1,128/128/128 -L-8000/8000 -A1000tf8 -O -K >> ${F_NAME}.ps
# 海岸線描画(陸域に標高データが不要ならコメント解除)
#pscoast -R${RANGE} -JM${SIZE} -Df -Wthinnest,gray -Gwheat -Lf128/45/35/200k -O -K >> ${F_NAME}.ps
# 海岸線描画(海域に深度データが不要ならコメント解除)
#pscoast -R${RANGE} -JM${SIZE} -Df -Wthinnest,gray -S240/255/255 -Lf128/45/35/100k -O -K >> ${D_IMG}/${F_NAME}.ps
# 縦軸・横軸描画
psbasemap -R${RANGE} -JM${SIZE} -Ba5f5WSne -O -K >> ${F_NAME}.ps
# 凡例描画
psscale -Ba4000g2000f1000 -C${F_NAME}.cpt -D6c/-1c/6c/0.5ch -O >> ${F_NAME}.ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment