@@ -2,7 +2,7 @@
# 包含GMT自带脚本文件 其中包含了一些有用的功能 比如获取网格文件的范围
. gmt_shell_functions.sh
# 包含dispOption脚本
. dispOptions
. dispOptions.sh
#GMT显示平面数据脚本, 输入文件为网格文件, 没有包含网格化语句因为网格化过程中的情况多样化, 建议在其他脚本中个别添加再调用此脚本
# 初始化参数
data = 'null'
@@ -16,8 +16,9 @@ labels=("longitude (degree)" "latitude (degree)")
plotgrad = 0
clon = 0
polyfile = 'null'
bartick = "a" #色标轴标轴间隔 a表示自动
# 从命令行获取参数
while getopts "hi:r:u:c:a:G:l:p:g" arg
while getopts "hi:r:u:c:a:G:l:p:v: g" arg
do
case $arg in
h)
@@ -30,6 +31,7 @@ For futher explanations, please look for GMT's manuscripts."
dispOptionShort "-l" "central longitude value of the plot, the default value is 0"
dispOptionShort "-u" "data unit. The default is meter. use 'km+Uk' to append '+Uk' option to the psscale command"
dispOptionShort "-c" "color cpt. The default is rainbow."
dispOptionShort "-v" "intervals of color bar's labels. the script will set the intervals automatically if -v option is not set."
dispOptionShort "-a" "axis labels. The deafults are x (m) and y (m)."
dispOptionShort "-g" "use grdgradient. The default is false."
dispOptionShort "-G" "provide a different input grid data for the use of grdgradient. This should be used with the '-g' option at the same time"
@@ -46,6 +48,8 @@ For futher explanations, please look for GMT's manuscripts."
overwriteRange = $OPTARG ; ;
l)
clon = $OPTARG ; ;
v)
bartick = $OPTARG ; ;
a)
labels = ( ${ OPTARG //,/ } ) ; ;
g)
@@ -104,9 +108,9 @@ else
#-C${cptfile}+Uk 使用km( 色标单位除1000
#如果unit等于km则在cptfile后面添加+Uk
if [ [ ${ unit } = = 'km+Uk' ] ] ; then
gmt psscale -Dx0.4i/-0.3i+w1.2i/0.05i+h -C${ cptfile } +Uk -Bxa -By+l"km" -O >> $psfile
gmt psscale -Dx0.4i/-0.3i+w1.2i/0.05i+h -C${ cptfile } +Uk -Bx${ bartick } -By+l"km" -O >> $psfile
else
gmt psscale -Dx0.4i/-0.3i+w1.2i/0.05i+h -C${ cptfile } -Bxa -By+l${ unit } -O >> $psfile
gmt psscale -Dx0.4i/-0.3i+w1.2i/0.05i+h -C${ cptfile } -Bx${ bartick } -By+l${ unit } -O >> $psfile
fi
gmt psconvert $psfile -A -TEG -E300
# 删除临时文件 使用linux终端rm命令