add -v option

This commit is contained in:
张壹 2018-07-19 12:34:55 -07:00
parent 007b27ea2d
commit df067832a8

View File

@ -15,14 +15,15 @@ plotgrad=0
plotsun=0
clon=("0/0/115" "180/0/115")
polyfile='null'
bartick="a" #色标轴标轴间隔 a表示自动
# 从命令行获取参数
while getopts "hi:r:u:c:a:G:l:p:gs" arg
while getopts "hi:r:u:c:a:v:G:l:p:gs" arg
do
case $arg in
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<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-l<clon>/<clat>/<horizon>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-g] [-s] [-G<grad-data>] [-p<polygon-file>]\n"
printf "usage: ${0##*/} -i<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-l<clon>/<clat>/<horizon>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-v<c-tick>] [-g] [-s] [-G<grad-data>] [-p<polygon-file>]\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 and latitude values of the plot, the default value is 0/0/115,180/0/115. "
@ -30,6 +31,7 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z
printf "%s\t%s\n" "-c" "color cpt. The default is rainbow."
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."
printf "%s\t%s\n" "-g" "use grdgradient. The default is false."
printf "%s\t%s\n" "-G" "provide a different input grid data for the use of grdgradient. This should be used with the '-g' option at the same time"
printf "%s\t%s\n" "-p" "plot polygons via a file."
@ -49,6 +51,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z
clon=(${OPTARG//,/ });;
a)
labels=(${OPTARG//,/ });;
v)
bartick=$OPTARG;;
g)
plotgrad=1;;
G)
@ -119,9 +123,9 @@ else
#-C${cptfile}+Uk 使用km色标单位除1000
#如果unit等于km则在cptfile后面添加+Uk
if [[ ${unit} == 'km+Uk' ]]; then
gmt psscale -I -Dx0.85i/-0.2i+w1.5i/0.05i+h -C${cptfile}+Uk -Bxa -By+l"km" -X-1.7i -O >> $psfile
gmt psscale -I -Dx0.85i/-0.2i+w1.5i/0.05i+h -C${cptfile}+Uk -Bx${bartick} -By+l"km" -X-1.7i -O >> $psfile
else
gmt psscale -I -Dx0.85i/-0.2i+w1.5i/0.05i+h -C${cptfile} -Bxa -By+l${unit} -X-1.7i -O >> $psfile
gmt psscale -I -Dx0.85i/-0.2i+w1.5i/0.05i+h -C${cptfile} -Bx${bartick} -By+l${unit} -X-1.7i -O >> $psfile
fi
gmt psconvert $psfile -A -TEG -E300
# 删除临时文件 使用linux终端rm命令