add -p option
This commit is contained in:
parent
f2939716d8
commit
87718784c9
@ -13,14 +13,15 @@ overwrite=0
|
||||
labels=("longitude (degree)" "latitude (degree)")
|
||||
plotgrad=0
|
||||
clon=0
|
||||
polyfile='null'
|
||||
# 从命令行获取参数
|
||||
while getopts "hi:r:u:c:a:G:l:g" arg
|
||||
while getopts "hi:r:u:c:a:G:l:p:g" 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<lon>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-g] [-G<grad-data>]\n"
|
||||
printf "usage: ${0##*/} -i<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-l<lon>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-g] [-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 value of the plot, the default value is 0"
|
||||
@ -29,6 +30,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" "-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."
|
||||
exit 0;;
|
||||
i)
|
||||
data=$OPTARG;;
|
||||
@ -47,6 +49,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z
|
||||
plotgrad=1;;
|
||||
G)
|
||||
gridData=$OPTARG;;
|
||||
p)
|
||||
polyfile=$OPTARG;;
|
||||
?)
|
||||
printf "error: unknow argument\nuse -h option to see help information\n"
|
||||
exit 1;;
|
||||
@ -91,6 +95,9 @@ else
|
||||
else
|
||||
gmt grdimage ${data} -R${range} -C${cptfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN${clon}/2i -K -P > $psfile
|
||||
fi
|
||||
if [[ $polyfile != 'null' ]]; then
|
||||
gmt psxy $polyfile -JN${clon}/2i -R${range} -L -K -O >> $psfile
|
||||
fi
|
||||
#-C${cptfile}+Uk 使用km(色标单位除1000
|
||||
#如果unit等于km则在cptfile后面添加+Uk
|
||||
if [[ ${unit} == 'km+Uk' ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user