From 755ba8675435055912579085515d215d44a6f5ba Mon Sep 17 00:00:00 2001 From: yizhang Date: Sun, 25 Mar 2018 13:21:55 -0700 Subject: [PATCH] add -p option --- gmtsph-regional.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gmtsph-regional.sh b/gmtsph-regional.sh index e0c9737..b52e07a 100755 --- a/gmtsph-regional.sh +++ b/gmtsph-regional.sh @@ -13,8 +13,9 @@ labels=("longitude (degree)" "latitude (degree)") plot_para=(0 0 0 0) plotgrad=0 nocpt=0 +inverseCPT=0 # 从命令行获取参数 -while getopts "hi:r:u:c:a:gv:n" arg +while getopts "hi:r:u:c:a:gv:np" arg do case $arg in h) @@ -28,6 +29,7 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z printf "%s\t%s\n" "-a" "axis labels. The deafults are x (m) and y (m)." printf "%s\t%s\n" "-g" "use grdgradient. The default is false." printf "%s\t%s\n" "-n" "disabele the use of grd2cpt." + printf "%s\t%s\n" "-p" "inverse the color pattern specified by the -c option, no use if -n option is implemented." exit 0;; i) data=$OPTARG;; @@ -44,6 +46,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z plotgrad=1;; n) nocpt=1;; + p) + inverseCPT=1;; ?) printf "error: unknow argument\nuse -h option to see help information\n" exit 1;; @@ -93,7 +97,11 @@ else if [[ $nocpt == 1 ]]; then cptfile=${color} else - gmt grd2cpt ${data} -R${range} -C${color} -Z -D -M > $cptfile + if [[ $inverseCPT == 1 ]]; then + gmt grd2cpt ${data} -R${range} -C${color} -Z -D -M -I > $cptfile + else + gmt grd2cpt ${data} -R${range} -C${color} -Z -D -M > $cptfile + fi fi if [[ $plotgrad == 1 ]]; then