[2018-04-04_16:15]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY]
[am@localhost]
$ fnl0.25.flux.daily.sh
-rw-rw-r-- 1 am am 3.5K 4月 4 16:21 fnl0.25.flux.daily.f90
Compiling fnl0.25.flux.daily.f90 ...
ifort -CB -traceback -fpe0 -convert big_endian -assume byterecl fnl0.25.flux.daily.f90 -o fnl0.25.flux.daily.exe -L/usr/local/netcdf-4.1.3/lib -lnetcdf -lnetcdff -I/usr/local/netcdf-4.1.3/include
Done Compile.
-rwxrwxr-x 1 am am 837K 4月 4 16:22 fnl0.25.flux.daily.exe
fnl0.25.flux.daily.exe is running ...
VARNAME: cwp
varid= 4
ndims= 3
dimids( 1)= 1 nshape( 1)= 121
dimids( 2)= 2 nshape( 2)= 101
dimids( 3)= 3 nshape( 3)= 180
VARNAME: cwp
INPUT: /work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT/NCEP_fnl0.25_cwp.nc
varid= 4
READ cwp
DONE.
OUTPUT: OUT_fnl0.25.flux.daily/NCEP_fnl0.25_cwp.bin
ireclen of var2 = 48884
irec= 45
DONE OUTPUT.
VARNAME: swr
INPUT: /work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT/NCEP_fnl0.25_swr.nc
varid= 4
READ swr
DONE.
OUTPUT: OUT_fnl0.25.flux.daily/NCEP_fnl0.25_swr.bin
ireclen of var2 = 48884
irec= 45
DONE OUTPUT.
VARNAME: lwr
INPUT: /work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT/NCEP_fnl0.25_lwr.nc
varid= 4
READ lwr
DONE.
OUTPUT: OUT_fnl0.25.flux.daily/NCEP_fnl0.25_lwr.bin
ireclen of var2 = 48884
irec= 45
DONE OUTPUT.
VARNAME: shf
INPUT: /work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT/NCEP_fnl0.25_shf.nc
varid= 4
READ shf
DONE.
OUTPUT: OUT_fnl0.25.flux.daily/NCEP_fnl0.25_shf.bin
ireclen of var2 = 48884
irec= 45
DONE OUTPUT.
VARNAME: lhf
INPUT: /work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT/NCEP_fnl0.25_lhf.nc
varid= 4
READ lhf
DONE.
OUTPUT: OUT_fnl0.25.flux.daily/NCEP_fnl0.25_lhf.bin
ireclen of var2 = 48884
irec= 45
DONE OUTPUT.
VARNAME: net
INPUT: /work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT/NCEP_fnl0.25_net.nc
varid= 4
READ net
DONE.
OUTPUT: OUT_fnl0.25.flux.daily/NCEP_fnl0.25_net.bin
ireclen of var2 = 48884
irec= 45
DONE OUTPUT.
COORD NAME: lon
varid= 1
READ lon
DONE.
COORD NAME: lat
varid= 2
READ lat
DONE.
Done fnl0.25.flux.daily.exe
[2018-04-04_16:22]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY]
[am@localhost]
$ fnl0.25.flux.daily.plot.sh
[2018-04-04_16:24]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY]
[am@localhost]
$ srcdump.sh fnl0.25.flux.daily.sh fnl0.25.flux.daily.f90 fnl0.25.flux.daily.plot.sh >l.txt
#------------------------------
# List of the following files:
#------------------------------
fnl0.25.flux.daily.sh
fnl0.25.flux.daily.f90
fnl0.25.flux.daily.plot.sh
#------------------------------
# Machine info
#------------------------------
localhost
/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY
Wed Apr 4 16:25:50 JST 2018
#======================
# fnl0.25.flux.daily.sh
#======================
#!/bin/bash
#
# Description:
#
src=$(basename $0 .sh).f90
exe=$(basename ${src} .f90).exe
nml=$(basename ${src} .f90).nml
f90=ifort
opt="-CB -traceback -fpe0 -convert big_endian -assume byterecl"
nc="-L/usr/local/netcdf-4.1.3/lib -lnetcdf -lnetcdff -I/usr/local/netcdf-4.1.3/include"
if [ ! -f $src ]; then
echo
echo ERROR in $0: NO SUCH FILE, $src
echo
echo TERMINATED.
echo
exit 1
fi
indir=/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.CONVERT
prefix=NCEP_fnl0.25
postfix=nc
odir=OUT_$(basename $src .f90)
mkdir -vp $odir
ofle=$(basename $infle .nc).bin
cat<<EOF>$nml
¶
indir="${indir}",
prefix="${prefix}",
v1="cwp"
v2="swr"
v3="lwr"
v4="shf"
v5="lhf"
v6="net"
postfix="${postfix}",
odir="${odir}",
ofle="${ofle}",
&end
EOF
echo
ls -lh ${src}
echo
echo Compiling ${src} ...
echo
echo ${f90} ${opt} ${src} -o ${exe} ${nc}
echo
${f90} ${opt} ${src} -o ${exe} ${nc}
if [ $? -ne 0 ]; then
echo
echo "=============================================="
echo
echo " COMPILE ERROR!!!"
echo
echo "=============================================="
echo
echo TERMINATED.
echo
exit 1
fi
echo "Done Compile."
echo
ls -lh ${exe}
echo
echo
echo ${exe} is running ...
echo
${exe} <${nml}
if [ $? -ne 0 ]; then
echo
echo "=============================================="
echo
echo " ERROR in $exe: RUNTIME ERROR!!!"
echo
echo "=============================================="
echo
echo TERMINATED.
echo
exit 1
fi
echo
echo "Done ${exe}"
echo
#----------------------
# End of fnl0.25.flux.daily.sh
#----------------------
#======================
# fnl0.25.flux.daily.f90
#======================
program test_read_nc
include '/usr/local/netcdf-4.1.3/include/netcdf.inc'
integer,parameter::nf=6 !NUMBER OF INPUT FILES
character indir*100,infle(nf)*200,input(nf)*300
character(len=50)::prefix,postfix
character(len=10):: v1,v2,v3,v4,v5,v6
character odir*100,ofle*200,output(nf)*300
integer ncid,varid
character*70 err_message
character varname(nf)*50,coordname*50
integer,allocatable :: dimids(:),nshape(:)
real*8,allocatable :: var3(:,:,:)
real*8,allocatable :: lon(:),lat(:),time(:)
real,allocatable::var2(:,:)
real*8,parameter::FillValue = -999000000.
namelist /para/indir,prefix,v1,v2,v3,v4,v5,v6,postfix,odir,ofle
read(*,nml=para)
varname(1)=v1
varname(2)=v2
varname(3)=v3
varname(4)=v4
varname(5)=v5
varname(6)=v6
do m=1,nf
input(m)=trim(indir)//'/'//trim(prefix)//"_"//trim(varname(m))//"."//postfix
end do
print *
m=1
sta = nf_open(input(m), nf_nowrite, ncid)
if(sta.ne.0) then
err_message = nf_strerror(sta)
print *,'OPEN ERROR:', err_message
endif
print *
print '(A,A)','VARNAME: ',trim((varname(m)))
sta = nf_inq_varid(ncid,varname(m),varid)
print *,'varid=', varid
stat = nf_inq_varndims(ncid, varid, ndims)
print *,'ndims= ', ndims
allocate(dimids(ndims))
stat = nf_inq_vardimid(ncid, varid, dimids)
allocate(nshape(ndims))
do i=1,ndims
stat = nf_inq_dimlen(ncid, dimids(i), nshape(i))
enddo !i
do i=1,ndims
write(6,'("dimids(",i2,")=",i4," nshape(",i2,")=",i4)') i,dimids(i),i,nshape(i)
enddo
im=nshape(1)
jm=nshape(2)
nm=nshape(3)
allocate(var3(im,jm,nm),var2(im,jm))
LOOP_FILE: do m=1,nf
var3=0.
var2=0.
print *
print '(A,A)','VARNAME: ',trim((varname(m)))
sta = nf_open(input(m), nf_nowrite, ncid)
if(sta.ne.0) then
err_message = nf_strerror(sta)
print *,'OPEN ERROR:', err_message
else
print '(A,A,A,A)','INPUT: ',trim(input(m))
endif
sta = nf_inq_varid(ncid,varname(m),varid)
print *,'varid=', varid
print '(A,A)','READ ',trim(varname(m))
stat = nf_get_var_DOUBLE(ncid, varid, var3)
if(sta.ne.0) then
err_message = nf_strerror(sta)
write(6,*) 'ERROR READ: ',trim(varname(m)),' ',err_message
stop
else
print '(A)','DONE.'
endif
output(m)=trim(odir)//'/'//trim(prefix)//'_'//trim(varname(m))//'.bin'
print '(A,A,A,A)','OUTPUT: ',trim(output(m))
iu=20
var2(:,:)=var3(:,:,1)
INQUIRE(iolength=ireclen)var2
print *,'ireclen of var2 =',ireclen
open (iu,file=trim(output(m)),form='unformatted',access='direct',&
&recl=ireclen) !im*jm)
irec=0
do n=1,nm,4
var2=0.0
do j=1,jm
do i=1,im
do nh=0,3
if(var3(i,j,n+nh).gt.fillvalue)then
var2(i,j)=var2(i,j)+var3(i,j,n+nh)/4.0
else
var2(i,j)=fillvalue
exit
endif
end do !nh
end do !i
end do !j
irec=irec+1
write(iu,rec=irec) var2
end do !n
close(iu)
print *,'irec=',irec
print '(A)','DONE OUTPUT.'
end do LOOP_FILE !m
allocate(lon(im),lat(jm),time(nm))
coordname='lon'
print *
print '(A,A)','COORD NAME: ',trim(coordname)
sta = nf_inq_varid(ncid,coordname,varid)
print *,'varid=', varid
print '(A,A)','READ ',trim(coordname)
stat = nf_get_var_DOUBLE(ncid, varid, lon)
if(sta.ne.0) then
err_message = nf_strerror(sta)
write(6,*) 'ERROR READ: ',trim(coordname),' ',err_message
stop
else
print '(A)','DONE.' !;print *,lon; print *
endif
coordname='lat'
print *
print '(A,A)','COORD NAME: ',trim(coordname)
sta = nf_inq_varid(ncid,coordname,varid)
print *,'varid=', varid
print '(A,A)','READ ',trim(coordname)
stat = nf_get_var_DOUBLE(ncid, varid, lat)
if(sta.ne.0) then
err_message = nf_strerror(sta)
write(6,*) 'ERROR READ: ',trim(coordname),' ',err_message
stop
else
print '(A)','DONE.' !;print *,lat; print *
endif
stop
end program test_read_nc
#----------------------
# End of fnl0.25.flux.daily.f90
#----------------------
#======================
# fnl0.25.flux.daily.plot.sh
#======================
#!/bin/bash
gs=$(basename $0 .sh).gs
figdir=Fig_$(basename $0 .sh)
mkdir -vp $figdir
dataset_name='NCEP_fnl0.25_daily'
ctl1=fnl0.25.flux.daily.cwp.ctl
ctl2=fnl0.25.flux.daily.swr.ctl
ctl3=fnl0.25.flux.daily.lwr.ctl
ctl4=fnl0.25.flux.daily.shf.ctl
ctl5=fnl0.25.flux.daily.lhf.ctl
ctl6=fnl0.25.flux.daily.net.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 ${ctl1}'
'open ${ctl2}'
'open ${ctl3}'
'open ${ctl4}'
'open ${ctl5}'
'open ${ctl6}'
'set time 00Z15JUN2017'
'q dims'
line=sublin(result,5)
is=subwrd(line,9)
say 'START 'line' 'is
'set time 18Z09JUL2017'
'q dims'
line=sublin(result,5)
ie=subwrd(line,9)
say 'END 'line' 'ie
'set lon '118' '132.5
'set lat '24' '34.5
'set mpdset 'hires
'set gxout shade2'
xmax = 4
ymax = 2
xwid = 9.0/xmax
ywid = 5.5/ymax
i=is
while (i <= ie) ;*TIME LOOP
'cc'
'set dfile 1'
'set t 'i
'q dims'
line=sublin(result,5)
say line
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'
'set dfile 1'
'set t 'i
'd cwp.1'
'set gxout contour'
'set clevs 'clevs2
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'cwp.1
endif
if(nmap = 2)
title=SWR
'set gxout shade2'
#clevs='-500 -400 -300 -200 -100 -20 20 200 400 600 800 1000'
clevs='-300 -250 -200 -150 -100 -20 20 100 150 200 250 300'
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'
'set dfile 2'
'set t 'i
'd swr.2'
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd swr.2'
endif
if(nmap = 3)
title=LWR
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'set dfile 3'
'set t 'i
'd 'lwr.3
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'lwr.3
endif
if(nmap = 4)
title=SHF
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'set dfile 4'
'set t 'i
'd 'shf.4
'set gxout contour'
'set clevs 'clevs
'set cthick 1'
'set cstyle 1'
'set ccolor 0'
'set clab off'
'd 'shf.4
endif
if(nmap = 5)
title=LHF
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'set dfile 5'
'set t 'i
'd 'lhf.5
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'lhf.5
endif
if(nmap = 6)
title=NET
'set gxout shade2'
'color -levs 'clevs' -kind 'kind
'set dfile 6'
'set t 'i
'd 'net.6
'set gxout contour'
'set clevs 'clevs
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clab off'
'd 'net.6
endif
'set dfile 1'
'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} ${ctl1} ... ${ctl6}'
figfile='${figdir}/${dataset_name}.'yyyy''mm''dd'.eps'
'gxprint 'figfile
say 'Fig file: 'figfile
i=i+1
endwhile ;* i TIME LOOP
quit
EOF
grads -bcl "${gs}"
exit 0
#----------------------
# End of fnl0.25.flux.daily.plot.sh
#----------------------
[2018-04-04_17:22]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY.HOVMOLLER]
[am@localhost]
$ fnl0.25.hovmoller.flux.sh
Grid Analysis and Display System (GrADS) Version 2.1.a3
Copyright (C) 1988-2015 by the Institute for Global Environment and Society (IGES)
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information
Config: v2.1.a3 little-endian readline grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile cairo
Issue 'q config' command for more detailed configuration information
GX Package Initialization: Size = 8.5 11
Running in Batch mode
START T is fixed Time = 00Z01JUN2017 T = 3 3
END T is fixed Time = 00Z11JUL2017 T = 43 43
Default file number is: 1
X is fixed Lon = 127 X = 49
Y is varying Lat = 29 to 37 Y = 37 to 69
Z is fixed Lev = 0 Z = 1
T is varying Time = 00Z01JUN2017 to 00Z11JUL2017 T = 3 to 43
E is fixed Ens = 1 E = 1
mediumblue->skyblue->white->khaki->crimson
clevs= -250 -200 -150 -100 -50 0 50 100 150 200 250
ccols= 16 17 18 19 20 21 22 23 24 25 26 27
-> xcbar 5.1 5.2 3.2 8.2 -fh 0.12 -fw 0.11 -edge circle -line on -levcol 16 -250 17 -200 18 -150 19 -100 20 -50 21 0 22 50 23 100 24 150 25 200 26 250 27
Fig file: NCEP_fnl0.25_DAILY.NETHF.00Z01JUN2017-00Z11JUL2017.eps
GX Package Terminated
[2018-04-04_17:23]
[/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY.HOVMOLLER]
[am@localhost]
$ srcdump.sh fnl0.25.hovmoller.flux.sh
#------------------------------
# List of the following files:
#------------------------------
fnl0.25.hovmoller.flux.sh
#------------------------------
# Machine info
#------------------------------
localhost
/work2/am/2017.KYUSHU-HOKUBU.HEAVY.RAIN/FNL0.25.FLUX.DAILY.HOVMOLLER
Wed Apr 4 17:24:22 JST 2018
#======================
# fnl0.25.hovmoller.flux.sh
#======================
#!/bin/bash
gs=$(basename $0 .sh).gs
dataset_name='NCEP_fnl0.25_DAILY'
ctl=fnl0.25.flux.daily.net.ctl
export LANG=C
host=$(hostname)
cwd=$(pwd)
timestamp=$(date)
lonw=127
lone=132
lats=29
latn=37
datetimes=00Z01JUN2017
datetimee=00Z11JUL2017
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 time ${datetimes} ${datetimee}'
'set lon ${lonw}' ;*'${lone}
'set lat '${lats}' '${latn}
'set z 1'
'q dims'
say result
'cc'
'set parea 1 7 3.2 8.2'
'set xyrev on'
'set gxout shade2'
'color -250 250 50 -kind mediumblue->skyblue->white->khaki->crimson -xcbar 5.1 5.2 3.2 8.2 -fh 0.12 -fw 0.11 -edge circle -line on'
'set grid off'
#'set xaxis 15JUN2017 10JUL2017 10dy'
'set xlopts 1 3 0.15'
'set ylopts 1 3 0.15'
'd ave(net,lon=${lonw},lon=${lone})'
'draw title NETHF ${lonw}E-${lone}E'
# Header
'set strsiz 0.08 0.1'
'set string 1 l 2'
'draw string 0.5 9.35 ${timestamp}'
'draw string 0.5 9.23 ${host}'
'draw string 0.5 9.11 ${cwd}'
'draw string 0.5 8.99 ${gs} ${ctl}'
figfile='${dataset_name}.NETHF.${datetimes}-${datetimee}.eps'
'gxprint 'figfile
say 'Fig file: 'figfile
quit
EOF
grads -bcp "${gs}"
exit 0
#----------------------
# End of fnl0.25.hovmoller.flux.sh
#----------------------