プログラム一式(現在テスト中)は、このページの最下段のリンクよりダウンロードできます。テスト中ですので、バグが存在している可能性がありますので、ご利用の際はその点ご留意下さい。
[emi@aofd165 ~]$ cd Preprocess.MSM/
$ cat all_run_get_msm_nc.sh
You may need to modify the lines marked by red.
#!/bin/bash
run_get_msm_nc.sh MSM-S 20110519 5
run_get_msm_nc.sh MSM-P 20110519 5
$ sh run_get_msm_nc.sh
Error in run_get_msm_nc.sh : Wrong number of arguments
Usage: run_get_msm_nc.sh dataset start tday
[emi@aofd165 Preprocess.MSM]$ all_run_get_msm_nc.sh
[emi@aofd165 Preprocess.MSM]$ tree MSM-P MSM-S
MSM-P
`-- 2011
|-- 0519.nc
|-- 0520.nc
|-- 0521.nc
|-- 0522.nc
|-- 0523.nc
`-- README
MSM-S
`-- 2011
|-- 0519.nc
|-- 0520.nc
|-- 0521.nc
|-- 0522.nc
|-- 0523.nc
`-- README
$ cat msm2bin_run.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work1/am/TRAJECTORY/Preprocess.MSM
#
# Revision history:
# This file is created by /usr/local/mybin/nbscr.sh at 16:56 on 01-19-2015.
echo "Shell script, $(basename $0) starts."
echo
exe=$(basename $0 _run.sh)
if [ ! -f $exe ]; then
echo Error in $0 : No such file, $exe
exit 1
fi
runname=Run.MSM.01
indir="MSM-P"
iyyyy=2013
imm=05
idd=25
yyyy=2013
mm=05
dd=31
outdir=output
mkdir -vp $outdir
namelist=${exe}.namelist.${runname}.txt
cat <<EOF > $namelist
¶
iyyyy=${iyyyy}
imm=${imm}
idd=${idd}
yyyy=${yyyy}
mm=${mm}
dd=${dd}
in_msmp="${indir}/${yyyy}/${mm}${dd}.nc"
outdir="${outdir}"
&end
EOF
${exe} < $namelist
echo "Done $0"
echo
$ msm2bin_run.sh
Shell script, msm2bin_run.sh starts.
Program msm2bin starts.
Input: MSM-P/2014/0531.nc
Open : MSM-P/2014/0531.nc
Read lon
Read lat
Read p
Read time
Read temp
Read z
Read w
Read u
Read v
Read rh
Output: output/MSMP20140531_00.dat
Output: output/MSMP20140531_03.dat
Output: output/MSMP20140531_06.dat
Output: output/MSMP20140531_09.dat
Output: output/MSMP20140531_12.dat
Output: output/MSMP20140531_15.dat
Output: output/MSMP20140531_18.dat
Output: output/MSMP20140531_21.dat
Output: output/MSMP.ctl
Done program msm2bin.
Done ./msm2bin_run.sh
[emi@aofd165 Preprocess.MSM]$ cd output
[emi@aofd165 output]$ grads -bcp "pl.msmp.gs"
.....
.....
EPS file written to 20110522_00_950hPa.eps
ga-> quit
20110522_00_950hPa.eps
$ cd ..
[emi@aofd165 output]$ cd ..
[emi@aofd165 ~]$ cd MSM.3D.Backward/
$ pwd
/work2/emi/MSM.3D.Backward
$ cat trajectory_msm_3d_backward_run.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work1/am/TRAJECTORY/Runge.Kutta
#
# Revision history:
# This file is created by /usr/local/mybin/nbscr.sh at 16:13 on 01-08-2015.
ulimit -s unlimited
exe=$(basename $0 _run.sh)
if [ ! -f $exe ]; then
Error in $0 : No such file, $exe
exit 1
fi
prefix=FOG.201305
run_number=Run01
#stage=201305
traj=Traj01
# Parameters for backward trajectory
run_name=${prefix}.${run_number}.${traj}
#run_name=${prefix}.${run_number}.${stage}.${traj}
t0=118800.0 #Time when you want to release a parcel [s]
x0=127.0 #Longitude [degE]
y0=26.9 #Latitude [degN]
z0=950.0 #Pressure level [hPa]
dt=600 #Time increment for comupting a trajectory [s]
nmax=72 #How many time steps you want to compute a trajectory.
# Parameters for input files of velocity field
indir=~/Preprocess.MSM/output
if [ ! -d $indir ]; then
echo
echo Error in $0 : No such directory, $indir
echo
exit 1
fi
list_infile=list_infile_${run_name}.txt
ctl_file=${indir}/MSMP.ctl
ni=14
nx=241
ny=253
nz=16
dti=10800 #[s] (10800 [s] = 3 [h])
yr0=2013 # Date and time of "first_input_file" below.
mo0=05 # These variables set origin of time of input files.
dy0=25
hr0=00
mi0=00
sc0=00
odir=output/${prefix}.${run_number}
mkdir -vp $odir
out_file=${odir}/${run_name}.txt
namelist=${exe}.namelist.${run_name}.txt
cat << EOF > $namelist
&flow_field
indir="${indir}"
list_infile="${list_infile}"
ctl_file="$ctl_file"
ni=${ni}
nx=${nx}
ny=${ny}
nz=${nz}
dti=${dti}
&end
&trajectory
x0=${x0}
y0=${y0}
z0=${z0}
yr0=${yr0}
mo0=${mo0}
dy0=${dy0}
hr0=${hr0}
mi0=${mi0}
sc0=${sc0}
t0=${t0}
dt=${dt}
nmax=${nmax}
out_file="${out_file}",
&end
EOF
first_input_file=MSMP${yr0}${mo0}${dy0}_${hr0}.dat
if [ ! -f ${indir}/$first_input_file ]; then
echo Error in $0 : No such file, ${indir}/$first_input_file
exit 1
fi
cat <<EOF >$list_infile
${first_input_file}
MSMP20130525_00.dat
MSMP20130525_03.dat
MSMP20130525_06.dat
MSMP20130525_09.dat
MSMP20130525_12.dat
MSMP20130525_15.dat
MSMP20130525_18.dat
MSMP20130525_21.dat
MSMP20130526_00.dat
MSMP20130526_03.dat
MSMP20130526_06.dat
MSMP20130526_09.dat
MSMP20130526_12.dat
MSMP20130526_15.dat
MSMP20130526_18.dat
MSMP20130526_21.dat
MSMP20130527_00.dat
MSMP20130527_03.dat
MSMP20130527_06.dat
MSMP20130527_09.dat
MSMP20130527_12.dat
MSMP20130527_15.dat
MSMP20130527_18.dat
MSMP20130527_21.dat
MSMP20130528_00.dat
MSMP20130528_03.dat
MSMP20130528_06.dat
MSMP20130528_09.dat
MSMP20130528_12.dat
MSMP20130528_15.dat
MSMP20130528_18.dat
MSMP20130528_21.dat
MSMP20130529_00.dat
MSMP20130529_03.dat
MSMP20130529_06.dat
MSMP20130529_09.dat
MSMP20130529_12.dat
MSMP20130529_15.dat
MSMP20130529_18.dat
MSMP20130529_21.dat
MSMP20130530_00.dat
MSMP20130530_03.dat
MSMP20130530_06.dat
MSMP20130530_09.dat
MSMP20130530_12.dat
MSMP20130530_15.dat
MSMP20130530_18.dat
MSMP20130530_21.dat
EOF
${exe} < $namelist
echo
mv -v ${namelist} $odir ; echo
mv -v ${list_infile} $odir ; echo
exit 0
[emi@aofd165 MSM.3D.Backward]$ trajectory_msm_3d_backward_run.sh
GrADS CTL File: /work2/emi/Preprocess.MSM/output/MSMP.ctl
Input: /work2/emi/Preprocess.MSM/output/MSMP20130525_00.dat
time[s]= 0.00000
Input: /work2/emi/Preprocess.MSM/output/MSMP20130525_00.dat
time[s]= 10800.0
Input: /work2/emi/Preprocess.MSM/output/MSMP20130525_03.dat
time[s]= 21600.0
...
... Lots of messages
...
Done subroutine set_input_file.
# yr,mo,dy,hr,mi,sc, u, v, w, x*r2d, y*r2d, z
2013 05 26 09 00 00 0.0 0.0 0.0 127.0000 26.9000 950.0
/work2/emi/Preprocess.MSM/output/MSMP20130526_06.dat
/work2/emi/Preprocess.MSM/output/MSMP20130526_09.dat
/work2/emi/Preprocess.MSM/output/MSMP20130526_03.dat
/work2/emi/Preprocess.MSM/output/MSMP20130526_06.dat
2013 05 26 08 50 00 -7.7 2.7 -0.47E-03 127.0466 26.8857 950.3
2013 05 26 08 40 00 -7.8 2.6 -0.57E-03 127.0938 26.8721 950.7
2013 05 26 08 30 00 -7.9 2.5 -0.65E-03 127.1418 26.8592 951.1
2013 05 26 08 20 00 -8.0 2.3 -0.87E-03 127.1909 26.8473 951.8
...
... Lots of messages
...
2013 05 25 21 00 00 -12.9 0.1 0.22E-03 132.3648 27.2455 984.9
Output file: output/FOG.201305.Run01/FOG.201305.Run01.Traj01.txt
`trajectory_msm_3d_backward.namelist.FOG.201305.Run01.Traj01.txt' -> `output/FOG.201305.Run01/trajectory_msm_3d_backward.namelist.FOG.201305.Run01.Traj01.txt'
`list_infile_FOG.201305.Run01.Traj01.txt' -> `output/FOG.201305.Run01/list_infile_FOG.201305.Run01.Traj01.txt'
$ tree output
output
|-- BFZ201105.Run02
| |-- BFZ201105.Run02.Stage2.Traj05.txt
| |-- list_infile_BFZ201105.Run02.Stage2.Traj05.txt
| `-- trajectory_msm_3d_backward.namelist.BFZ201105.Run02.Stage2.Traj05.txt
`-- FOG.201305.Run01
|-- FOG.201305.Run01.Traj01.txt
|-- list_infile_FOG.201305.Run01.Traj01.txt
`-- trajectory_msm_3d_backward.namelist.FOG.201305.Run01.Traj01.txt
$ cat pl.traj.xyz.color.symbol_sst.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work1/am/TRAJECTORY/Runge.Kutta
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 16:44 on 01-08-2015.
usage(){
cat <<EOF
Usage: $0 [-h][-d <header>][-i <interval>][-t <int_time>]
-h : print this help message
header: number of header lines in input files.
interval: time interval for ploting symbols showing the location of parcels.
int_time: time interval for dipicting date and time.
Default values are:
header= $header
interval= $interval
int_time= $int_time
EOF
}
. ./gmtpar.sh
echo "Bash script $0 starts."
sst_dir=~/MGDSST
sst_file=mgd_sst_glb_D20130525_gmt.txt #mgdsst.20130526.txt
prefix=FOG.201305
run_number=Run01
input_file_prefix=${prefix}.${run_number}
indir="output/${prefix}.${run_number}"
input_list="\
${indir}/${input_file_prefix}.Traj01.txt \
"
#default values
header=3
interval=6
int_time=18
justify=CT #http://homepage1.nifty.com/~kdo/gmt10_pstext.html
latoff=0.3
# Command line option
while getopts d:i:t:h OPT
do
case $OPT in
"d" ) FLG_D="TRUE" ; header="$OPTARG" ;;
"i" ) FLG_I="TRUE" ; interval="$OPTARG" ;;
"t" ) FLG_t="TRUE" ; int_time="$OPTARG" ;;
"h" ) FLG_H="TRUE" ; usage ; exit 0
esac
done
xrange=122/135
yrange=22/32
zrange=900/1000
figdir="./fig/"
if [ ! -d ${figdir} ];then
mkdir -p $figdir
fi
out=${figdir}${input_file_prefix}_xyz_sst.ps
range=${xrange}/${yrange}
size=132.5/5
xanot=a2f1
yanot=a2f1
anot=${xanot}/${yanot}WsNe
input=${sst_dir}/${sst_file}
grd=$(basename ${input} .txt).grd
awk '{print $1,$2,$3-273.15}' $input |\
surface -R$range -T0.5 -I0.03125 -G$grd
grdcontour $grd -R$range -JQ$size -W3 -C1 -A2f12 -G1/2 -L0/23 \
-Gl123/24/123/35 \
-X2 -Y4 -P -K > $out
grdcontour $grd -R$range -JQ$size -W6 -C1 -A2f12 -G1/2 -L23.9/24.1 \
-Gl123/24/123/35 \
-O -K >> $out
grdcontour $grd -R$range -JQ$size -W3 -C1 -A2f12 -G1/2 -L25/35 \
-Gl123/24/123/35 \
-O -K >> $out
pscoast -R$range -JQ$size -Di -W3 -G200 -O -K >> $out
for input in $input_list; do
in=$input
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
echo Input : $in
if [ $(echo ${input} |grep Stage1) ]; then
color=${orange}
elif [ $(echo ${input}|grep Stage2) ]; then
color=${purple}
else
color=${blue}
fi
if [ $(echo ${input} |grep Traj01) ]; then
symbol=a
elif [ $(echo ${input}|grep Traj02) ]; then
symbol=c
elif [ $(echo ${input}|grep Traj03) ]; then
symbol=d
elif [ $(echo ${input}|grep Traj04) ]; then
symbol=s
elif [ $(echo ${input}|grep Traj05) ]; then
symbol=t
else
symbol=i
fi
awk -v h=$header -v i=$interval \
'{if($1!="#" && ((NR-h)%i==1)) print $11,$12}' $in|\
psxy -R$range -JQ$size -S${symbol}0.08 -G${white} -O -K >>$out
awk -v h=$header -v i=$interval \
'{if($1!="#" && ((NR-h)%i==1)) print $11,$12}' $in|\
psxy -R$range -JQ$size -S${symbol}0.07 -G0${color} -O -K >>$out
awk -v h=$header -v i=$interval \
'{if($1!="#" && ((NR-h)%i==1)) print $11,$12}' $in|\
psxy -R$range -JQ$size -S${symbol}0.07 -W1 -O -K >>$out
done
mmm[0]=Jan
mmm[1]=Feb
mmm[2]=Mar
mmm[3]=Apr
mmm[4]=May
mmm[5]=Jun
mmm[6]=Jul
mmm[7]=Aug
mmm[8]=Sep
mmm[9]=Oct
mmm[10]=Nov
mmm[11]=Dec
for input in $input_list; do
if [ $(echo ${input} |grep "Traj01") ]; then
temp1=$(basename $0 .sh)_temp1.txt
temp2=$(basename $0 .sh)_temp2.txt
temp3=$(basename $0 .sh)_temp3.txt
in=$input
awk -v h=$header -v i=$int_time \
'{if($1!="#" && ((NR-h)%i==1)) \
printf "%12.5f %11.5f 9 0 0 MC %2.2d %2.2d %2.2d %2.2d\n", \
$11,$12,$5,$6,$3,$4}' $in > $temp1
echo "# ">$temp2
echo "# ">$temp3
while read BUF ; do
ary=(`echo $BUF`) # 配列に格納
lon=${ary[0]}
lat=${ary[1]}
fsiz=${ary[2]}
angl=${ary[3]}
font=${ary[4]}
jtfy=${ary[5]}
hh=${ary[6]}
mi=${ary[7]}
mo=${ary[8]}
dd=${ary[9]}
idx=$(expr $mo - 1)
latoff=$(echo "scale=5; $lat-${latoff}"|bc)
echo $lon $lat ${fsiz} $angl 0 ${justify} ${hh}${mi}UTC >> $temp2
echo $lon $latoff ${fsiz} $angl 0 ${justify} $dd${mmm[$idx]} >> $temp2
echo $lon $lat ${fsiz} $angl 0 ${justify} ${hh}${mi}UTC >> $temp3
echo $lon $latoff ${fsiz} $angl 0 ${justify} $dd${mmm[$idx]} >> $temp3
done < $temp1
if [ $(echo ${input} |grep "Stage1") ]; then
offset=-0.2
else
offset=0.7
fi
pstext $temp2 -R$range -JQ$size -G${white} -S20,${white} -D${offset}/0 -O -K >>$out
pstext $temp3 -R$range -JQ$size -G${black} -D${offset}/0 -O -K >>$out
rm -v $temp1 $temp2 $temp3
fi
done
psbasemap -R$range -JQ$size -B$anot -O -K >> $out
range=${xrange}/${zrange}
size=5/-2
xanot=a2f1
yanot=a50f10
anot=${xanot}:"Longitude":/${yanot}:"P${sp}[hPa]":WSne
psbasemap -R$range -JX$size -B$anot -X0 -Y-2.5 -O -K >> $out
for input in $input_list; do
in=$input
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
echo Input : $in
if [ $(echo ${input}|grep Stage1) ]; then
color=${orange}
elif [ $(echo ${input}|grep Stage2) ]; then
color=${purple}
fi
if [ $(echo ${input} |grep Traj01) ]; then
symbol=a
elif [ $(echo ${input}|grep Traj02) ]; then
symbol=c
elif [ $(echo ${input}|grep Traj03) ]; then
symbol=d
elif [ $(echo ${input}|grep Traj04) ]; then
symbol=s
elif [ $(echo ${input}|grep Traj05) ]; then
symbol=t
fi
awk -v h=$header -v i=$interval \
'{if($1!="#" && ((NR-h)%i==1)) print $11,$13}' $in|\
psxy -R$range -JX$size -S${symbol}0.07 -G${color} -O -K >> $out
awk -v h=$header -v i=$interval \
'{if($1!="#" && ((NR-h)%i==1)) print $11,$13}' $in|\
psxy -R$range -JX$size -S${symbol}0.07 -W1 -O -K >>$out
done
echo Output : $out
pstext <<EOF -R0/8.3/0/11.7 -JX8.3i/11.7i -X-2 -Y-2 -O -K >>$out
.5 9 30 0 0 LM (a)
.5 4 30 0 0 LM (b)
EOF
xoffset=2
yoffset=11
comment=
in=$input_file_prefix
. ./note.sh
#rm -vf $grd
echo "Done $0"
$ pl.traj.xyz.color.symbol_sst.sh
Bash script ./pl.traj.xyz.color.symbol_sst.sh starts.
Input : output/FOG.201305.Run01/FOG.201305.Run01.Traj01.txt
removed `pl.traj.xyz.color.symbol_sst_temp1.txt'
removed `pl.traj.xyz.color.symbol_sst_temp2.txt'
removed `pl.traj.xyz.color.symbol_sst_temp3.txt'
Input : output/FOG.201305.Run01/FOG.201305.Run01.Traj01.txt
Output : ./fig/FOG.201305.Run01_xyz_sst.ps
ls: FOG.201305.Run01: No such file or directory
pstext: Record 6 is incomplete (skipped)
Done ./pl.traj.xyz.color.symbol_sst.sh
$ cd ..
後方流跡線に沿ったフラックスの計算
MSM地表面データのサンプリング
$ cat sampling.alongtrack_run.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work2/kunoki/to_manda_sensei/Tools/MGDSST.AlongTrack
#
# Revision history:
# This file is created by /usr/local/mybin/nbscr.sh at 17:28 on 09-11-2014.
#echo "Shell script, $(basename $0) starts."
#echo
exe=sampling.alongtrack
namelist=${exe}.namelist.txt
prefix=FOG.201305
run_number=Run01
traj=Traj01
yyyy=2013
indir=../MSM.3D.Backward/output/${prefix}.${run_number}
infle=${indir}/${prefix}.${run_number}.${traj}.txt
if [ ! -f $infle ]; then
echo
echo Error in $0: No such file:
echo ${infle}
echo
exit 1
fi
odir=output
mkdir -vp $odir
ofle=${odir}/${prefix}.${run_number}.${traj}_MSMS.txt
msm_dir=/work4/DATA/MSM/MSM-S/${yyyy}/
msm_postfix=.nc
undef=-999.
tdh=0 # Time difference between LST and UTC
nt=73 # Number of data in infle
nheader=3 # Number of header lines in infle
cat <<EOF >$namelist
¶
infle="$infle",
ofle="$ofle",
msm_dir="$msm_dir",
msm_postfix="$msm_postfix",
undef=${undef}
tdh=${tdh}
&end
EOF
if [ ! -f $exe ]; then
echo Error in $0: No such file, $exe
exit 1
fi
${exe} < $namelist
echo
echo "Done $(basename $0)"
echo
echo Output: $ofle
echo
exit 0
$ sampling.alongtrack_run.sh
Input : ../MSM.3D.Backward/output/FOG.201305.Run01/FOG.201305.Run01.Traj01.txt
Output: output/FOG.201305.Run01.Traj01_MSMS.txt
nt= 73
...
... Lots of messages
...
Done sampling.alongtrack_run.sh
Output: output/FOG.201305.Run01.Traj01_MSMS.txt
$ cd ..
MGDSSTデータのサンプリング
$ cd MGDSST.Trajectory/
$ cat MGDSST.Back.Trajectory_run.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work2/kunoki/to_manda_sensei/Tools/MGDSST.AlongTrack
#
# Revision history:
# This file is created by /usr/local/mybin/nbscr.sh at 17:28 on 09-11-2014.
exe=MGDSST.Back.Trajectory
namelist=${exe}.namelist.txt
prefix=FOG.201305
run_number=Run01
traj=Traj01
yyyy=2013
indir=../MSM.3D.Backward/output/${prefix}.${run_number}
infle=${indir}/${prefix}.${run_number}.${traj}.txt
odir=output
mkdir -vp $odir
ofle=${odir}/${prefix}.${run_number}.MGDSST.${traj}.txt
mgd_dir=/work4/DATA/SST/MGDSST/data/${yyyy}/
if [ ! -d $mgd_dir ]; then
echo
Error in $0 : No such directory, $mgd_dir
echo
exit 1
fi
mgd_prefix=mgd_sst_glb_D #re_mgd_sst_glb_D
mgd_postfix=txt
nlon=1440
nlat=720
slon=0.125
slat=-89.875
dlon=0.25
dlat=0.25
undef=-999.
tdh=0. # Time difference (e.g., JST->tdh=+9, UTC->tdh=0)
cat <<EOF >$namelist
¶
infle="$infle",
ofle="$ofle",
mgd_dir="$mgd_dir",
mgd_prefix="$mgd_prefix",
mgd_postfix="$mgd_postfix",
undef=$undef
tdh=$tdh
&end
&grid
nlon=$nlon
nlat=$nlat
slon=$slon
slat=$slat
dlon=$dlon
dlat=$dlat
&end
EOF
if [ ! -f $exe ]; then
echo Error in $0 : No such file, $exe.
exit 1
fi
${exe} < $namelist
echo
echo Output: $ofle
echo
echo "Done $(basename $0)"
echo
$ MGDSST.Back.Trajectory_run.sh
Input : ../MSM.3D.Backward/output/FOG.201305.Run01/FOG.201305.Run01.Traj01.txt
Output: output/FOG.201305.Run01.MGDSST.Traj01.txt
0.1250000 359.8750
-89.87500 89.87500
nt= 73
2013 05 26
...
... Lots of messages
...
Output: output/FOG.201305.Run01.MGDSST.Traj01.txt
Done MGDSST.Back.Trajectory_run.sh
$ cd ..
フラックスの計算
$ cd MSM_FLUX/
$ cat msm_flux_run.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work1/am/Sato.Kodama.Manda2015
#
# Revision history:
# This file is created by /usr/local/mybin/nbscr.sh at 14:12 on 01-28-2015.
exe=msm_flux
namelist=$exe.namelist.txt
prefix=FOG.201305
run_number=Run01
traj=Traj01
indir1=../MGDSST.Trajectory/output
infle1=${indir1}/${prefix}.${run_number}.MGDSST.${traj}.txt
if [ ! -f $infle1 ]; then
echo
echo Error in $0: No such file:
echo ${infle1}
echo
exit 1
fi
indir2=../MSM.Surface.Trajectory/output
infle2=${indir2}/${prefix}.${run_number}.${traj}_MSMS.txt
if [ ! -f $infle2 ]; then
echo
echo Error in $0: No such file:
echo ${infle2}
echo
exit 1
fi
odir=output
mkdir -vp $odir
ofle=${odir}/${prefix}.${run_number}.${traj}_FLUX.txt
dt=10 # time interval of input data [minute]
cat <<EOF >$namelist
¶
infle1="${infle1}"
infle2="${infle2}"
ofle="${ofle}"
dt=${dt}
&end
EOF
if [ ! -f $exe ]; then
echo
echo Error in $0: No such file, $exe
echo
exit 1
fi
echo
${exe} < $namelist
echo
echo Output: $ofle
echo
$ msm_flux_run.sh
Input : ../MGDSST.Trajectory/output/FOG.201305.Run01.MGDSST.Traj01.txt
Input : ../MSM.Surface.Trajectory/output/FOG.201305.Run01.Traj01_MSMS.txt
Output: output/FOG.201305.Run01.Traj01_FLUX.txt
nt= 73
Output: output/FOG.201305.Run01.Traj01_FLUX.txt
$ cd ..
後方流跡線に沿ったバーチャルサウンディング
$ cd MSM.Profiles.Trajectory
$ msm_profiles_trajectory_run.sh
You may need to modify the lines marked by red.
#!/bin/bash
exe=$(basename $0 _run.sh)
if [ ! -f $exe ]; then
echo Error in $0: No such file, $0
exit 1
fi
prefix=FOG.201305
run_number=Run01
traj=Traj01
in_dir_trajectory=../MSM.3D.Backward/output/${prefix}.${run_number}
in_file_trajectory=${in_dir_trajectory}/${prefix}.${run_number}.${traj}.txt #${run_number}.${stage}.${traj}.txt
in_dir_msm_p=/work4/DATA/MSM/MSM-P
in_dir_msm_s=/work4/DATA/MSM/MSM-S
out_dir_stn=output/${prefix}
namelist=${exe}.namelist.txt
if [ ! -f $in_file_trajectory ]; then
echo
echo Error in $0: No such file:
echo $in_file_trajectory
echo
exit 1
fi
if [ ! -d $in_dir_msm_p ]; then
echo
echo Error in $0: No such directory, $in_dir_msm_p
echo
exit 1
fi
if [ ! -d $in_dir_msm_s ]; then
echo
echo Error in $0: No such directory, $in_dir_msm_s
echo
exit 1
fi
mkdir -vp $out_dir_stn
cat <<EOF >$namelist
&input
prefix="${prefix}.${traj}",
in_file_trajectory="${in_file_trajectory}",
in_dir_msm_p="${in_dir_msm_p}",
in_dir_msm_s="${in_dir_msm_s}",
&end
&output
out_dir_stn="${out_dir_stn}"
&end
EOF
$exe < $namelist
$ msm_profiles_trajectory_run.sh
mkdir: created directory `output/FOG.201305'
Open ../MSM.3D.Backward/output/FOG.201305.Run01/FOG.201305.Run01.Traj01.txt
...
... Lots of messages
...
Output: output/FOG.201305/FOG.201305.Traj01_20130525_210000.txt
$ ls output/FOG.201305/ |head
FOG.201305.Traj01_20130525_210000.txt
FOG.201305.Traj01_20130525_211000.txt
FOG.201305.Traj01_20130525_212000.txt
FOG.201305.Traj01_20130525_213000.txt
FOG.201305.Traj01_20130525_214000.txt
FOG.201305.Traj01_20130525_215000.txt
FOG.201305.Traj01_20130525_220000.txt
FOG.201305.Traj01_20130525_221000.txt
FOG.201305.Traj01_20130525_222000.txt
FOG.201305.Traj01_20130525_223000.txt
$ cd ..
作図
$ cd MSM.Trajectory.Time-Height
$ cat merge.profiles.sh
You may need to modify the lines marked by red.
#!/bin/sh
prefix=FOG.201305
run_number=Run01
traj=Traj01
indir0=../MSM.Profiles.Trajectory/output/
indir=${indir0}/${prefix}
list_input=$(ls ${indir}/${prefix}.${traj}* )
out=${prefix}.${run_number}.${traj}.Time-Height.txt
n=0
et=0 # Elapsed time in hour
dt=10.0 # Time ncrement in minute
for input in $list_input; do
n=$(expr $n + 1)
et=$(echo "scale=3 ;($n - 1)*$dt/60.0"|bc)
echo $et $(basename $input)
if [ $n -eq 1 ]; then
awk '{if ($2=="trajectory=") print $0}' $input > $out
awk '{if ($2=="p[hPa]") print "# et yyyy mm dd hh mi lon lat ", $0}' $input >> $out
fi
yyyy=$(awk '{if (NR==4) printf "%4d", $2}' $input )
mm=$(awk '{if (NR==4) printf "%4d", $3}' $input )
dd=$(awk '{if (NR==4) printf "%4d", $4}' $input )
hh=$(awk '{if (NR==4) printf "%4d", $5}' $input )
mi=$(awk '{if (NR==4) printf "%4d", $6}' $input )
lon=$(awk '{if ($2=="lon=") print $3}' $input )
lat=$(awk '{if ($2=="lat=") print $3}' $input )
numLine=1
cat $input | while read line
do
if [ ${line:0:1} != "#" ]; then
printf "%8.3f %4d %2.2d %2.2d %2.2d %2.2d %10.5f %9.5f \
%8.2f %8.1f %6.1f %6.1f %9.3f %6.1f %9.3f %9.3f %9.3f %11.5f %11.5f %11.5f\n" \
$et $yyyy $mm $dd $hh $mi $lon $lat $line >> $out
numLine=$((numLine + 1))
fi
done
done
echo
echo Done $(basename $0)
echo
echo "Output: $out"
echo
exit 0
$ ./merge.profiles.sh
0 FOG.201305.Traj01_20130525_210000.txt
.166 FOG.201305.Traj01_20130525_211000.txt
...
... Lots of messages
...
Done merge.profiles.sh
Output: FOG.201305.Run01.Traj01.Time-Height.txt
$ cat pl.traj.time-height.sh
You may need to modify the lines marked by red.
#!/bin/bash
# Description:
#
# Author: kunoki
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work2/kunoki/to_manda_sensei/Tools/MSM.Back.Trajectory.Time-Hight
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 14:10 on 10-18-2014.
prefix=FOG.201305
run_number=Run01
traj=Traj01
range_t=2013-05-25T12:00/2013-05-26T09:00/0/10
xrange=0/12
xsize=4.5
in=${prefix}.${run_number}.${traj}.Time-Height.txt
if [ ! -f $in ]; then
echo
echo Error in $0: No such file, $in
echo
exit 1
fi
indir2=../MSM_FLUX/output/
in2=${indir2}/${prefix}.${run_number}.${traj}_FLUX.txt
if [ ! -f $in2 ]; then
echo
echo Error in $0: No such file, $in2
echo
exit 1
fi
. ./gmtpar.sh
gmtset ANOT_FONT_SIZE 16
date_format= #"INPUT_DATE_FORMAT yyyy-mm-dd"
clock_format= #"INPUT_CLOCK_FORMAT hh:mm"
gmtset PLOT_DATE_FORMAT "o dd"
plot_clock_format="PLOT_CLOCK_FORMAT hh:mm"
gmtset $date_format $clock_format $plot_clock_format
xanot=a3f3:[hr]:
yanot=a500f100:[m]:
anot0=${xanot}/${yanot}Wsne
yanot=a1000f1000:[m]:
anot1=${xanot}/${yanot}Wsne
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
if [ ! -f $in2 ]; then
echo Error in $0 : No such file, $in2
exit 1
fi
#${figdir}
out=$(basename $in .txt).ps
grd=$(basename $in .txt).grd
size=${xsize}/2.25
xanot1=pa3hf3h #per 3 hrs for primary x-axis
xanot2=sa1D #per 1day for secondary x-axis
anot1=-B${xanot1}/${yanot}S
anot2=-B${xanot2}/${yanot}S
psbasemap -R$range_t -JX$size -Bpa6Hf3h -Bsa1DS -P -X2 -Y1.4 -K > $out
range=${xrange}/0/15
size=${xsize}/1
anot=${xanot}/a5f5:"W@-@-s${sp}[ms@+-1@+]":Wsne
awk '{if($1!="#")print $1,sqrt($12*$12+$13*$13)}' $in2|
psxy -R$range -JX$size -B$anot -W5/${black} -Y0.2 -O -K >> $out
range=${xrange}/23/28
size=${xsize}/1
anot=${xanot}/a2f1:"T${sp}[${deg}C]":Wsn
awk '{if($1!="#")print $1,$10-273.15}' $in2|
psxy -R$range -JX$size -B$anot -W5/${blue} -Y1.5 -O -K >> $out
awk '{if($1!="#")print $1,$14-273.15}' $in2|
psxy -R$range -JX$size -W5/${red} -Y0 -O -K >> $out
range=${xrange}/-2/3
size=${xsize}/1
anot=${xanot}/a2f1:"SST-SAT${sp}[${deg}C]":E
awk '{if($1!="#")print $1,$14-$10}' $in2|
psxy -R$range -JX$size -B$anot -W6/${black} -O -K >> $out
psxy <<EOF -R -JX -W2${dash} -O -K >> $out
-5000 0
5000 0
EOF
range=${xrange}/25/45
size=${xsize}/1
anot=${xanot}/a5f5:"e${sp}[hPa]":Wsn
awk '{if($1!="#")print $1,$22}' $in2|
psxy -R$range -JX$size -B$anot -W5/${blue} -Y1.5 -O -K >> $out
awk '{if($1!="#")print $1,$23}' $in2|
psxy -R$range -JX$size -W5/${red} -Y0 -O -K >> $out
range=${xrange}/-1/9
size=${xsize}/1
anot=${xanot}/a3f1:"e@-s@--e${sp}[hPa]":E
awk '{if($1!="#")print $1,$23-$22}' $in2|
psxy -R$range -JX$size -B$anot -W6/${black} -O -K >> $out
psxy <<EOF -R -JX -W2${dash} -O -K >> $out
-5000 0
5000 0
EOF
range=${xrange}/-20/100
size=${xsize}/1
anot=${xanot}/a50f10:"Flux${sp}[Wm@+-2@+]":Wsne
awk '{if($1!="#")print $1,$15}' $in2|
psxy -R$range -JX$size -W3/${red} -Y1.5 -O -K >> $out
awk '{if($1!="#")print $1,$16}' $in2|
psxy -R$range -JX$size -W6/${orange} -Y0 -O -K >> $out
awk '{if($1!="#")print $1,$15+$16}' $in2|
psxy -R$range -JX$size -B$anot -W5/${black} -Y0 -O -K >> $out
range2=${xrange}/-100/6000
size=${xsize}/2.25
awk '{if($1!="#" && $18 > 0)print $1,$10,$18*1000}' $in |
surface -R$range2 -T1 -I0.2/50 -G$grd
#.5
cpt=$(basename $in .txt).cpt
makecpt -Cjet -T12/22/1 >$cpt
# 10/20/1
range=${xrange}/0/1000
grdimage $grd -R$range -JX$size -C$cpt -O -K -X0 -Y1.5 >> $out
psscale -D5/1/1.5/0.1 -E -Ba5f1/:"g/kg": -C$cpt -O -K >> $out
awk '{if($1!="#" && $17 < 360 && $17 > 0)print $1,$10,$17}' $in |
surface -R$range2 -T1 -I0.2/50 -G$grd
grdcontour $grd -R$range -JX$size -W10/${white} -C2 -O -K >> $out
grdcontour $grd -R$range -JX$size -W3/${black} -C2 -O -K >> $out
grdcontour $grd -R$range -JX$size -W3/${black} -A4f12 -G2/2 -O -K >> $out
psbasemap -R$range0 -JX -B$anot0 -O -K >> $out
size=${xsize}/2.25
psbasemap -R$range_t -JX$size -Bpa6Hf3h -Bsa1DN -O -K -Y0.2 >> $out
pstext <<EOF -R0/8.3/0/11.7 -JX8.3i/11.7i -X-2 -Y-8.2 -O -K >>$out
.5 10.3 20 0 0 LM (a)
.5 7.5 20 0 0 LM (b)
.5 6 20 0 0 LM (c)
.5 4.5 20 0 0 LM (d)
.5 3 20 0 0 LM (e)
EOF
xoffset=2
yoffset=10.8
comment=
. ./note.sh
echo
rm -v $cpt $grd $xyz $grdr
echo
echo "Done $0"
echo
echo Input : $in
echo
echo Output : $out
echo
$ pl.traj.time-height.sh
pstext: Record 6 is incomplete (skipped)
removed `FOG.201305.Run01.Traj01.Time-Height.cpt'
removed `FOG.201305.Run01.Traj01.Time-Height.grd'
Done ./pl.traj.time-height.sh
Input : FOG.201305.Run01.Traj01.Time-Height.txt
Output : FOG.201305.Run01.Traj01.Time-Height.ps