From b97bee5eae7fbb7d8ab7bccbed7aa7a7b330d096 Mon Sep 17 00:00:00 2001 From: pi Date: Thu, 3 May 2018 11:47:17 -0700 Subject: [PATCH] add -l option --- gmtsph-global.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gmtsph-global.sh b/gmtsph-global.sh index e2b27d1..5fb299c 100755 --- a/gmtsph-global.sh +++ b/gmtsph-global.sh @@ -11,6 +11,7 @@ overwriteRange='null' overwrite=0 labels=("longitude (degree)" "latitude (degree)") plotgrad=0 +clon=0 # 从命令行获取参数 while getopts "hi:r:u:c:a:g" arg do @@ -18,9 +19,10 @@ do h) printf "simple global wide data mapping using GMT script. The template accepts a grid (.nc .grid) file as input and outputs a .png and a .eps file. \ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (zhangyi.cugwuhan@gmail.com)\n" - printf "usage: ${0##*/} -i [-r///] [-u] [-c] [-a,] [-g]\n" + printf "usage: ${0##*/} -i [-r///] [-l] [-u] [-c] [-a,] [-g]\n" printf "%s\t%s\n" "-i" "input grid file" printf "%s\t%s\n" "-r" "data range. The template will ditect the input data range automaticly, the use of this option will overwrite the range." + printf "%s\t%s\n" "-l" "central longitude value of the plot, the default value is 0" printf "%s\t%s\n" "-u" "data unit. The default is meter." printf "%s\t%s\n" "-c" "color cpt. The default is rainbow." printf "%s\t%s\n" "-a" "axis labels. The deafults are x (m) and y (m)." @@ -35,6 +37,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z r) overwrite=1 overwriteRange=$OPTARG;; + l) + clon=$OPTARG;; a) labels=(${OPTARG//,/ });; g) @@ -75,9 +79,9 @@ else if [[ $plotgrad == 1 ]]; then gradfile=usergradient.nc gmt grdgradient ${data} -G${gradfile} -Nt -A0/45 - gmt grdimage ${data} -R${range} -C${cptfile} -I${gradfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN180/3i -K -P > $psfile + gmt grdimage ${data} -R${range} -C${cptfile} -I${gradfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN${clon}/3i -K -P > $psfile else - gmt grdimage ${data} -R${range} -C${cptfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN180/3i -K -P > $psfile + gmt grdimage ${data} -R${range} -C${cptfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN${clon}/3i -K -P > $psfile fi #-C${cptfile}+Uk 使用km(色标单位除1000) gmt psscale -Dx0.5i/-0.3i+w2i/0.07i+h -C${cptfile} -Bxa -By+l${unit} -O >> $psfile