update files

This commit is contained in:
张壹 2018-10-18 19:03:13 -07:00
parent f8516ff1a1
commit b080977988

View File

@ -13,19 +13,21 @@ overwriteRange='null'
overwrite=0
bartick="a" #色标轴标轴间隔 a表示自动
opFile=0
hori=''
# 从命令行获取参数
while getopts "hi:r:u:c:v:o" arg
while getopts "hi:r:u:c:v:os" arg
do
case $arg in
h)
dispTitle "${0##*/}" "plot a color bar using GMT script. The template accepts a grid (.nc .grid) file as input and outputs a .png and a .eps file. \
For further explanations, please look for GMT's manuscripts."
dispAuthorInfo "Yi Zhang (zhangyi.cugwuhan@gmail.com)"
dispUsage "${0##*/} -i<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-c<cpt-file>] [-o] [-u<unit>] [-v<bar-tick>]"
dispUsage "${0##*/} -i<grid-data> [-r<xmin>/<xmax>/<ymin>/<ymax>] [-c<cpt-file>] [-o] [-s] [-u<unit>] [-v<bar-tick>]"
dispOptionShort "-i" "input grid file."
dispOptionShort "-r" "data range. The template will detect the input data range automatically, the use of this option will overwrite the range."
dispOptionShort "-c" "color cpt, The default is rainbow."
dispOptionShort "-o" "open file in finder, the default is using imgcat."
dispOptionShort "-s" "plot the color bar horizontally."
dispOptionShort "-u" "data unit. The default is meter."
dispOptionShort "-v" "intervals of color bar's labels. the script will set the intervals automatically if -v option is not set."
exit 0;;
@ -44,6 +46,8 @@ do
opFile=1;;
v)
bartick=$OPTARG;;
s)
hori='+h';;
?)
printf "error: unknow argument\nuse -h option to see help information\n"
exit 1;;
@ -81,9 +85,9 @@ else
#-C${cptfile}+Uk 使用km色标单位除1000
#如果unit等于km则在cptfile后面添加+Uk
if [[ ${unit} == 'km+Uk' ]]; then
gmt psscale -Dx1.6i/0.1i+w1.2i/0.07i+h -C${cptfile}+Uk -Bx${bartick} -By+l${unit} > $psfile
gmt psscale -Dx1.6i/0.1i+w1.2i/0.07i${hori} -C${cptfile}+Uk -Bx${bartick} -By+l${unit} > $psfile
else
gmt psscale -Dx1.6i/0.1i+w1.2i/0.07i+h -C${cptfile} -Bx${bartick} -By+l${unit} > $psfile
gmt psscale -Dx1.6i/0.1i+w1.2i/0.07i${hori} -C${cptfile} -Bx${bartick} -By+l${unit} > $psfile
fi
gmt psconvert $psfile -A -TEG -E500
# 删除临时文件 使用linux终端rm命令