[2015年 7月 30日 木曜日 17:39:41 JST]
[~/2015.Sora.Kikaku/Observation.Sites]
[am@aofd165]
$ pl.obs.sh
Bash script ./pl.obs.sh starts.
Input :
Output : Operational.Meteo.Obs.Sites.ps
pstext: Record 6 had bad x and/or y coordinates, must exit)
Done ./pl.obs.sh
::::::::::::::
pl.obs.sh
::::::::::::::
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work1/am/2015.Sora.Kikaku/Observation.Sites
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 15:29 on 07-30-2015.
. ./gmtpar.sh
echo "Bash script $0 starts."
range=118/155/20/46
size=135/6
xanot=a10f5
yanot=a10f5
anot=${xanot}/${yanot}WSne
in1=JMA.Amedas.asc
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
in2=JMA.sonde.asc
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
in3=JMA.Wind.Profiler.asc
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
in4=JMA.Buoy.asc
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
#figdir="../fig/"
#if [ ! -d ${figdir} ];then
# mkdir -p $figdir
#fi
out=Operational.Meteo.Obs.Sites.ps #${figdir}$(basename $in .asc).ps
echo Input : $in
echo Output : $out
pscoast -R$range -JQ$size -S230 -P -X1.5 -Y1.5 -K > $out
# Amedas
awk -F , '{if ($1!="#") print $9+$10/60, $7+$8/60}' $in1 |\
psxy -R$range -JQ$size -St0.03 -W1 -G255 -O -K >> $out
# Wind profiler
awk -F , '{if ($1!="#") print $7+$8/60, $5+$6/60}' $in3 |\
psxy -R$range -JQ$size -Sc0.06 -W4 -G255 -O -K >> $out
# Sonde
awk -F , '{if ($1!="#") print $5+$6/60, $3+$4/60}' $in2 |\
psxy -R$range -JQ$size -Sa0.09 -W3 -G255 -O -K >> $out
# Buoy
#awk '{if ($1!="#") print $7+$8/60, $4+$5/60}' $in4 |\
#psxy -R$range -JQ$size -Sx0.08 -W7/255/255/255 -O -K >> $out
#awk '{if ($1!="#") print $7+$8/60, $4+$5/60}' $in4 |\
#psxy -R$range -JQ$size -Sx0.08 -W3 -O -K >> $out
# Drifting buoy
# http://www.data.jma.go.jp/kaiyou/db/vessel_obs/data-report/doc/format_buoy_jap.pdf
filelist="\
14-12.TXT \
14-14.TXT \
14-15.TXT \
14-17.TXT \
15-01.TXT \
15-02.TXT \
15-03.TXT \
15-07.TXT \
"
temp1=$(basename $0).temp1.txt
temp2=$(basename $0).temp2.txt
for input in $filelist; do
awk '{print $8}' $input | sed -e 's/E/ /g' | \
awk '{print $1/1000}' >$temp1
awk '{print $7}' $input | \
awk '{print $1/1000}' >$temp2
paste $temp1 $temp2 | \
psxy -R$range -JQ$size -W1 -O -K >>$out
# paste $temp1 $temp2 | \
# psxy -R$range -JQ$size -Sc0.01 -G0 -O -K >>$out
rm -f $temp1 $temp2
done
psbasemap -R$range -JQ$size -B$anot -O -K >> $out
xoffset=
yoffset=6
comment=
. ./note.sh
echo "Done $0"
::::::::::::::
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"
orange="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}
::::::::::::::
get.buoy.sh
::::::::::::::
#!/bin/sh
url=http://www.data.jma.go.jp/kaiyou/data/db/vessel_obs/data-report/data/2015/buoy/txt
filelist="\
14-12.TXT \
14-14.TXT \
14-15.TXT \
14-17.TXT \
15-01.TXT \
15-02.TXT \
15-03.TXT \
15-07.TXT \
"
for input in $filelist; do
wget $url/$input
done
exit 0