add -l option
This commit is contained in:
parent
a6a58c941e
commit
b97bee5eae
@ -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<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-u<unit>] [-c<cpt-file>] [-a<x-label>,<y-label>] [-g]\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]\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
|
||||
|
Loading…
Reference in New Issue
Block a user