From 1cd852b265009b650d9ec122798b8cbc6093c60d Mon Sep 17 00:00:00 2001 From: pi Date: Thu, 19 Jul 2018 13:10:32 -0700 Subject: [PATCH] add -n option --- gmtsph-JA.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gmtsph-JA.sh b/gmtsph-JA.sh index 3631470..a6e78e5 100755 --- a/gmtsph-JA.sh +++ b/gmtsph-JA.sh @@ -12,12 +12,13 @@ overwriteRange='null' overwrite=0 labels=("longitude (degree)" "latitude (degree)") plotgrad=0 +nocpt=0 plotsun=0 clon=("0/0/115" "180/0/115") polyfile='null' bartick="a" #色标轴标轴间隔 a表示自动 # 从命令行获取参数 -while getopts "hi:r:u:c:a:v:G:l:p:gs" arg +while getopts "hi:r:u:c:a:v:G:l:p:gsn" arg do case $arg in h) @@ -29,6 +30,7 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z printf "%s\t%s\n" "-l" "central longitude and latitude values of the plot, the default value is 0/0/115,180/0/115. " printf "%s\t%s\n" "-u" "data unit. The default is meter. use 'km+Uk' to append '+Uk' option to the psscale command" printf "%s\t%s\n" "-c" "color cpt. The default is 'rainbow -Z' in which '-Z' tells the grd2cpt to make a continuous cpt-file, remove it to disable the function." + printf "%s\t%s\n" "-n" "disable the use of grd2cpt." printf "%s\t%s\n" "-s" "plot the day-night terminator. The default is false." printf "%s\t%s\n" "-a" "axis labels. The deafults are x (m) and y (m)." printf "%s\t%s\n" "-v" "intervals of color bar's labels. the script will set the intervals automatically if -v option is not set." @@ -42,6 +44,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z unit=$OPTARG;; c) color=$OPTARG;; + n) + nocpt=1;; s) plotsun=1;; r) @@ -92,7 +96,13 @@ else MAP_FRAME_AXES=WESnZ \ MAP_LABEL_OFFSET=2.5p - gmt grd2cpt ${data} -R${range} -C${color} -D > $cptfile + # 设置色标文件 + if [[ $nocpt == 1 ]]; then + cptfile=${color} + else + gmt grd2cpt ${data} -R${range} -C${color} -D -M > $cptfile + fi + if [[ $plotgrad == 1 ]]; then gradfile=${data%.*}Grad.nc if [[ $gridData == 'null' ]]; then