[2018-04-02_16:50]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX]
[am@localhost]
$ fnl0.25.flux.daily.sh
[2018-04-02_16:48]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX]
[am@localhost]
$ sudo vi /usr/local/mybin/srcdump.sh
[sudo] password for am:
[2018-04-02_16:50]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX]
[am@localhost]
$ srcdump.sh fnl0.25.flux.daily.sh
#------------------------------
# List of the following files:
#------------------------------
fnl0.25.flux.daily.sh
#------------------------------
# Machine info
#------------------------------
localhost
/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX
Mon Apr 2 16:50:07 JST 2018
#======================
# fnl0.25.flux.daily.sh
#======================
#!/bin/bash
gs=$(basename $0 .sh).gs
figdir=Fig_$(basename $0 .sh)
mkdir -vp $figdir
dataset_name='NCEP_fnl0.25_Daily_Mean'
ctl=fnl0.25.ctl
export LANG=C
host=$(hostname)
cwd=$(pwd)
timestamp=$(date)
lonw=118
lone=132.5
lats=24
latn=34.5
datetimes=00Z15JUN2017
datetimee=00Z08JUL2017
cat <<EOF>$gs
'open ${ctl}'
'set time ${datetimes}'
'q dims'
line=sublin(result,5)
is=subwrd(line,9)
say 'START 'line' 'is
'set time ${datetimee}'
'q dims'
line=sublin(result,5)
ie=subwrd(line,9)
say 'END 'line' 'ie
'set lon '${lonw}' '${lone}
'set lat '${lats}' '${latn}
'set mpdset 'hires
'set gxout shade2'
xmax = 4
ymax = 2
xwid = 9.0/xmax
ywid = 5.5/ymax
i=is
ie=ie-3
while (i <= ie) ;*TIME LOOP
'cc'
#
# DAILY MEAN
#
ihs=i
ihe=i+3
'set t 'ihs
'q dims'
line=sublin(result,5)
temp1=subwrd(line,6)
'set t 'ihe
'q dims'
line=sublin(result,5)
temp2=subwrd(line,6)
say
say temp1' - 'temp2
'cwpd=vint(lev(z=1),CLWMRprs,100)'
cwpd'='cwpd'*0.0'
swrd'='DSWRFsfc'*0.0'
lwrd'='DLWRFsfc'*0.0'
shfd'='SHTFLsfc'*0.0'
lhfd'='LHTFLsfc'*0.0'
sumd'='LHTFLsfc'*0.0'
ih=ihs
while (ih <= ihe) ;* HOUR LOOP
'set t 'ih
'temp=vint(lev(z=1),CLWMRprs,100)'
'cwpd=cwpd+temp'
'temp=DSWRFsfc-USWRFsfc'
'swrd=swrd+temp'
'temp=DLWRFsfc-ULWRFsfc'
'lwrd=lwrd+temp'
'shfd=shfd-SHTFLsfc'
'lhfd=lhfd-LHTFLsfc'
'q dims'
line=sublin(result,5)
temp1=subwrd(line,6)
say temp1
ih=ih+1
endwhile ;*ih HOUR LOOP
nh=ihe-ihs+1
cwpd'='cwpd'/'nh
swrd'='swrd'/'nh
lwrd'='lwrd'/'nh
shfd'='shfd'/'nh
lhfd'='lhfd'/'nh
sumd'='swrd'+'lwrd'+'shfd'+'lhfd
say
#
# PLOT
#
nmap = 1
ymap = 1
while (ymap <= ymax) ;*ROW
xmap = 1
while (xmap <= xmax) ;*COLUMN
xs = 0.8 + (xwid+0.10)*(xmap-1)
xe = xs + xwid
ye = 7.5 - (ywid+0.10)*(ymap-1)
ys = ye - ywid
if (ymap = ymax)
'set xlopts 1 2 0.14'
else
'set xlopts 1 2 0.0'
'set xlopts 1 2 0.14'
endif
if (xmap = 1)
'set ylopts 1 2 0.14'
else
'set ylopts 1 2 0.0'
endif
'set vpage 0.0 11.0 0.0 8.5'
'set parea 'xs ' 'xe' 'ys' 'ye
'set grads off'
'set grid off'
'set font 4'
xlevs='116 120 124 128'
'set xlevs 'xlevs
#'set xlint 4'
'set ylint 4'
if(nmap = 1)
title=CWP
'set gxout shade2'
clevs2='0 0.1 0.2 0.3 0.4 0.5 0.6'
kind2='darkgray->white' ;*->white'
'color -levs 'clevs2' -kind 'kind2 ' -xcbar 0.8 3.1 4.7 4.8 -ft 2 -fwidth 0.08 -fheight 0.10 -edge circle -fstep 1 -line on'
'd 'cwpd
'set gxout contour'
'set clevs 'clevs2
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'cwpd
endif
if(nmap = 2)
title=SWR
'set gxout shade2'
clevs='-300 -250 -200 -150 -100 -20 20 100 150 200 250 300'
#clevs='-500 -400 -300 -200 -100 -20 20 100 200 300 400 500'
kind='blue->white->orange'
'color -levs 'clevs' -kind 'kind ' -xcbar 2.0 9.0 1.7 1.8 -ft 2 -fwidth 0.12 -fheight 0.14 -edge circle -fstep 1 -line on'
'd 'swrd
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'swrd
endif
if(nmap = 3)
title=LWR
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'd 'lwrd
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'lwrd
endif
if(nmap = 4)
title=SHF
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'd 'shfd
'set gxout contour'
'set clevs 'clevs
'set cthick 1'
'set cstyle 1'
'set ccolor 0'
'set clab off'
'd 'shfd
endif
if(nmap = 5)
title=LHF
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'd 'lhfd
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'lhfd
endif
if(nmap = 6)
title=SUM
'sum=DSWRFsfc-USWRFsfc+DLWRFsfc-ULWRFsfc-SHTFLsfc-LHTFLsfc'
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'd 'sumd
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'sumd
endif
'q gxinfo'
line=sublin(result,3)
xl=subwrd(line,4)
xr=subwrd(line,6)
line=sublin(result,4)
yb=subwrd(line,4)
yt=subwrd(line,6)
*
xx = xl+0.0
yy = yt+0.15
'set string 1 l 2 0'
'set strsiz 0.12 0.15'
'draw string 'xx' 'yy' 'title
'set parea off'
'set vpage off'
*
if (nmap = 22); break; endif
nmap = nmap + 1
xmap = xmap + 1
endwhile ;* xmap COLUMN
ymap = ymap + 1
endwhile :* ymap ROW
# Datetime & dataset name
'set strsiz 0.12 0.16'
'set string 1 c 2'
'draw string 5.5 7.75 ${dataset_name}'
'q dims'
line=sublin(result,5)
datetime=subwrd(line,6)
hh=substr(datetime,1,2)
dd=substr(datetime,4,2)
mmm=substr(datetime,6,3)
yyyy=substr(datetime,9,4)
timeutc=dd''mmm''yyyy
say
say timeutc
say
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
'draw string 5.5 7.45 'timeutc
# Header
'set strsiz 0.08 0.1'
'set string 1 l 2'
'draw string 0.5 8.35 ${timestamp}'
'draw string 0.5 8.23 ${host}'
'draw string 0.5 8.11 ${cwd}'
'draw string 0.5 7.99 ${gs} ${ctl}'
figfile='${figdir}/${dataset_name}.'yyyy''mm''dd'.eps'
'gxprint 'figfile
say 'Fig file: 'figfile
i=i+4
endwhile ;* i NEXT DAY
quit
EOF
grads -bcl "${gs}"
exit 0
#----------------------
# End of fnl0.25.flux.daily.sh
#----------------------