update file

This commit is contained in:
张壹 2018-03-22 14:15:04 -07:00
parent fcfd49e1b5
commit bf053a21be

View File

@ -12,6 +12,7 @@ overwrite=0
labels=("longitude (degree)" "latitude (degree)")
plot_para=(0 0 0 0)
plotgrad=0
nocpt=0
# 从命令行获取参数
while getopts "hi:r:u:c:a:gv:" arg
do
@ -19,13 +20,14 @@ do
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"
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 "%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."
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" "-g" "use grdgradient. The default is false."
printf "%s\t%s\n" "-n" "disabele the use of grd2cpt."
exit 0;;
i)
data=$OPTARG;;
@ -40,6 +42,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z
labels=(${OPTARG//,/ });;
g)
plotgrad=1;;
n)
nocpt=1;;
?)
printf "error: unknow argument\nuse -h option to see help information\n"
exit 1;;
@ -86,7 +90,12 @@ else
COLOR_NAN=black \
MAP_LABEL_OFFSET=2.5p
gmt grd2cpt ${data} -R${range} -C${color} -Z -D -M > $cptfile
if [[ $nocpt == 1 ]]; then
gmt grd2cpt ${data} -R${range} -C${color} -Z -D -M > $cptfile
else
$cptfile = ${color}
fi
if [[ $plotgrad == 1 ]]; then
gradfile=usergradient.nc
gmt grdgradient ${data} -G${gradfile} -Nt -A0/45