tmp update
This commit is contained in:
parent
b00d094cfc
commit
60f0ec6fae
@ -9,6 +9,7 @@ data='null'
|
||||
gridData='null'
|
||||
unit='m'
|
||||
color='rainbow'
|
||||
direct_cpt='user.cpt'
|
||||
range='null'
|
||||
overwriteRange='null'
|
||||
overwrite=0
|
||||
@ -18,7 +19,7 @@ clon=0
|
||||
polyfile='null'
|
||||
bartick="a" #色标轴标轴间隔 a表示自动
|
||||
# 从命令行获取参数
|
||||
while getopts "hi:r:u:c:a:G:l:p:v:g" arg
|
||||
while getopts "hi:r:u:c:C:a:G:l:p:v:g" arg
|
||||
do
|
||||
case $arg in
|
||||
h)
|
||||
@ -31,6 +32,7 @@ For futher explanations, please look for GMT's manuscripts."
|
||||
dispOptionShort "-l" "central longitude value of the plot, the default value is 0"
|
||||
dispOptionShort "-u" "data unit. The default is meter. use 'km+Uk' to append '+Uk' option to the psscale command"
|
||||
dispOptionShort "-c" "color cpt. The default is rainbow."
|
||||
dispOptionShort "-C" "color cpt. Use the input cpt file directly."
|
||||
dispOptionShort "-v" "intervals of color bar's labels. the script will set the intervals automatically if -v option is not set."
|
||||
dispOptionShort "-a" "axis labels. The deafults are x (m) and y (m)."
|
||||
dispOptionShort "-g" "use grdgradient. The default is false."
|
||||
@ -43,6 +45,8 @@ For futher explanations, please look for GMT's manuscripts."
|
||||
unit=$OPTARG;;
|
||||
c)
|
||||
color=$OPTARG;;
|
||||
C)
|
||||
direct_cpt=$OPTARG;;
|
||||
r)
|
||||
overwrite=1
|
||||
overwriteRange=$OPTARG;;
|
||||
@ -69,7 +73,7 @@ if [[ $data == "null" ]]; then
|
||||
exit 1
|
||||
else
|
||||
# 初始化临时文件名
|
||||
cptfile=user.cpt
|
||||
cptfile=${direct_cpt}
|
||||
psfile=${data%.*}.ps
|
||||
jpgfile=${data%.*}.png
|
||||
# 获取网格范围
|
||||
@ -90,7 +94,10 @@ else
|
||||
MAP_FRAME_AXES=WESnZ \
|
||||
MAP_LABEL_OFFSET=2.5p
|
||||
|
||||
if [[ $cptfile == 'user.cpt' ]]; then
|
||||
gmt grd2cpt ${data} -C${color} -Z -D > $cptfile
|
||||
fi
|
||||
|
||||
if [[ $plotgrad == 1 ]]; then
|
||||
gradfile=${data%.*}Grad.nc
|
||||
if [[ $gridData == 'null' ]]; then
|
||||
@ -103,7 +110,9 @@ 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
|
||||
#-L force closed polygon
|
||||
#gmt psxy $polyfile -JN${clon}/2i -R${range} -L -K -O >> $psfile
|
||||
gmt psxy $polyfile -JN${clon}/2i -R${range} -W0.1p -K -O >> $psfile
|
||||
fi
|
||||
#-C${cptfile}+Uk 使用km(色标单位除1000
|
||||
#如果unit等于km则在cptfile后面添加+Uk
|
||||
@ -114,7 +123,10 @@ else
|
||||
fi
|
||||
gmt psconvert $psfile -A -TEG -E300
|
||||
# 删除临时文件 使用linux终端rm命令
|
||||
rm $cptfile $psfile gmt.history gmt.conf
|
||||
if [[ $cptfile == 'user.cpt' ]]; then
|
||||
rm $cptfile
|
||||
fi
|
||||
rm $psfile gmt.history gmt.conf
|
||||
if [[ $plotgrad == 1 ]]; then
|
||||
rm $gradfile
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user