Skip to content

Commit

Permalink
Merge pull request #2 from daviddowellNOAA/fix_yongming_code
Browse files Browse the repository at this point in the history
Changes needed to run OU-MAP GSI-EnKF assimilation of reflectivity
  • Loading branch information
hu5970 authored May 26, 2022
2 parents 588ce98 + ce547a2 commit 599ccb5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/enkf/gridio_fv3reg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1235,10 +1235,12 @@ subroutine type_bound_setupfile(this,fileid1,fv3fn1,fileid2,fv3fn2,fileid3,fv3fn
this%l_filecombined=.false.
this%fv3lamfilename(1)=trim(fv3fn1)
this%fv3lamfilename(2)=trim(fv3fn2)
this%fv3lamfilename(3)=trim(fv3fn3)
this%fv3lam_fileid(1)=fileid1
this%fv3lam_fileid(2)=fileid2
this%fv3lam_fileid(3)=fileid3
if (present (fileid3)) then
this%fv3lamfilename(3)=trim(fv3fn3)
this%fv3lam_fileid(3)=fileid3
endif
else
this%l_filecombined=.true.
this%fv3lamfilename(1)=fv3fn1
Expand Down
28 changes: 27 additions & 1 deletion src/gsi/gsi_dbzOper.F90
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ subroutine setup_(self, lunin, mype, is, nobs, init_pass,last_pass)
use jfunc , only: jiter

use mpeu_util, only: die

use directDA_radaruse_mod, only: l_use_dbz_directDA
use obsmod, only: dirname, ianldate

implicit none
class(dbzOper ), intent(inout):: self
integer(i_kind), intent(in):: lunin
Expand All @@ -99,8 +103,30 @@ subroutine setup_(self, lunin, mype, is, nobs, init_pass,last_pass)
character(len=len_isis ):: isis
integer(i_kind):: nreal,nchanl,ier,nele
logical:: diagsave
integer(i_kind):: lu_diag
character(128):: diag_file
character(80):: string

if(nobs == 0) then

if(mype == 0) then
write(6,*) 'init_pass = ', init_pass
write(6,*) 'l_use_dbz_directDA = ', l_use_dbz_directDA
endif

if(nobs == 0) return
if( (mype == 0) .and. init_pass .and. (.not. l_use_dbz_directDA) ) then
write(string,600) jiter
600 format('radardbz_',i2.2)
diag_file=trim(dirname) // trim(string)
write(6,*) 'write ianldate to ', diag_file
open(newunit=lu_diag,file=trim(diag_file),form='unformatted',status='unknown',position='rewind')
write(lu_diag) ianldate
close(lu_diag)
endif

return

endif

read(lunin,iostat=ier) obstype,isis,nreal,nchanl
if(ier/=0) call die(myname_,'read(obstype,...), iostat =',ier)
Expand Down
21 changes: 15 additions & 6 deletions src/gsi/setupdbz.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1453,11 +1453,19 @@ subroutine setupdbz(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,radardbz_d
! Write information to diagnostic file
if(radardbz_diagsave .and. ii>0 )then

if( .not. l_use_dbz_directDA )then
write(7)'dbz',nchar,nreal,ii,mype,ioff0
write(7)cdiagbuf(1:ii),rdiagbuf(:,1:ii)
deallocate(cdiagbuf,rdiagbuf)
else
! DCD 25 May 2022: When the following if test returns "true", reflectivity diagnostics are written to
! the same diag file as for the conventional observations. However, separate conventional and reflectivity
! diagnostic files are what we typically want for EnKF assimilation, i.e., conventional observations
! are assimilated in the first execution of EnKF and then reflectivity observations are assimilated
! in a second execution of EnKF. It's unclear why the following if test appears
! in the EMC master GSI. For now, I've commented out this if test so that we'll always have
! the separate conventional and reflectivity diag files needed for a two-step EnKF analysis.

! if( .not. l_use_dbz_directDA )then
! write(7)'dbz',nchar,nreal,ii,mype,ioff0
! write(7)cdiagbuf(1:ii),rdiagbuf(:,1:ii)
! deallocate(cdiagbuf,rdiagbuf)
! else

write(string,600) jiter
600 format('radardbz_',i2.2)
Expand All @@ -1472,6 +1480,7 @@ subroutine setupdbz(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,radardbz_d
open(lu_diag,file=trim(diag_file),form='unformatted',status='unknown',position='rewind')
endif
endif

if(init_pass .and. mype == 0) then
if ( .not. l_use_dbz_directDA ) then ! EnKF uses these diagnostics and EnKF uses single OBS file for now.
write(lu_diag) ianldate ! So do not write analysis date for binary in case of using direct reflectivity DA.
Expand All @@ -1484,7 +1493,7 @@ subroutine setupdbz(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,radardbz_d
write(lu_diag)cdiagbuf(1:ii),rdiagbuf(:,1:ii)
deallocate(cdiagbuf,rdiagbuf)
close(lu_diag)
end if
! end if
end if
write(6,*)'mype, irefsmlobs,irejrefsmlobs are ',mype,' ',irefsmlobs, ' ',irejrefsmlobs
! close(52) !simulated obs
Expand Down

0 comments on commit 599ccb5

Please sign in to comment.