[2017年 1月 11日 水曜日 09:49:40 JST]
[~/2016.PolarLow/Ship.XCTD.GMT.raw]
[am@aofd165]
$ srcdump.sh xctd*sh etime.f90 time-depth* gmtpar* note* >temp.txt
------------------------------
List of the following files:
------------------------------
xctd.edit.sh
xctd.serial.number.sh
xctd.sst.sh
xctd.time-depth_obs.run.sh
xctd.vint.sh
etime.f90
time-depth.S.gmt.sh
time-depth.gmt.sh
time-depth.sst.gmt.sh
gmtpar.sh
note.sh
------------------------------
Machine info
------------------------------
aofd165.bio.mie-u.ac.jp
/work1/am/2016.PolarLow/Ship.XCTD.GMT.raw
Wed Jan 11 09:49:59 JST 2017
======================
xctd.edit.sh
======================
#!/bin/bash
indir=/work4/data/Field.Observation/PL1101/Ship/201101_xctd
filename1=jh2011-01_*[0-9].ctd
filelist=$(ls -1 ${indir}/${filename1})
list_serial_number=$(basename $0 .sh).list.sn.txt
rm ${list_serial_number}
for file in $filelist; do
sn=$(awk '{if (NR==1) print $1}' $file)
echo $sn $file >> ${list_serial_number}
done
list_stn=/work4/data/Field.Observation/PL1101/Ship/\
JH_2011_XCTD_list.txt
outdir=Data_xctd_edit
mkdir -vp $outdir
dz_fine=0.1
mz_fine=100
dz_coarse=1.0
mz_coarse=1000
nml=$(basename $0 .sh).namelist.txt
src=$(basename $0 .sh).f90
exe=$(basename $0 .sh).exe
err=$(basename $0 .sh).err
fort=ifort
opt="-CB -traceback -fpe0 -assume byterecl"
temp=$(basename $src .f90)
prog_name=$(echo $temp| sed -e 's/\./_/g')
echo Compiling ${src} ...
${fort} ${opt} ${src} -o ${exe}
if [ $? -ne 0 ]; then
echo
echo Compile error!
echo
echo Terminated.
echo
exit 1
fi
echo "Done Compile ${src}."
ls -lh ${exe}
echo
src2=etime.f90
exe2=$(basename $src2 .f90).exe
err2=$(basename $src2 .f90).err
echo Compiling ${src2} ...
${fort} ${opt} ${src2} -o ${exe2}
if [ $? -ne 0 ]; then
echo
echo Compile error!
echo
echo Terminated.
echo
exit 1
fi
echo "Done Compile ${src2}."
ls -lh ${exe2}
echo
sdate=20110118 # yyyymmdd
stime=000000 # hhmmss
interpolator="xctd.vint.sh"
if [ ! -f $interpolator ]; then
echo
echo Error in $0: No such file, $interpolator
echo
echo Terminated.
echo
fi
out_fine=${outdir}/xctd_fine.txt
out_coarse=${outdir}/xctd_coarse.txt
rm -vf $out_fine; touch $out_fine
rm -vf $out_coarse; touch $out_coarse
while read BUF ; do
ary=(`echo $BUF`) # 配列に格納
sn=${ary[0]}
file=${ary[1]}
echo $sn $file
stn=$(grep $sn ${list_stn} | \
awk '{print $2 }')
yyyy=$(grep $sn ${list_stn} | \
awk '{print $4 }')
mm=$( grep $sn ${list_stn} | \
awk '{print $5 }')
dd=$( grep $sn ${list_stn} | \
awk '{print $6 }')
hh=$( grep $sn ${list_stn} | \
awk '{print $7 }')
nn=$( grep $sn ${list_stn} | \
awk '{print $8 }')
latd=$( grep $sn ${list_stn} | \
awk '{print $9 }')
latm=$( grep $sn ${list_stn} | \
awk '{print $10 }')
lond=$( grep $sn ${list_stn} | \
awk '{print $11}')
lonm=$( grep $sn ${list_stn} | \
awk '{print $12}')
depth=$( grep $sn ${list_stn} | \
awk '{print $14}')
intpl_fine=${outdir}/intpl_fine_$(basename $file .ctd).txt
intpl_coarse=${outdir}/intpl_coarse_$(basename $file .ctd).txt
${interpolator} $file $intpl_fine $dz_fine ${mz_fine}
${interpolator} $file $intpl_coarse $dz_coarse ${mz_coarse}
date=${yyyy}${mm}${dd}
time=${hh}${nn}00
${exe2} ${sdate} ${stime} ${date} ${time} > /dev/null
if [ $? -ne 0 ]; then
Error in ${etime}
echo ${sdate} ${stime} ${date} ${time}
exit 1
fi
elptime=$(${exe2} ${sdate} ${stime} ${date} ${time})
# echo $elptime
cat <<EOF>$nml
¶
infle="${intpl_fine}",
ofle="${out_fine}",
mz=${mz_fine},
depth=${depth},
yyyy=${yyyy},
mm=${mm},
dd=${dd},
hh=${hh},
nn=${nn},
sdate=${sdate},
stime=${stime},
elptime=${elptime},
lond=${lond}
lonm=${lonm}
latd=${latd}
latm=${latm}
&end
EOF
echo $stn $sn $yyyy $mm $dd $hh $nn $lond $lonm $latd $latm $depth
${exe} <${nml}
cat <<EOF>$nml
¶
infle="${intpl_coarse}",
ofle="${out_coarse}",
mz=${mz_coarse},
depth=${depth},
yyyy=${yyyy},
mm=${mm},
dd=${dd},
hh=${hh},
nn=${nn}
sdate=${sdate},
stime=${stime},
elptime=${elptime},
lond=${lond}
lonm=${lonm}
latd=${latd}
latm=${latm}
&end
EOF
echo $stn $sn $yyyy $mm $dd $hh $nn $lond $lonm $latd $latm $depth
${exe} <${nml}
done < ${list_serial_number}
exit 0
----------------------
End of xctd.edit.sh
----------------------
======================
xctd.serial.number.sh
======================
#!/bin/bash
indir=/work4/data/Field.Observation/PL1101/Ship/201101_xctd
filename1=jh2011-01_0*_1m.CTD
filename2=jh2011-01_0*_1m.ctd
filelist=$(ls -1 ${indir}/${filename1} ${indir}/${filename2})
for file in $filelist; do
awk '{if (NR==1) print $1}' $file
done
----------------------
End of xctd.serial.number.sh
----------------------
======================
xctd.sst.sh
======================
#!/bin/bash
######################################
indir=/work4/data/Field.Observation/PL1101/Ship/201101_xctd
list_stn=/work4/data/Field.Observation/PL1101/Ship/\
JH_2011_XCTD_list.txt
sdate=20110118 # yyyymmdd
stime=000000 # hhmmss
dz_fine=0.1
mz_fine=100
dz_coarse=1.0
mz_coarse=1000
outdir=Data_xctd_edit
######################################
filename1=jh2011-01_*[0-9].ctd
filelist=$(ls -1 ${indir}/${filename1})
list_serial_number=$(basename $0 .sh).list.sn.txt
rm ${list_serial_number}
for file in $filelist; do
sn=$(awk '{if (NR==1) print $1}' $file)
echo $sn $file >> ${list_serial_number}
done
mkdir -vp $outdir
nml=$(basename $0 .sh).namelist.txt
src=$(basename $0 .sh).f90
exe=$(basename $0 .sh).exe
err=$(basename $0 .sh).err
fort=ifort
opt="-CB -traceback -fpe0 -assume byterecl"
temp=$(basename $src .f90)
prog_name=$(echo $temp| sed -e 's/\./_/g')
echo Compiling ${src} ...
${fort} ${opt} ${src} -o ${exe}
if [ $? -ne 0 ]; then
echo
echo Compile error!
echo
echo Terminated.
echo
exit 1
fi
echo "Done Compile ${src}."
ls -lh ${exe}
echo
src2=etime.f90
exe2=$(basename $src2 .f90).exe
err2=$(basename $src2 .f90).err
echo Compiling ${src2} ...
${fort} ${opt} ${src2} -o ${exe2}
if [ $? -ne 0 ]; then
echo
echo Compile error!
echo
echo Terminated.
echo
exit 1
fi
echo "Done Compile ${src2}."
ls -lh ${exe2}
echo
interpolator="xctd.vint.sh"
if [ ! -f $interpolator ]; then
echo
echo Error in $0: No such file, $interpolator
echo
echo Terminated.
echo
fi
out=${outdir}/xctd_sst.txt
rm -vf $out; touch $out
while read BUF ; do
ary=(`echo $BUF`) # 配列に格納
sn=${ary[0]}
file=${ary[1]}
echo $sn $file
stn=$(grep $sn ${list_stn} | \
awk '{print $2 }')
yyyy=$(grep $sn ${list_stn} | \
awk '{print $4 }')
mm=$( grep $sn ${list_stn} | \
awk '{print $5 }')
dd=$( grep $sn ${list_stn} | \
awk '{print $6 }')
hh=$( grep $sn ${list_stn} | \
awk '{print $7 }')
nn=$( grep $sn ${list_stn} | \
awk '{print $8 }')
latd=$( grep $sn ${list_stn} | \
awk '{print $9 }')
latm=$( grep $sn ${list_stn} | \
awk '{print $10 }')
lond=$( grep $sn ${list_stn} | \
awk '{print $11}')
lonm=$( grep $sn ${list_stn} | \
awk '{print $12}')
depth=$( grep $sn ${list_stn} | \
awk '{print $14}')
intpl_fine=${outdir}/intpl_fine_$(basename $file .ctd).txt
${interpolator} $file $intpl_fine $dz_fine ${mz_fine}
date=${yyyy}${mm}${dd}
time=${hh}${nn}00
${exe2} ${sdate} ${stime} ${date} ${time} > /dev/null
if [ $? -ne 0 ]; then
Error in ${etime}
echo ${sdate} ${stime} ${date} ${time}
exit 1
fi
elptime=$(${exe2} ${sdate} ${stime} ${date} ${time})
# echo $elptime
cat <<EOF>$nml
¶
infle="${intpl_fine}",
ofle="${out}",
mz=${mz_fine},
depth=${depth},
yyyy=${yyyy},
mm=${mm},
dd=${dd},
hh=${hh},
nn=${nn},
sdate=${sdate},
stime=${stime},
elptime=${elptime},
lond=${lond}
lonm=${lonm}
latd=${latd}
latm=${latm}
&end
EOF
echo $stn $sn $yyyy $mm $dd $hh $nn $lond $lonm $latd $latm $depth
${exe} <${nml}
done < ${list_serial_number}
exit 0
----------------------
End of xctd.sst.sh
----------------------
======================
xctd.time-depth_obs.run.sh
======================
#!/bin/bash
gs=$(basename $0 .run.sh).gs
if [ ! -f $gs ]; then
echo ERROR in $0: No such file, $gs
exit 1
fi
opt=""
grads -bcp "$gs $opt"
exit 0
----------------------
End of xctd.time-depth_obs.run.sh
----------------------
======================
xctd.vint.sh
======================
#!/bin/bash
# Default values
z0=0 #
dz=0.2 #
nh=1 # Number of header lines
nz=10000
in=$1
out=$2
dz=$3
nz=$4
#echo "$0 Input : $in"
#echo "$0 Output: $out"
#echo "$0 dz=${dz}"
#echo "$0 nz=${nz}"
header=$(awk '{if(NR==1)print $0'} $in)
echo "# $header" > $out
# awk : 必要なデータの抜き出し
#
# sort: 並べ替え
# filter1d: 平滑化
awk -v nh=$nh 'BEGIN{FS=","}{if (NR>nh) print $1,$2,$3,$4,$5,$6}' $in|\
sort -n |\
sample1d -Fl -I$dz -T0 |\
head -${nz} \
>>$out
#filter1d -Fb${dz} -T${z0}/1000/${dz} -N5/0 > $out
----------------------
End of xctd.vint.sh
----------------------
======================
etime.f90
======================
program eltime
! Description:
!
! Author: am
!
! Host: aofd165.fish.nagasaki-u.ac.jp
! Directory: /work1/am/temp/Erapsed.Time
!
! Revision history:
! Created by /usr/local/mybin/nff.sh at 08:38 on 01-29-2015.
character(len=1000)::strm
character(len=8),dimension(2)::yyyymmdd
character(len=6),dimension(2)::hhmmss
integer,dimension(2)::yyyy,mo,dd,hh,mi,ss
integer,dimension(2)::julian
real(8),dimension(2)::timeh
real(8),parameter::d2h=24.d0, m2h=1.d0/60.d0, s2h=1.d0/3600.d0
real(8)::elapsed_time
n=iargc()
if(n==0)then
print '(A)','This program calculates elapsed time in hour.'
call usage()
stop 999
endif
if(n/=4)then
print '(A)','Error: Wrong number of arguments.'
call usage()
stop 999
endif
call getarg(1, yyyymmdd(1))
call getarg(2, hhmmss(1))
call getarg(3, yyyymmdd(2))
call getarg(4, hhmmss(2))
do i=1,2
read(yyyymmdd(i)(1:4),*)yyyy(i)
read(yyyymmdd(i)(5:6),*) mo(i)
read(yyyymmdd(i)(7:8),*) dd(i)
read(hhmmss(i)(1:2),*) hh(i)
read(hhmmss(i)(3:4),*) mi(i)
read(hhmmss(i)(5:6),*) ss(i)
! print '(i4.4,2i2.2,1x,3i2.2)',yyyy(i),mo(i),dd(i),hh(i),mi(i),ss(i)
enddo
do i=1,2
julian(i)=julday(yyyy(i),mo(i),dd(i))
timeh(i)=dble(julian(i))*d2h + dble(hh(i)) + dble(mi(i))*m2h &
& + dble(ss(i))*s2h
enddo
elapsed_time=timeh(2)-timeh(1)
print *,elapsed_time
stop
end program
subroutine caldat(JULIAN,IYYY,MONTH,DD)
INTEGER,intent(in):: JULIAN
integer,intent(out)::IYYY,MONTH,DD
! NAME IN/OUT DESCRIPTION
!
! JULIAN I THE JULIAN DAY
! IYYY O THE YEAR
! MONTH O THE MONTH (1 TO 12)
! DD O THE DAY OF THE MONTH
!
INTEGER IGREG
PARAMETER (IGREG=2299161)
INTEGER JALPHA,JA,JB,JC,JD,JE
!
IF (JULIAN .GE. IGREG) THEN
JALPHA = INT(((JULIAN - 1867216) - 0.25)/36524.25)
JA = JULIAN + 1 + JALPHA - INT(0.25*JALPHA)
ELSE
JA = JULIAN
ENDIF
JB = JA + 1524
JC = INT(6680. + ((JB - 2439870) - 122.1)/365.25)
JD = 365*JC + INT(0.25*JC)
JE = INT((JB - JD)/30.6001)
DD = JB - JD - INT(30.6001*JE)
MONTH = JE - 1
IF (MONTH .GT. 12) MONTH = MONTH - 12
IYYY = JC - 4715
IF (MONTH .GT. 2) IYYY = IYYY - 1
IF (IYYY .LE. 0) IYYY = IYYY - 1
RETURN
end subroutine caldat
INTEGER FUNCTION JULDAY(IYYY,MONTH,DD)
INTEGER:: IYYY,MONTH,DD
!
! NAME IN/OUT DESCRIPTION
!
! IYYY I YEAR
! MONTH I MONTH (1 TO 12)
! DD I DAY OF MONTH
! JULDAY O JULIAN DAY
!
INTEGER IGREG
PARAMETER (IGREG = 15 + 31*(10 + 12*1582))
INTEGER JY,JM,JA
!
IF (IYYY .LT. 0) IYYY = IYYY + 1
IF (MONTH .GT. 2) THEN
JY = IYYY
JM = MONTH + 1
ELSE
JY = IYYY - 1
JM = MONTH + 13
ENDIF
JULDAY = INT(365.25*JY) + INT(30.6001*JM) + DD + 1720995
IF (DD + 31*(MONTH + 12*IYYY) .GE. IGREG) THEN
JA = INT(0.01*JY)
JULDAY = JULDAY + 2 - JA + INT(0.25*JA)
ENDIF
RETURN
end function julday
subroutine usage()
print '(A)','Usage: eltime yyyymmdd1 hhmmss1 yyyymodd2 hhmiss2'
print '(A)','yyyymmdd: 8-digit number representing year, month, day'
print '(A)','hhmmss: 6-digit number representing hour, minute, and second.'
end subroutine
----------------------
End of etime.f90
----------------------
======================
time-depth.S.gmt.sh
======================
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.bio.mie-u.ac.jp
# Directory: /work1/am/2016.PolarLow/Ship.XCTD.GMT.raw
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 12:40 on 01-07-2017.
. ./gmtpar.sh
gmtset PLOT_CLOCK_FORMAT hh
gmtset PLOT_DATE_FORMAT "o dd"
gmtset TIME_FORMAT_SECONDARY abbreviated
gmtset ANOT_FONT_SIZE 12
gmtset LABEL_FONT_SIZE 14
gmtset ANNOT_FONT_SIZE_PRIMARY 10
gmtset ANNOT_FONT_SIZE_SECONDARY 12
echo "Bash script $0 starts."
xrangeC=2011-01-18T00:00:00/2011-01-26T00:00:00
rangeC=${xrangeC}/0/1
xrange=0/8
range1a=${xrange}/0/2
range1b=$range1a
reso1a=0.25/0.1
reso1b=0.25/0.1
size1=JX5/-2
xanot1=a1f1
yanot1=a1f.5
anot1=${xanot1}/${yanot1}:"Depth${sp}[m]":WsNe
cptrange1=20/37/1
range2a=${xrange}/0/1
range2b=$range2a
reso2a=0.125/0.001
reso2b=0.25/0.002
size2=JX5/-3
xanot2=a1f1
yanot2=a.5f.1
anot2=${xanot2}/${yanot2}:"Depth${sp}[km]":Wne
cptrange2=20/37/1
cpttable="seis -I"
indir=/work1/am/2016.PolarLow/Ship.XCTD.GMT.raw/Data_xctd_edit
in1=$indir/xctd_fine.txt
in2=$indir/xctd_coarse.txt
inlist="$in1 $in2"
for file in $inlist; do
if [ ! -f $file ]; then
echo Error in $0 : No such file, $file
exit 1
fi
done
#out=${figdir}$(basename $in1 .txt).ps
out=${figdir}"XCTD_PL1101_S.ps"
#
# T
#
xyz=$(basename $in1 .txt).xyz
grd=$(basename $in1 .txt).grd
awk '{if($1!="#"&&$4>15) print $1/24.0, $2, $4}' $in1|\
blockmean -R$range1a -I$reso1a > $xyz
surface $xyz -R$range1a -I$reso1b -G$grd -T1
cpt=$(basename $in1 .txt).cpt
makecpt -C$cpttable -T$cptrange1 -Z >$cpt
psmask $xyz -R$raneg1b -I$reso1b -$size1 \
-K -P -X1.5 -Y6 >$out
grdimage $grd -R$range1b -$size1 -C$cpt \
-O -K >>$out
grdcontour $grd -R$range1b -$size1 -W4/${white} -C1 -G1/3 \
-O -K >>$out
psmask -C -O -K >>$out
psbasemap -R -$size1 -B$anot1 -O -K >>$out
psscale -D5.2/-.5/2/0.1 -C$cpt -Ba5f1/:"S": -O -K >>$out
rm -vf $cpt $xyz $grd
xyz=$(basename $in2 .txt).xyz
grd=$(basename $in2 .txt).grd
awk '{if($1!="#"&&$4>15) print $1/24.0, $2/1000, $4}' $in2|\
blockmean -R$range2a -I$reso2a > $xyz
#cat $xyz
surface $xyz -R$range2a -I$reso2b -G$grd -T1
cpt=$(basename $in2 .txt).cpt
makecpt -C$cpttable -T$cptrange2 -Z >$cpt
psmask $xyz -R$raneg2b -I$reso2b -$size2 \
-K -O -Y-3.2 >>$out
grdimage $grd -R$range2b -$size2 -C$cpt \
-O -K >>$out
grdcontour $grd -R$range2b -$size2 -W4/${white} -C1 -G1/3 \
-O -K >>$out
psmask -C -O -K >>$out
psbasemap -R -$size2 -B$anot2 -O -K >>$out
#psscale -D5.2/1.5/3/0.1 -C$cpt -Ba5f1/:"${deg}C": -O -K >>$out
psbasemap -R$rangeC -$size2 -Bpa12hf12h/a20f10::S -Bsa1D/f10 \
-Y0 -O -K >> $out
xoffset=
yoffset=7
comment=
in=$in1
. ./note.sh
rm -vf $cpt $xyz $grd
echo
echo "Input : $in1"
echo "Output : $out"
echo
echo "Done $0"
----------------------
End of time-depth.S.gmt.sh
----------------------
======================
time-depth.gmt.sh
======================
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.bio.mie-u.ac.jp
# Directory: /work1/am/2016.PolarLow/Ship.XCTD.GMT.raw
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 12:40 on 01-07-2017.
. ./gmtpar.sh
gmtset PLOT_CLOCK_FORMAT hh
gmtset PLOT_DATE_FORMAT "o dd"
gmtset TIME_FORMAT_SECONDARY abbreviated
gmtset ANOT_FONT_SIZE 12
gmtset LABEL_FONT_SIZE 14
gmtset ANNOT_FONT_SIZE_PRIMARY 10
gmtset ANNOT_FONT_SIZE_SECONDARY 12
echo "Bash script $0 starts."
xrangeC=2011-01-18T00:00:00/2011-01-26T00:00:00
rangeC=${xrangeC}/0/1
xrange=0/8
range1a=${xrange}/0/2
range1b=$range1a
reso1a=0.25/0.1
reso1b=0.25/0.1
size1=JX5/-2
xanot1=a1f1
yanot1=a1f.5
anot1=${xanot1}/${yanot1}:"Depth${sp}[m]":WsNe
cptrange1=-2/12/.5
range2a=${xrange}/0/1
range2b=$range2a
reso2a=0.125/0.001
reso2b=0.25/0.002
size2=JX5/-3
xanot2=a1f1
yanot2=a.5f.1
anot2=${xanot2}/${yanot2}:"Depth${sp}[km]":Wne
cptrange2=-2/12/.5
cpttable="seis -I"
indir=/work1/am/2016.PolarLow/Ship.XCTD.GMT.raw/Data_xctd_edit
in1=$indir/xctd_fine.txt
in2=$indir/xctd_coarse.txt
inlist="$in1 $in2"
for file in $inlist; do
if [ ! -f $file ]; then
echo Error in $0 : No such file, $file
exit 1
fi
done
#out=${figdir}$(basename $in1 .txt).ps
out=${figdir}"XCTD_PL1101_T.ps"
#
# T
#
xyz=$(basename $in1 .txt).xyz
grd=$(basename $in1 .txt).grd
awk '{if($1!="#"&&$3>-2) print $1/24.0, $2, $3}' $in1|\
blockmean -R$range1a -I$reso1a > $xyz
surface $xyz -R$range1a -I$reso1b -G$grd -T1
cpt=$(basename $in1 .txt).cpt
makecpt -C$cpttable -T$cptrange1 -Z >$cpt
psmask $xyz -R$raneg1b -I$reso1b -$size1 \
-K -P -X1.5 -Y6 >$out
grdimage $grd -R$range1b -$size1 -C$cpt \
-O -K >>$out
grdcontour $grd -R$range1b -$size1 -W4/${white} -C1 -G1/3 \
-O -K >>$out
psmask -C -O -K >>$out
psbasemap -R -$size1 -B$anot1 -O -K >>$out
psscale -D5.2/-.5/2/0.1 -C$cpt -Ba5f1/:"${deg}C": -O -K >>$out
rm -vf $cpt $xyz $grd
xyz=$(basename $in2 .txt).xyz
grd=$(basename $in2 .txt).grd
awk '{if($1!="#"&&$3>-2) print $1/24.0, $2/1000, $3}' $in2|\
blockmean -R$range2a -I$reso2a > $xyz
#cat $xyz
surface $xyz -R$range2a -I$reso2b -G$grd -T1
cpt=$(basename $in2 .txt).cpt
makecpt -C$cpttable -T$cptrange2 -Z >$cpt
psmask $xyz -R$raneg2b -I$reso2b -$size2 \
-K -O -Y-3.2 >>$out
grdimage $grd -R$range2b -$size2 -C$cpt \
-O -K >>$out
grdcontour $grd -R$range2b -$size2 -W4/${white} -C1 -G1/3 \
-O -K >>$out
psmask -C -O -K >>$out
psbasemap -R -$size2 -B$anot2 -O -K >>$out
#psscale -D5.2/1.5/3/0.1 -C$cpt -Ba5f1/:"${deg}C": -O -K >>$out
psbasemap -R$rangeC -$size2 -Bpa12hf12h/a20f10::S -Bsa1D/f10 \
-Y0 -O -K >> $out
xoffset=
yoffset=7
comment=
in=$in1
. ./note.sh
rm -vf $cpt $xyz $grd
echo
echo "Input : $in1"
echo "Output : $out"
echo
echo "Done $0"
----------------------
End of time-depth.gmt.sh
----------------------
======================
time-depth.sst.gmt.sh
======================
#!/bin/bash
# Description:
#
# Author: am
#
# Host: aofd165.bio.mie-u.ac.jp
# Directory: /work1/am/2016.PolarLow/Ship.XCTD.GMT.raw
#
# Revision history:
# This file is created by /usr/local/mybin/ngmt.sh at 12:40 on 01-07-2017.
. ./gmtpar.sh
gmtset PLOT_CLOCK_FORMAT hh
gmtset PLOT_DATE_FORMAT "o dd"
gmtset TIME_FORMAT_SECONDARY abbreviated
gmtset ANOT_FONT_SIZE 12
gmtset LABEL_FONT_SIZE 14
gmtset ANNOT_FONT_SIZE_PRIMARY 10
gmtset ANNOT_FONT_SIZE_SECONDARY 12
echo "Bash script $0 starts."
xrangeC=2011-01-18T00:00:00/2011-01-26T00:00:00
rangeC=${xrangeC}/0/1
xrange=0/8
range1a=${xrange}/0/2
range1b=$range1a
reso1a=0.25/0.1
reso1b=0.25/0.1
size1=JX5/-2
xanot1=a1f1
yanot1=a1f.5
anot1=${xanot1}/${yanot1}:"Depth${sp}[m]":Wsne
cptrange1=-2/12/.5
range2a=${xrange}/0/1
range2b=$range2a
reso2a=0.125/0.001
reso2b=0.25/0.002
size2=JX5/-3
xanot2=a1f1
yanot2=a.5f.1
anot2=${xanot2}/${yanot2}:"Depth${sp}[km]":Wne
cptrange2=-2/12/.5
cpttable="seis -I"
range3=${xrange}/-2/14
size3=JX5/1
xanot3=a1f1
yanot3=a4f2g100
anot3=${xanot3}/${yanot3}:"SST${sp}[${deg}C]":Wsne
indir=/work1/am/2016.PolarLow/Ship.XCTD.GMT.raw/Data_xctd_edit
in1=$indir/xctd_fine.txt
in2=$indir/xctd_coarse.txt
in3=$indir/xctd_sst.txt
inlist="$in1 $in2 $in3"
for file in $inlist; do
if [ ! -f $file ]; then
echo Error in $0 : No such file, $file
exit 1
fi
done
#out=${figdir}$(basename $in1 .txt).ps
out=${figdir}"XCTD_PL1101_T.SST.ps"
#
# T
#
xyz=$(basename $in1 .txt).xyz
grd=$(basename $in1 .txt).grd
awk '{if($1!="#"&&$3>-2) print $1/24.0, $2, $3}' $in1|\
blockmean -R$range1a -I$reso1a > $xyz
surface $xyz -R$range1a -I$reso1b -G$grd -T1
cpt=$(basename $in1 .txt).cpt
makecpt -C$cpttable -T$cptrange1 -Z >$cpt
psmask $xyz -R$raneg1b -I$reso1b -$size1 \
-K -P -X1.5 -Y5 >$out
grdimage $grd -R$range1b -$size1 -C$cpt \
-O -K >>$out
grdcontour $grd -R$range1b -$size1 -W4/${white} -C1 -G1/3 \
-O -K >>$out
psmask -C -O -K >>$out
psbasemap -R -$size1 -B$anot1 -O -K >>$out
psscale -D5.2/-.5/2/0.1 -C$cpt -Ba5f1/:"${deg}C": -O -K >>$out
rm -vf $cpt $xyz $grd
xyz=$(basename $in2 .txt).xyz
grd=$(basename $in2 .txt).grd
awk '{if($1!="#"&&$3>-2) print $1/24.0, $2/1000, $3}' $in2|\
blockmean -R$range2a -I$reso2a > $xyz
#cat $xyz
surface $xyz -R$range2a -I$reso2b -G$grd -T1
cpt=$(basename $in2 .txt).cpt
makecpt -C$cpttable -T$cptrange2 -Z >$cpt
psmask $xyz -R$raneg2b -I$reso2b -$size2 \
-K -O -Y-3.2 >>$out
grdimage $grd -R$range2b -$size2 -C$cpt \
-O -K >>$out
grdcontour $grd -R$range2b -$size2 -W4/${white} -C1 -G1/3 \
-O -K >>$out
psmask -C -O -K >>$out
psbasemap -R -$size2 -B$anot2 -O -K >>$out
#psscale -D5.2/1.5/3/0.1 -C$cpt -Ba5f1/:"${deg}C": -O -K >>$out
psbasemap -R$rangeC -$size2 -Bpa12hf12h/a20f10::S -Bsa1D/f10 \
-Y0 -O -K >> $out
#
# SST
#
awk '{if($1!="#") print $1/24.0, $2}' $in3|\
psxy -R$range3 -$size3 -Sc0.05 -G${red} -B$anot3 \
-Y5.5 -O -K>>$out
xoffset=
yoffset=2
comment=
in=$in1
. ./note.sh
rm -vf $cpt $xyz $grd
echo
echo "Input : $in1"
echo "Output : $out"
echo
echo "Done $0"
----------------------
End of time-depth.sst.gmt.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"
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
----------------------
End of gmtpar.sh
----------------------
======================
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}
----------------------
End of note.sh
----------------------