[2017年 1月 31日 火曜日 16:28:30 JST]
[~/2016.PolarLow/Sonde.Profile.05.PBLH]
[am@aofd165]
$ proc.sonde.pl1101.run.sh
$ grads.bin.pl1101.run.sh 20 20 15000
$ plot.profile.run.sh
$ srcdump.sh proc.sonde.pl1101.run.sh proc.sonde.pl1101.sh grads.bin.pl1101.run.sh grads.bin.pl1101.sh grads.bin.pl1101.gs plot.profile.run.sh plot.profile.gs >tmp.txt
------------------------------
List of the following files:
------------------------------
proc.sonde.pl1101.run.sh
proc.sonde.pl1101.sh
grads.bin.pl1101.run.sh
grads.bin.pl1101.sh
plot.profile.run.sh
plot.profile.gs
------------------------------
Machine info
------------------------------
aofd165.bio.mie-u.ac.jp
/work1/am/2016.PolarLow/Sonde.Profile.05.PBLH
Tue Jan 31 16:32:16 JST 2017
======================
proc.sonde.pl1101.run.sh
======================
#!/bin/bash
exe=$(basename $0 .run.sh).sh
if [ ! -f $exe ]; then
echo Error in $0: No such file, $exe
exit 1
fi
indir=/work4/data/Sonde/PL1101
outdir=output
inlist="\
011800.prn \
011806.prn \
011812.prn \
011818.prn \
011900.prn \
011906.prn \
011912.prn \
011918.prn \
012000.prn \
012006.prn \
012012.prn \
012018.prn \
012100.prn \
012106.prn \
012112.prn \
012118.prn \
012200.prn \
012206.prn \
012212.prn \
012218.prn \
012300.prn \
012306.prn \
012312.prn \
012318.prn \
012400.prn \
012406.prn \
012412.prn \
012418.prn \
012500.prn \
012506.prn \
012512.prn \
012518.prn \
012600.prn \
012606.prn \
012612.prn \
"
nh=39 # Number of header lines in input file
z0=20
dz=20
zmax=15000 #
mkdir -vp ${outdir}
for in in $inlist; do
out=${outdir}/$(basename $in .prn).txt
$exe ${indir}/$in $out $nh $z0 $dz $zmax
done
echo
echo "Input: $in"
echo "Output: $out"
echo "nh=$nh"
echo "z0=$z0"
echo "dz=$dz"
echo "zmax=$zmax"
echo
exit 0
----------------------
End of proc.sonde.pl1101.run.sh
----------------------
======================
proc.sonde.pl1101.sh
======================
#!/bin/bash
# Description:
#
# Author: AM
#
# 明星ゾンデデータ整理
#
#
# Host: aofd165.fish.nagasaki-u.ac.jp
# Directory: /work2/kunoki/to_manda_sensei/Tools
#
# Revision history:
# This file is created by /usr/local/mybin/nbscr.sh at 10:00 on 06-05-2014.
# Default values
z0=500 # [m]
dz=500 # [m]
nh=39 # Number of header lines
zmax=15000
if [ $# -ne 6 ]; then
echo Error in $0 : Wrong number of arugments
echo Usage: $0 input output header_lines zmax
exit 1
fi
in=$1
out=$2
nh=$3
z0=$4
dz=$5
zmax=$6
# awk : 必要なデータの抜き出し
#
# sort: 並べ替え
# filter1d: 平滑化
# Interpolation using height as a vertical coordinate
#awk -v nh=$nh 'BEGIN{FS=" "}{if (NR>nh) print $8,$2,$3,$4,$5,$6,$7,$9,$10,\
#$11,$12,$13,$14,$15,$16,$17,$18,$19,$20}' $in|\
#sort -n | \
#sample1d -Fl -I${dz} -T0 > $out
# Using height as a vertical coordinate
awk -v nh=$nh 'BEGIN{FS=" "}{if (NR>nh) print $8,$2,$3,$4,$5,$6,$7,$9,$10,\
$11,$12,$13,$14,$15,$16,$17,$18,$19,$20}' $in|\
sort -n | \
filter1d -Fg${dz} -T${z0}/${zmax}/${dz} -N19/0 > $out
# Using pressure as a vertical coordinate
#awk 'BEGIN{FS=","}{if (NR>7) print $21,$10,$11,$12,$22,$23}' $in|\
#sort -n |\
#filter1d -Fb5 -T100/1020/5 -N6/0 > $out
echo Input: $in
echo Output: $out
echo
# -F
#
# フィルタの種類を設定する。畳込み・非畳込みフィルタの中から 選ぶこと。フィルタコードと時間列と同じ単位のフィルタ全幅 width を付けること。利用できる畳込みフィルタは以下の通り。
#
# (b) ボックスカー: 全ての重みが等しい。
# (c) コサインアーチ: コサインアーチ曲線に従う重み。
# (g) ガウシアン: ガウス関数によって与えられる重み。
# (f) カスタム: width の代わりに独自の重み定数の 1 列のファイルの 名前を与えること。
# 非畳込みフィルタは以下の通り。
# (m) 中央: 中央値を返す。
# (p) 最尤推定 (最頻値推定): 最頻値を返す。 1 つ以上の最頻値が 見 つ かったときはそれらの平均値を返す。最頻値の中から最小あるいは 最大を返して欲しい場合はフィルタ幅に - あるいは + を付けるこ と 。
# (l) 最小: 全ての値の最小値を返す。
# (L) 最小: 全ての正の値の中から最小値を返す。
# (u) 最大: 全ての値の最大値を返す。
# (U) 最大: 全ての負の値の中から最大値を返す。
# 大 文字の B, C, G, M, P, F にすると頑健フィルタが使われる。すな わち、フィルタリングの際に、外れ値(中央値から L1 スケール の2.5 倍離れた値)を中央値に置き換える。
# L|U の場合は最初の符号テストを通過するデータが無いことがある。 その場合、フィルタは 0.0 を返す。
----------------------
End of proc.sonde.pl1101.sh
----------------------
======================
grads.bin.pl1101.run.sh
======================
#!/bin/sh
exe=$(basename $0 .run.sh).sh
if [ $# -ne 3 ]; then
echo Error in $0: Wrong number of arguments
echo Usage : $0 z0 dz zmax
exit 1
fi
z0=$1
dz=$2
zmax=$3
indir=output
outdir=$indir
#####
list=$(basename $0 .sh).input.data.txt
#####
# /work1/am/2016.PolarLow/Ship.Surface.Flux
# PL1101.FLUX.CHECK.txt
# File name Date/Time SAT RH SLP Lat Lon
# Sounding degC % hPa deg N deg E
cat<<EOF>$list
011800.txt 2011-01-17T23:37:00 4.64 87.40 999.57 65.2105 0.7847
011806.txt 2011-01-18T05:33:00 2.59 84.60 999.80 66.0146 1.9758
011812.txt 2011-01-18T11:31:00 1.91 91.40 1001.60 66.6709 3.8372
011818.txt 2011-01-18T17:31:00 2.90 80.73 1002.92 67.4832 6.1664
011900.txt 2011-01-18T23:29:00 4.19 67.07 1004.30 68.2407 8.5852
011906.txt 2011-01-19T05:28:00 3.77 92.93 1005.82 68.9431 11.1367
011912.txt 2011-01-19T11:12:00 4.74 94.93 1010.42 68.8846 12.7141
011918.txt 2011-01-19T17:26:00 4.11 96.73 1017.36 68.4558 14.0157
012000.txt 2011-01-19T23:27:00 3.19 96.27 1020.47 69.3814 15.9724
012006.txt 2011-01-20T05:03:00 2.06 94.13 1021.97 69.5542 18.7040
012012.txt 2011-01-20T13:26:00 2.29 69.47 1020.20 69.6639 18.9906
012018.txt 2011-01-20T17:27:00 2.35 70.80 1018.30 69.8680 19.8190
012100.txt 2011-01-20T23:02:00 5.25 74.14 1012.79 70.6421 19.9778
012106.txt 2011-01-21T05:27:00 5.79 79.40 1005.13 71.4128 19.8202
012112.txt 2011-01-21T11:26:00 3.65 88.20 996.70 72.1375 19.6831
012118.txt 2011-01-21T17:01:00 3.98 65.47 991.88 72.6902 19.5140
012200.txt 2011-01-21T23:11:00 2.08 93.93 987.04 73.3968 19.3641
012206.txt 2011-01-22T05:36:00 1.03 94.14 995.92 74.0082 19.2265
012212.txt 2011-01-22T11:32:00 -4.44 86.07 1003.49 74.4153 19.6916
012218.txt 2011-01-22T17:40:00 -8.92 84.27 1007.50 74.8359 22.6654
012300.txt 2011-01-22T23:34:00 -10.41 83.73 1009.06 75.2005 25.0279
012306.txt 2011-01-23T05:28:00 -11.11 80.20 1007.63 75.6485 26.9906
012312.txt 2011-01-23T11:27:00 -15.61 76.73 1006.13 76.2834 30.0438
012318.txt 2011-01-23T16:55:00 -13.61 79.93 1004.79 76.0520 31.2484
012400.txt 2011-01-23T23:28:00 -8.46 87.80 1002.40 75.1145 31.2612
012406.txt 2011-01-24T05:52:00 -5.10 89.93 1000.56 74.2429 31.2388
012412.txt 2011-01-24T11:05:00 -3.04 78.13 1000.22 73.5627 31.2199
012418.txt 2011-01-24T17:41:00 -2.53 69.87 999.06 72.7414 31.2211
012500.txt 2011-01-25T01:36:00 -1.69 64.20 997.78 71.8196 31.2353
012506.txt 2011-01-25T05:30:00 -1.13 85.40 996.58 71.3652 31.2343
012512.txt 2011-01-25T11:25:00 -1.82 87.47 997.77 70.5663 31.2217
012518.txt 2011-01-25T17:32:00 -2.85 93.73 1000.71 70.9237 29.3367
012600.txt 2011-01-25T23:45:00 -0.88 68.87 1000.96 70.9507 26.0088
012606.txt 2011-01-26T05:26:00 0.08 80.34 994.99 70.6565 23.3577
012612.txt 2011-01-26T11:22:00 0.23 86.40 996.95 -999.0000 -999.0000
EOF
yy=11
while read BUF ; do
ary=(`echo $BUF`) # 配列に格納
in=${ary[0]}
datetime=${ary[1]}
SAT=${ary[2]}
RH=${ary[3]}
SLP=${ary[4]}
out=${yy}$(basename $in .txt).grd
$exe ${indir}/$in ${outdir}/$out $z0 $dz $zmax ${datetime} ${SAT} ${RH} ${SLP}
done < $list
exit 0
----------------------
End of grads.bin.pl1101.run.sh
----------------------
======================
grads.bin.pl1101.sh
======================
#!/bin/sh
if [ $# -ne 9 ]; then
echo Error in $0 : Wrong number of arguments
echo Usage $0 in out z0 dz zmax datetime SAT RH SLP
exit 1
fi
in=$1
if [ ! -f $in ]; then
echo Error in $0 : No such file, $in
exit 1
fi
out=$2
z0=$3
dz=$4
zmax=$5
datetime=$6
SAT=$7
RH=$8
SLP=$9
undef=-999.9
outdir="$(pwd)/output"
mkdir -vp $outdir
outtp=${outdir}/$(basename $out .grd)_PBLH.txt
title="MR11 sonde data"
f90=ifort
opt="-CB -fpe0 -traceback"
src=$(basename $0 .sh).f90
exe=$(basename $0 .sh)
nml=$(basename $0 .sh).namelist.txt
cat <<EOF>$nml
¶
in="$in",
out="$out",
outtp="$outtp",
z0=${z0},
dz=${dz},
zmax=${zmax},
datetime="${datetime}",
SAT=${SAT},
RH=${RH},
SLP=${SLP},
&end
EOF
kmax=$(echo "scale=0; (${zmax} - ${z0})/${dz}+1" |bc)
z0km=$(echo "scale=3; ${z0}/1000.0" |bc)
dzkm=$(echo "scale=3; ${dz}/1000.0" |bc)
cat <<EOF>sonde.ctl
dset ${outdir}/%y2%m2%d2%h2.grd
options template
undef ${undef}
title ${title}
xdef 1 linear 0.0 2.5
ydef 1 linear 60.0 2.5
zdef ${kmax} linear ${z0km} ${dzkm}
tdef 36 linear 00z18Jan2011 6hr
vars 9
z ${kmax} 99 height (m)
p ${kmax} 99 Pressure (hPa)
t ${kmax} 99 Air Temerature (degC)
rh ${kmax} 99 Relative Humidity (%)
v ${kmax} 99 y-wind component (m s-1)
u ${kmax} 99 x-wind component (m s-1)
vpt ${kmax} 99 virtual potential temperature (K)
gammad ${kmax} 99 lapse rate (K/km)
gammavpt ${kmax} 99 vpt lapse rate (K/km)
endvars
EOF
cat<<EOF>$src
character(len=1000)::in,out,outtp
real,parameter::undef=-999.9
integer,parameter::nmax=20000
integer,parameter::outvar=8
character(len=1000)::strm
character(len=19)::datetime
real,dimension(nmax):: &
! Record name: Unit: Divisor: Offset:
! --------------------------------------------------
time = undef, & ! sec 1 0
Pscl = undef, & ! ln 1 0
T = undef, & ! K 10 0
RH = undef, & ! % 1 0
v = undef, & ! m/s -100 0
u = undef, & ! m/s -100 0
Height= undef, & ! m 1 30000
P = undef, & ! hPa 10 0
TD = undef, & ! K 10 0
MR = undef, & ! g/kg 100 0
DD = undef, & ! dgr 1 0
FF = undef, & ! m/s 10 0
AZ = undef, & ! dgr 1 0
Range = undef, & ! m 0.01 0
Lon = undef, & ! dgr 100 0
Lat = undef, & ! dgr 100 0
SpuKey= undef, & ! bitfield 1 0
UsrKey= undef, & ! bitfield 1 0
RadarH= undef ! m 1 30000
integer,parameter::kmax=${kmax}
real,dimension(kmax)::&
z = undef, &
timeout = undef, &
pout = undef, tout = undef, rhout = undef,&
vout = undef, uout = undef, &
lonout = undef, latout = undef, &
vpt = undef, gammad = undef, gammavpt= undef
real::pblh ! Planetray boundary layer height [m]
real,parameter::z_sfc=2.0 ![m] ! Height of the surface observation
namelist /para/in,out,outtp,z0,dz,zmax, datetime, SAT, RH, SLP
open(1,file="${nml}")
read(1,nml=para)
open(10,file=in,action="read")
n=0
count_vaild_data: do
read(10,'(A)',iostat=ios)strm
if(ios<0)exit
if(strm(1:1) == "#")then
cycle
else
n=n+1
endif
enddo count_vaild_data
nt=n
rewind(10)
print *,'nt=',nt
do i=1,nt
read(10,*)Height(i), time(i) ,Pscl(i) ,T(i) ,RH(i), v(i), u(i) &
,P(i) , TD(i) ,MR(i) ,DD(i) ,FF(i) &
,AZ(i) , Range(i) ,Lon(i) ,Lat(i),SpuKey(i) &
,UsrKey(i), RadarH(i)
! print *,height(i),p(i),t(i),rh(i)
end do !i
nz=int((zmax-z0)/dz)+1
do k=1,nz
z(k)=z0+dz*(k-1)
do i=1,nt
if(z(k)==Height(i))then
timeout(k)=time(i)
pout(k)=P(i)
tout(k)=T(i)
rhout(k)=rh(i)
vout(k)=v(i)
uout(k)=u(i)
lonout(k)=lon(i)
latout(k)=lat(i)
endif
end do !i
enddo !k
vpt(:)=undef
gammad(:)=undef
do k=2,kmax-1
call virtual_potential_temperature&
&(vpt(k), tout(k), pout(k), rhout(k), undef)
end do !k
call virtual_potential_temperature&
&(vpt(1), tout(1), pout(1), rhout(1), undef)
call virtual_potential_temperature&
&(vpt(kmax), tout(kmax), pout(kmax), rhout(kmax), undef)
call virtual_potential_temperature&
&(vptsfc, SAT, SLP, RH, undef)
print *,'vptsfc=',vptsfc
call lapse_rate(gammad,kmax,tout,z,undef)
call lapse_rate(gammavpt,kmax,vpt,z,undef)
zbtm=6000.0 !
vpt_thold=1.0 ![K]
call pblheight(pblh, vptsfc, z_sfc, kmax, vpt_thold, vpt, z0, dz, z, undef)
print *,'datetime',datetime
print *,'pblh=',pblh,'vpt_pblh=',vptsfc+vpt_thold,'vptsfc=',vptsfc
open(3,file=out, &
access="direct",form="unformatted",recl=4*outvar*kmax)
write(3,rec=1) &
(z(k),k=1,kmax), (pout(k),k=1,kmax), &
(tout(k),k=1,kmax), (rhout(k),k=1,kmax), &
(vout(k),k=1,kmax), (uout(k),k=1,kmax), &
(vpt(k),k=1,kmax), (gammad(k),k=1,kmax),&
(gammavpt(k),k=1,kmax)
close(3)
!do k=1,kmax
! print *,z(k),pout(k),tout(k),rhout(k),vpt(k)
!end do !i
print '(A,A)',"Input: ",trim(in)
print '(A,A)',"Output: ",trim(out)
print '(A,A)',"Output: ",trim(outtp)
open(22,file=outtp)
write(22,'(A,A)')'# datetime ',datetime
write(22,'(A)') '# vpt z'
write(22,'(f10.2,f10.0)') vptsfc, z_sfc
write(22,'(f10.2,f10.0)') vptsfc+vpt_thold, pblh
close(22)
end
subroutine pblheight(pblh, vptsfc, z_sfc, kmax, vpt_thold, vpt, z0, dz, z, undef)
!
! Tokinaga, H. et al. (2006), Atmospheric sounding over the winter
! Kuroshio Extension: Effect of surface stability on atmospheric
! boundary layer structure, Geophys. Res. Lett., 33, L04703,
! doi:10.1029/2005GL025102.
!
integer,intent(in)::kmax
real,intent(in),dimension(kmax)::vpt, z
real,intent(in)::vptsfc,z_sfc,vpt_thold,z0,dz,undef
real,intent(inout)::pblh
iundef=int(undef)
kdx=iundef
plbh=undef
kdx=iundef
vpt_top=vptsfc+vpt_thold
do k=1,kmax-1
if(vpt(k) <= vpt_top .and. vpt_top < vpt(k+1) )then
kdx=k
exit
endif
end do !k
if(kdx == iundef)then
pblh=undef
return
endif
if(kdx>1)then
pblh=(z(kdx+1)-z(kdx))/(vpt(kdx+1)-vpt(kdx))*(vpt_top-vpt(kdx)) + z(kdx)
print *,z(kdx+1),vpt(kdx+1)
print *,pblh, vpt_top
print *,z(kdx),vpt(kdx)
else if(kdx==1)then
pblh=(z(kdx)-z_sfc)/(vpt(kdx)-vptsfc)*(vpt_top-vpt_sfc) + z_sfc
else
pblh=undef
endif
end subroutine pblheight
subroutine lapse_rate(gamma,kmax,tout,zout,undef)
implicit none
integer,intent(in)::kmax
real,intent(out)::gamma(kmax) !lapse rate [K/km]
real,intent(in)::tout(kmax),zout(kmax)
real,intent(in)::undef
real,parameter::m2km=1000.0
integer k
do k=2,kmax
if(tout(k)==undef .or. zout(k)==undef .or. tout(k-1)==undef .or. &
& zout(k-1)==undef )then
gamma(k)=undef
else
gamma(k)=-(tout(k)-tout(k-1))/(zout(k)-zout(k-1))*m2km
endif
end do !k
!print *,gamma
end subroutine lapse_rate
subroutine virtual_potential_temperature(vpt, tc, p, rh, rmiss)
!
implicit none
real,intent(out)::vpt
! pt: virtual potential temperature (kelvin)
real,intent(in)::tc,p,rh,rmiss
! tc: temperature (degree C)
! p : pressure (hPa)
! rh: Relative Humidity (%)
real tk ! temp in Kelvin
real,parameter:: kappa=287.0/1004.0
! Rd=287 J K-1 kg-1
! Cp=1004 J K-1 kg-1
real,parameter::p0=1000.0
! p0: pressue (hPa)
real pt !Potential Temp.
real es !saturated water vapor pressure
real e !water vapor pressure
real w !Mixing Ratio
if (tc == rmiss .or. p == rmiss .or. rh == rmiss)then
vpt=rmiss
return
endif
tk=tc+273.15
pt=tk*(p0/p)**kappa
! saturated water vapor pressure by Tetens (1930)'s formulae
! tc=tk-273.15
es=611.0/100.*10**((7.5*tc)/(237.3+tc)) ![hPa]
e=rh/100*es
! water vapor mixing ratio in kg/kg
w=0.622*e/(p-e)
vpt=pt*(1.0 + 0.61*w)
end subroutine virtual_potential_temperature
EOF
echo Compiling ${src} ...
${f90} ${opt} ${src} -o ${exe}
if [ $? -ne 0 ]; then
echo
echo Compile error!
echo
echo Terminated.
echo
exit 1
fi
echo "Done Compile."
echo
echo ${exe} is running ...
echo
${exe}
if [ $? -ne 0 ]; then
echo
echo ERROR in $exe: Runtime error!
echo
echo Terminated.
echo
exit 1
fi
echo
echo "Done ${exe}"
echo
exit 0
----------------------
End of grads.bin.pl1101.sh
----------------------
======================
plot.profile.run.sh
======================
#!/bin/bash
exe=$(basename $0 .run.sh).gs
datelist="\
00Z18JAN2011 \
06Z18JAN2011 \
12Z18JAN2011 \
18Z18JAN2011 \
00Z19JAN2011 \
06Z19JAN2011 \
12Z19JAN2011 \
18Z19JAN2011 \
00Z20JAN2011 \
06Z20JAN2011 \
12Z20JAN2011 \
18Z20JAN2011 \
00Z21JAN2011 \
06Z21JAN2011 \
12Z21JAN2011 \
18Z21JAN2011 \
00Z22JAN2011 \
06Z22JAN2011 \
12Z22JAN2011 \
18Z22JAN2011 \
00Z23JAN2011 \
06Z23JAN2011 \
12Z23JAN2011 \
18Z23JAN2011 \
00Z24JAN2011 \
06Z24JAN2011 \
12Z24JAN2011 \
18Z24JAN2011 \
00Z25JAN2011 \
06Z25JAN2011 \
12Z25JAN2011 \
18Z25JAN2011 \
00Z26JAN2011 \
06Z26JAN2011 \
12Z26JAN2011 \
"
indir="output"
for datetime in $datelist; do
yy=${datetime:10:2}
mmm=${datetime:5:3}
if [ $mmm = "JAN" ]; then mm=01 ; fi
if [ $mmm = "FEB" ]; then mm=02 ; fi
if [ $mmm = "MAR" ]; then mm=03 ; fi
if [ $mmm = "APR" ]; then mm=04 ; fi
if [ $mmm = "MAY" ]; then mm=05 ; fi
if [ $mmm = "JUN" ]; then mm=06 ; fi
if [ $mmm = "JUL" ]; then mm=07 ; fi
if [ $mmm = "AUG" ]; then mm=08 ; fi
if [ $mmm = "SEP" ]; then mm=09 ; fi
if [ $mmm = "OCT" ]; then mm=10 ; fi
if [ $mmm = "NOV" ]; then mm=11 ; fi
if [ $mmm = "DEC" ]; then mm=12 ; fi
dd=${datetime:3:2}
hh=${datetime:0:2}
tph=${indir}/${yy}${mm}${dd}${hh}_PBLH.txt
echo $tph
if [ ! -f $tph ]; then
echo Error in $0: No such file, $tph
exit 1
fi
grads -bcp "$exe -dtime $datetime -tph $tph -q"
done
exit 0
----------------------
End of plot.profile.run.sh
----------------------
======================
plot.profile.gs
======================
function profile( args )
*
* Default values
*
yymmddhh='11011800'
datetime='00Z18JAN2011'
outdir='Fig'
*
* Decode options
*
i = 1
while( 1 )
arg = subwrd( args, i )
i = i + 1;
if( arg = '' ); break; endif
while( 1 )
if( arg = '-dtime');datetime= subwrd(args,i);i=i+1; break;endif
if( arg = '-q' );quitopt=yes ;i=i+1; break; endif
if( arg = '-tph' );tphfle= subwrd(args,i);i=i+1; break;endif
say 'Syntax error : arg= 'arg
return
endwhile
endwhile
'!mkdir -vp 'outdir
res = read(tphfle) ;* skip header line
res = read(tphfle) ;* skip header line
res = read(tphfle)
line=sublin( res, 2)
vptsfc=subwrd( line, 1)
zsfc=subwrd(line, 2)
res = read(tphfle)
line=sublin( res, 2)
vptpbl=subwrd( line, 1)
zpbl=subwrd(line, 2)
#say temptp' 'tph
'open sonde.ctl'
'cc'
'set grads off'
xmax = 2
ymax = 2
xwid = 6.0/xmax
ywid = 7.0/ymax
xmargin=0.7
ymargin=2
lev1=0.0
lev2=2.0
xmap = 1
ymap = 1
xs = 1 + (xwid+ xmargin)*(xmap-1)
xe = xs + xwid
ye = 10.0 - (ywid+ymargin)*(ymap-1)
ys = ye - ywid
'set vpage 0.0 8.5 0.0 11.0'
'set parea 'xs ' 'xe' 'ys' 'ye
'set time 'datetime
'set lev 'lev1' 'lev2
'set xlopts 1 4 0.2'
'set ylopts 1 4 0.2'
'set xlint 20'
'set ylint 0.2'
'set vrange -80 10'
'set lev 'lev1' 'lev2
'set ccolor 2'
'set cthick 20'
'set cstyle 1'
'set cmark 0'
'set xlab on'
'set ylab off'
'set grid off'
'd t'
'set lev 'lev1' 'lev2
'set vpage 0.0 8.5 0.0 11.0'
'set parea 'xs ' 'xe' 'ys' 'ye
'set vrange 0 100'
'set xlint 20'
'set ylint 0.2'
'set ccolor 4'
'set cstyle 1'
'set cmark 0'
'set xlpos -0.8 b'
'set xlab on'
'set ylab on'
'set grid off'
'd rh'
'set strsiz 0.15 0.15'
'set string 1 c 4 90'
'draw string 0.5 8.2 [km]'
'set string 1 c 4 0'
'draw string 2.5 6 T [`3.`0C]'
'draw string 2.5 5.1 RH [%]'
'set parea off'
'set vpage off'
xmap=2
ymap=1
xs = 0.8 + (xwid+xmargin)*(xmap-1)
xe = xs + xwid
ye = 10.0 - (ywid+ymargin)*(ymap-1)
ys = ye - ywid
'set vpage 0.0 8.5 0.0 11.0'
'set parea 'xs ' 'xe' 'ys' 'ye
'set time 'datetime
'set lev 'lev1' 'lev2
'set xlopts 1 4 0.2'
'set ylopts 1 4 0.2'
'set xlint 1'
#'set vrange 260 280'
'set lev 'lev1' 'lev2
'set ccolor 2'
'set cthick 20'
'set cstyle 1'
'set cmark 0'
'set xlab on'
'set ylab off'
'set grid off'
'd vpt'
zsfckm=zsfc/1000
zpblkm=zpbl/1000
'markplot 'vptsfc' 'zsfckm' -c 3 -m 4 -s 0.1'
'markplot 'vptpbl' 'zpblkm' -c 3 -m 4 -s 0.1'
'set strsiz 0.15 0.15'
#'set string 1 c 4 90'
#'draw string 0.5 8.2 [km]'
'set string 1 c 4 0'
'draw string 6 6 VPT [K]'
'set parea off'
'set vpage off'
xmap = 1
ymap = 2
xs = 1 + (xwid+ xmargin)*(xmap-1)
xe = xs + xwid
ye = 10.0 - (ywid+ymargin)*(ymap-1)
ys = ye - ywid
'set vpage 0.0 8.5 0.0 11.0'
'set parea 'xs ' 'xe' 'ys' 'ye
'set lev 'lev1' 'lev2
'set vrange -10 10'
'set xlint 5'
'set ylint 3'
'set ccolor 4'
'set cstyle 1'
'set cmark 0'
'set xlab on'
'set ylab on'
'set grid vertical'
'd gammad'
'set strsiz 0.15 0.15'
'set string 1 c 4 90'
'draw string 0.5 8.2 [km]'
'set string 1 c 4 0'
'draw string 2.5 0.5 gamma T [K/km]'
'set parea off'
'set vpage off'
xmap = 2
ymap = 2
xs = 1 + (xwid+ xmargin)*(xmap-1)
xe = xs + xwid
ye = 10.0 - (ywid+ymargin)*(ymap-1)
ys = ye - ywid
'set vpage 0.0 8.5 0.0 11.0'
'set parea 'xs ' 'xe' 'ys' 'ye
'set lev 'lev1' 'lev2
'set vrange -40 0'
'set xlint 10'
'set ylint 3'
'set ccolor 4'
'set cstyle 1'
'set cmark 0'
'set xlab on'
'set ylab on'
'set grid vertical'
'd gammavpt'
'set strsiz 0.15 0.15'
'set string 1 c 4 90'
#'draw string 0.5 8.2 [km]'
'set string 1 c 4 0'
'draw string 6 0.5 gamma VPT [K/km]'
'set parea off'
'set vpage off'
'set strsiz 0.2 0.25'
'set string 1 c 4 0'
'draw string 4 10.5 'datetime
'q dims'
line=sublin(result,5)
time=subwrd(line,6)
yy=substr(time,11,4)
mmm=substr(time,6,3)
if(mmm='JAN');mm='01';endif
if(mmm='FEB');mm='02';endif
if(mmm='MAR');mm='03';endif
if(mmm='APR');mm='04';endif
if(mmm='MAY');mm='05';endif
if(mmm='JUN');mm='06';endif
if(mmm='JUL');mm='07';endif
if(mmm='AUG');mm='08';endif
if(mmm='SEP');mm='09';endif
if(mmm='OCT');mm='10';endif
if(mmm='NOV');mm='11';endif
if(mmm='DEC');mm='12';endif
dd=substr(time,4,2)
hh=substr(time,1,2)
say hh
yymmddhh=yy''mm''dd''hh
out=outdir'/Profile.' yymmddhh '.eps'
'gxprint 'out
say
say 'Output: 'out
say
'q dims' ;*ctlinfo'
say result
if (quitopt="yes")then
quit
endif
----------------------
End of plot.profile.gs
----------------------