Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created formal fortran namelist for itag. #402

Merged
merged 13 commits into from
Oct 27, 2021
16 changes: 9 additions & 7 deletions scripts/run_upp
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,15 @@ fi
if [[ ${outFormat} == "grib2" ]]; then
if [[ ${model} == "GFS" || ${model} == "LAM" ]]; then
cat > itag <<EOF
${inFileName}
${inFormat}
${outFormat}
${YY}-${MM}-${DD}_${HH}:00:00
${tag}
${flxFileName}
postxconfig-NT.txt
&model_inputs
fileName='${inFileName}'
IOFORM='${inFormat}'
grib='${outFormat}'
DateStr='${YY}-${MM}-${DD}_${HH}:00:00'
MODELNAME='${tag}'
fileNameFlux='${flxFileName}'
fileNameD3D='postxconfig-NT.txt'
hertneky marked this conversation as resolved.
Show resolved Hide resolved
/
EOF
fi
fi
Expand Down
100 changes: 45 additions & 55 deletions sorc/ncep_post.fd/WRFPOST.f
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
!! add gocart_on,d3d_on and popascal to namelist
!! 20-03-25 J MENG - remove grib1
!! 21-06-20 W Meng - remove reading grib1 and gfsio lib
!! 21-10-22 KaYee Wong - created formal fortran namelist for itag
!!
!! USAGE: WRFPOST
!! INPUT ARGUMENT LIST:
Expand Down Expand Up @@ -174,7 +175,10 @@ PROGRAM WRFPOST
integer :: kpo,kth,kpv
real,dimension(komax) :: po,th,pv
namelist/nampgb/kpo,po,kth,th,kpv,pv,fileNameAER,d3d_on,gocart_on,popascal &
,hyb_sigp,rdaod,aqfcmaq_on
,hyb_sigp,rdaod,aqfcmaq_on,vtimeunits
kayeekayee marked this conversation as resolved.
Show resolved Hide resolved
integer :: itag_ierr
namelist/model_inputs/fileName,IOFORM,grib,DateStr,MODELNAME,SUBMODELNAME &
,fileNameFlux,fileNameD3D

character startdate*19,SysDepInfo*80,IOWRFNAME*3,post_fname*255
character cgar*1,cdum*4,line*10
Expand Down Expand Up @@ -215,42 +219,35 @@ PROGRAM WRFPOST
spval = 9.9e10
!
!**************************************************************************
!read namelist
open(5,file='itag')
98 read(5,111,end=1000) fileName
if (me==0) print*,'fileName= ',fileName
read(5,113) IOFORM
if (me==0) print*,'IOFORM= ',IOFORM
read(5,120) grib
if (me==0) print*,'OUTFORM= ',grib
if(index(grib,"grib") == 0) then
! grib='grib1' !GRIB1 IS NOT SUPPORTED ANYMORE.
grib='grib2'
rewind(5,iostat=ierr)
read(5,111,end=1000) fileName
read(5,113) IOFORM
endif
if (me==0) print*,'OUTFORM2= ',grib
read(5,112) DateStr
read(5,114) FULLMODELNAME
MODELNAME=FULLMODELNAME(1:4)
SUBMODELNAME=FULLMODELNAME(5:)
IF(len_trim(FULLMODELNAME)<5) THEN
SUBMODELNAME='NONE'
ENDIF
! if(MODELNAME == 'NMM')then
!KaYee: Read itag in Fortran Namelist format
kayeekayee marked this conversation as resolved.
Show resolved Hide resolved
!Set default
SUBMODELNAME='NONE'
!open namelist
open(5,file='itag')
read(5,nml=model_inputs,iostat=itag_ierr,err=888)
!print*,'itag_ierr=',itag_ierr
888 if (itag_ierr /= 0) then
print*,'Incorrect namelist variable(s) found in the itag file,stopping!'
stop
endif
if (me==0) print*,'fileName= ',fileName
if (me==0) print*,'IOFORM= ',IOFORM
!if (me==0) print*,'OUTFORM= ',grib
if (me==0) print*,'OUTFORM= ',grib
if (me==0) print*,'DateStr= ',DateStr
if (me==0) print*,'MODELNAME= ',MODELNAME
if (me==0) print*,'SUBMODELNAME= ',SUBMODELNAME
! if(MODELNAME == 'NMM')then
! read(5,1114) VTIMEUNITS
! 1114 format(a4)
! if (me==0) print*,'VALID TIME UNITS = ', VTIMEUNITS
! endif
! endif
!
303 format('FULLMODELNAME="',A,'" MODELNAME="',A,'" &
SUBMODELNAME="',A,'"')
303 format('MODELNAME="',A,'" SUBMODELNAME="',A,'"')

write(0,*)'FULLMODELNAME: ', FULLMODELNAME
! MODELNAME, SUBMODELNAME
write(0,*)'MODELNAME: ', MODELNAME, SUBMODELNAME

if (me==0) print 303,FULLMODELNAME,MODELNAME,SUBMODELNAME
if (me==0) print 303,MODELNAME,SUBMODELNAME
! assume for now that the first date in the stdin file is the start date
read(DateStr,300) iyear,imn,iday,ihrst,imin
if (me==0) write(*,*) 'in WRFPOST iyear,imn,iday,ihrst,imin', &
Expand All @@ -270,18 +267,11 @@ PROGRAM WRFPOST
120 format(a5)
121 format(a4)

!KaYee: Read in GFS/FV3 runs in Fortran Namelist Format.
if (me==0) print*,'MODELNAME= ',MODELNAME,'grib=',grib
!Chuang: If model is GFS, read in flux file name from unit5
if(MODELNAME == 'GFS' .OR. MODELNAME == 'FV3R') then
read(5,111,end=117) fileNameFlux
if (me == 0) print*,'first two file names in GFS or FV3= ' &
,trim(fileName),trim(fileNameFlux)
117 continue

read(5,111,end=118) fileNameD3D
if (me == 0) print*,'D3D names in GFS= ',trim(fileNameD3D)
118 continue

end if

!
Expand Down Expand Up @@ -312,11 +302,11 @@ PROGRAM WRFPOST
! gocart_on = .true.
! d3d_on = .true.

if(MODELNAME == 'RAPR') then
read(5,*,iostat=iret,end=119) kpo
else
!KaYee if(MODELNAME == 'RAPR') then
!KaYee read(5,*,iostat=iret,end=119) kpo
!KaYee else
read(5,nampgb,iostat=iret,end=119)
endif
!KaYee endif
! if(kpo > komax)print*,'pressure levels cannot exceed ',komax; STOP
! if(kth > komax)print*,'isent levels cannot exceed ',komax; STOP
! if(kpv > komax)print*,'PV levels cannot exceed ',komax; STOP
Expand All @@ -342,15 +332,15 @@ PROGRAM WRFPOST
if(me == 0) then
print*,'using pressure levels from POSTGPVARS'
endif
if(MODELNAME == 'RAPR')then
read(5,*) (po(l),l=1,kpo)
!KaYee if(MODELNAME == 'RAPR')then
!KaYee read(5,*) (po(l),l=1,kpo)
! CRA READ VALID TIME UNITS
read(5,121) VTIMEUNITS
if(me == 0) then
print*,'VALID TIME UNITS = ', VTIMEUNITS
endif
!KaYee read(5,121) VTIMEUNITS
kayeekayee marked this conversation as resolved.
Show resolved Hide resolved
!KaYee if(me == 0) then
!KaYee print*,'VALID TIME UNITS = ', VTIMEUNITS
!KaYee endif
! CRA
endif
!KaYee endif
lsm = kpo
if( .not. popascal ) then
untcnvt = 100.
Expand Down Expand Up @@ -380,13 +370,13 @@ PROGRAM WRFPOST
116 continue
!set control file name
fileNameFlat='postxconfig-NT.txt'
kayeekayee marked this conversation as resolved.
Show resolved Hide resolved
if(MODELNAME == 'GFS') then
!KaYee if(MODELNAME == 'GFS') then
! read(5,*) line
read(5,111,end=125) fileNameFlat
125 continue
!KaYee read(5,111,end=125) fileNameFlat
!KaYee 125 continue
! if(len_trim(fileNameFlat)<5) fileNameFlat = 'postxconfig-NT.txt'
if (me == 0) print*,'Post flat name in GFS= ',trim(fileNameFlat)
endif
!KaYee if (me == 0) print*,'Post flat name in GFS= ',trim(fileNameFlat)
!KaYee endif
! set PTHRESH for different models
if(MODELNAME == 'NMM')then
PTHRESH = 0.000004
Expand Down
16 changes: 9 additions & 7 deletions ush/gfs_nceppost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,15 @@ export DD=`echo $VDATE | cut -c7-8`
export HH=`echo $VDATE | cut -c9-10`

cat > itag <<EOF
$GFSOUT
${MODEL_OUT_FORM}
${GRIBVERSION}
${YY}-${MM}-${DD}_${HH}:00:00
GFS
$FLXINP
$D3DINP
&model_inputs
fileName='${GFSOUT}'
IOFORM='${MODEL_OUT_FORM}'
grib='${GRIBVERSION}'
DateStr='${YY}-${MM}-${DD}_${HH}:00:00'
MODELNAME='GFS'
fileNameFlux='${FLXINP}'
fileNameD3D='${D3DINP}'
/
EOF

cat postgp.inp.nml$$ >> itag
Expand Down