add -p option
This commit is contained in:
parent
f2939716d8
commit
87718784c9
@ -13,14 +13,15 @@ overwrite=0
|
|||||||
labels=("longitude (degree)" "latitude (degree)")
|
labels=("longitude (degree)" "latitude (degree)")
|
||||||
plotgrad=0
|
plotgrad=0
|
||||||
clon=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
|
do
|
||||||
case $arg in
|
case $arg in
|
||||||
h)
|
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. \
|
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"
|
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" "-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" "-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" "-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" "-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" "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" "-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;;
|
exit 0;;
|
||||||
i)
|
i)
|
||||||
data=$OPTARG;;
|
data=$OPTARG;;
|
||||||
@ -47,6 +49,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z
|
|||||||
plotgrad=1;;
|
plotgrad=1;;
|
||||||
G)
|
G)
|
||||||
gridData=$OPTARG;;
|
gridData=$OPTARG;;
|
||||||
|
p)
|
||||||
|
polyfile=$OPTARG;;
|
||||||
?)
|
?)
|
||||||
printf "error: unknow argument\nuse -h option to see help information\n"
|
printf "error: unknow argument\nuse -h option to see help information\n"
|
||||||
exit 1;;
|
exit 1;;
|
||||||
@ -91,6 +95,9 @@ else
|
|||||||
else
|
else
|
||||||
gmt grdimage ${data} -R${range} -C${cptfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN${clon}/2i -K -P > $psfile
|
gmt grdimage ${data} -R${range} -C${cptfile} -Bxag+l"${labels[0]}" -Bpya40g40+l"${labels[1]}" -JN${clon}/2i -K -P > $psfile
|
||||||
fi
|
fi
|
||||||
|
if [[ $polyfile != 'null' ]]; then
|
||||||
|
gmt psxy $polyfile -JN${clon}/2i -R${range} -L -K -O >> $psfile
|
||||||
|
fi
|
||||||
#-C${cptfile}+Uk 使用km(色标单位除1000
|
#-C${cptfile}+Uk 使用km(色标单位除1000
|
||||||
#如果unit等于km则在cptfile后面添加+Uk
|
#如果unit等于km则在cptfile后面添加+Uk
|
||||||
if [[ ${unit} == 'km+Uk' ]]; then
|
if [[ ${unit} == 'km+Uk' ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user