add -b option
This commit is contained in:
		@@ -14,19 +14,21 @@ plot_para=(0 0 0 0)
 | 
			
		||||
plotgrad=0
 | 
			
		||||
nocpt=0
 | 
			
		||||
inverseCPT=0
 | 
			
		||||
coastline=0
 | 
			
		||||
# 从命令行获取参数
 | 
			
		||||
while getopts "hi:r:u:c:a:gv:np" arg
 | 
			
		||||
while getopts "hi:r:u:c:a:gv:npb" arg
 | 
			
		||||
do
 | 
			
		||||
	case $arg in
 | 
			
		||||
		h)
 | 
			
		||||
			printf "simple regional 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>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-g] [-n]\n"
 | 
			
		||||
			printf "usage: ${0##*/} -i<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-b] [-g] [-n]\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" "-u" "data unit. The default is meter."
 | 
			
		||||
			printf "%s\t%s\n" "-c" "color cpt. The default is rainbow. The script will use grd2cpt to recalculate the color scale file, use -n option to disable the use of grd2cpt."
 | 
			
		||||
			printf "%s\t%s\n" "-a" "axis labels. The deafults are x (m) and y (m)."
 | 
			
		||||
			printf "%s\t%s\n" "-b" "draw coast line."
 | 
			
		||||
			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."
 | 
			
		||||
@@ -42,6 +44,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z
 | 
			
		||||
			overwriteRange=$OPTARG;;
 | 
			
		||||
		a)
 | 
			
		||||
			labels=(${OPTARG//,/ });;
 | 
			
		||||
		b)
 | 
			
		||||
			coastline=1;;
 | 
			
		||||
		g)
 | 
			
		||||
			plotgrad=1;;
 | 
			
		||||
		n)
 | 
			
		||||
@@ -111,6 +115,11 @@ else
 | 
			
		||||
	else
 | 
			
		||||
		gmt grdimage ${data} -R${range} -C${cptfile} -Bxag+l"${labels[0]}" -Byag+l"${labels[1]}" -JL${plot_para[0]}/${plot_para[1]}/${plot_para[2]}/${plot_para[3]}/1.5i -K -P > $psfile
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [[ $coastline == 1 ]]; then
 | 
			
		||||
		gmt pscoast -R${range} -JL -W0.25p -Dc -A5000 -K -O -P >> $psfile
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	#-C${cptfile}+Uk 使用km(色标单位除1000)
 | 
			
		||||
	gmt psscale -Dx0.13i/-0.3i+w1.2i/0.06i+h -C${cptfile} -Bxa -By+l${unit} -O >> $psfile
 | 
			
		||||
	gmt psconvert $psfile -A -TEG -E300
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user