[2015年 9月 25日 金曜日 16:31:26 JST]
[~/SST.Proc/JCOPE2.Daily.Mean/plot]
[am@aofd165]
$ pl.sst.birdseye.sh ../output/jcope2.sst.2011-06-25_00.txt
Bash script ./pl.sst.birdseye.sh starts.
Input : ../output/jcope2.sst.2011-06-25_00.txt
Output : ../ps/jcope2.sst.2011-06-25_00.birds-eye_200-45.ps
::::::::::::::
pl.sst.birdseye.sh
::::::::::::::
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd30
# Directory: /work2/am/12.Work11/21.Climatology/16.jcope_tend_adv/plot
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 18:21 on 07-27-2011.
usage()
{
echo Error in $0 : Wrong number of arguments
echo Usage : $0 [-n] input_file
echo -n: Do not paint land
echo
return
}
CMDNAME=$(basename $0)
while getopts n OPT; do
case $OPT in
"n" ) flagn="true" ;;
* ) usage; exit 1 ;;
esac
done
# オプションが指定されなかった場合, flaglに"NOT_AVILABLE"という値を入れる。
flagn=${flagn:-"NOT_AVAILABLE"}
shift `expr $OPTIND - 1`
. ./gmtpar.sh
echo "Bash script $0 starts."
scale=1.
range1=115/150/23/46
size=5
xanot=a5f1
yanot=a5f1
reso=15m/15m
reso_smth=30m/30m
reso_mask=30m/30m
tension=1
anot=${xanot}/${yanot}
tension=1
cpt=$(basename $0 .sh).cpt.txt
cpt_range="10/32/1"
makecpt -Cgray -T$cpt_range > $cpt
plcontour=n
CI_tnd=1
CI_RHS=$CI_tnd
scalex=2.5
scaley=-0.5
scalesize=2.5
scale_anot=a10f2
az=200
el=45
if [ $# -ne 1 ]; then
usage
exit 1
fi
in=$1
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
psdir="../ps/"
if [ ! -d ${psdir} ];then
mkdir -p $psdir
fi
out=$psdir$(basename $in .txt).birds-eye_${az}-${el}.ps
echo Input : $in
echo Output : $out
grd=$1.grd #$(basename $in .asc).grd
grdi=$1.i.grd
tstamp1=$(ls -l $in |awk '{print $6,$7,$8}')
title=""
col=3
awk -v scl=$scale '{if (($'"$col"' > -100.) && ($'"$col"' < 1000.)) \
print $1,$2,$'"$col"' }' $in | \
blockmean -R$range1 -I$reso_smth | \
surface -R$range1 -I$reso -T0.8 -G$grd
grdgradient $grd -Ne0.6 -A${az} -G$grdi
grdview $grd -I$grdi -R$range1 -JM${size} \
-E${az}/${el} \
-Qs \
-C$cpt \
-K -X1.5 -Y1.5 -P > $out
grdcontour $grd -R$range1 -JM -C1 -L-100/100 \
-W2/${white} \
-E${az}/${el} \
-O -K >> $out
if [ $flagn = "true" ]; then
pscoast -R$range1 -JM -B${anot}wsne -Dl -W2 -E${az}/${el} -O -K >> $out
else
pscoast -R$range2 -JM -B${anot}wsne -Dl -W2 -E${az}/${el} -G200 -O -K >> $out
fi
text="116 41.7 18 0 1 LM $title"
pstext << end -R -JM -O -K >> $out
$text
end
psscale -D$scalex/$scaley/$scalesize/0.1h -B${scale_anot}:"${deg}C": -C$cpt -O -K >> $out
xoffset=
yoffset=5
comment=
. ./note.sh
rm -rf *.grd ${cpt}
echo "Done $0.sh"
::::::::::::::
gmtpar.sh
::::::::::::::
#
# GMTのパラメータの設定 (version 4以上対象)
#
# 長さの単位はインチとする
gmtset MEASURE_UNIT INCH
gmtset LABEL_FONT_SIZE 18
gmtset HEADER_FONT_SIZE 20
gmtset ANOT_FONT_SIZE 18
gmtset TICK_PEN 4
# 地図の縦横軸に縞々を使わない
gmtset BASEMAP_TYPE PLAIN
# 紙のサイズはA4
gmtset PAPER_MEDIA A4
# 地図の°の記号
gmtset DEGREE_SYMBOL = degree # Available for ver. 4 or later
# 空白文字の設定
sp="\040" # White space
# =の記号
eq="\075" # equal
# 温度の°の記号
deg="\260" #deg="\312" # degree symbol
# 色のRGB値を設定 (線や点に色をつけるときRGB値を直接指定するより分かりやすい)
red="255/0/0"
orenge="255/165/0"
pink="255/192/203"
green="0/255/0"
blue="0/0/255"
midnightblue="25/25/112"
yellow="255/255/0"
gold="255/215/0"
purple="160/32/240"
magenta="255/0/255"
white="255/255/255"
# 線種を指定
dash="t15_5:15"
dot="t5_5:5"
dotdash="t12_5_5_5:5"
#その他の線種の例
# -W5t20_5:5
# -W5t15_5:5
# -W5t20_5_5_5_5_5:5
# -W5t30_5_5_5:5
# -W5t20_5_10_5:5
# 数字の出力フォーマット(project, grd2xzy等で使う)
gmtset D_FORMAT %lg #デフォルト(規定値)
# 桁数を指定(例:123.45678)
#gmtset D_FORMAT %12.6f
# 状況に応じて
#gmtset D_FORMAT %12.5g
::::::::::::::
note.sh
::::::::::::::
# Print time, current working directory and output filename
export LANG=C
currentdir=`pwd`
if [ ${#currentdir} -gt 90 ]; then
curdir1=${currentdir:1:90}
curdir2=${currentdir:91}
else
curdir1=$currentdir
curdir2="\ "
fi
now=`date`
host=`hostname`
#comment=" "
time1=$(ls -l $in | awk '{print $6, $7, $8}')
pstext -JX6/1.2 -R0/1/0/1.2 -N -X${xoffset:-0} -Y${yoffset:-0} << EOF -O >> $out
0 1.1 9 0 1 LM $0 $@
0 0.95 9 0 1 LM ${now}
0 0.80 9 0 1 LM ${host}
0 0.65 9 0 1 LM ${curdir1}
0 0.50 9 0 1 LM ${curdir2}
0 0.35 9 0 1 LM Input: ${in} (${time1})
0 0.1 9 0 1 LM ${comment:-""}
EOF
# Output: ${out}