Skip to content

Commit

Permalink
Final set of changes so that it will pass regression tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jderber-NOAA committed Dec 10, 2023
1 parent 5e82291 commit 603b5c8
Show file tree
Hide file tree
Showing 19 changed files with 987 additions and 951 deletions.
3 changes: 1 addition & 2 deletions src/gsi/ensctl2state.f90
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,7 @@ subroutine ensctl2state_ad(eval,mval,grad)
end if

! Get the ozone vector if it is defined
id=getindex(cvars3d,"oz")
if(id > 0) then
if(idozone > 0) then
call gsi_bundlegetpointer (eval(jj),'oz' ,rv_oz , istatus)
call gsi_bundleputvar ( wbundle_c, 'oz', rv_oz, istatus )
endif
Expand Down
2 changes: 1 addition & 1 deletion src/gsi/gsisub.F90
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ subroutine gsisub(init_pass,last_pass)
end if
if(last_pass) call observer_finalize()
#ifndef HAVE_ESMF
call destroy_gesfinfo() ! paired with gesinfo()
call destroy_gesfinfo() ! paired with gesinfo()
#endif
else
call glbsoi
Expand Down
3 changes: 2 additions & 1 deletion src/gsi/intw.f90
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ subroutine intw_(whead,rval,sval)
use constants, only: half,one,tiny_r_kind,cg_term,r3600,two
use obsmod, only: lsaveobsens,l_do_adjoint,luse_obsdiag
use qcmod, only: nlnqc_iter,varqc_iter,njqc,vqc,nvqc,hub_norm
use jfunc, only: jiter
use jfunc, only: jiter,iter
use gsi_bundlemod, only: gsi_bundle
use gsi_bundlemod, only: gsi_bundlegetpointer
use gsi_4dvar, only: ladtest_obs
use pvqc, only: vqch,vqcs
use mpimod, only: mype
implicit none

! Declare passed variables
Expand Down
4 changes: 2 additions & 2 deletions src/gsi/obs_para.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ subroutine obs_para(ndata,mype)
! grid.
!
! input argument list:
! ndata(*,1)- number of prefiles retained for further processing
! ndata(*,1)- number of profiles retained for further processing
! ndata(*,2)- number of observations read
! ndata(*,3)- number of observations keep after read
! mype - mpi task number
! ipoint - pointer in array containing information about all obs type to process
!
! output argument list:
!
Expand Down Expand Up @@ -212,6 +211,7 @@ subroutine disobs(ndata,nobs,mm1,lunout,obsfile,obstypeall)
!$$$
use kinds, only: r_kind,i_kind
use gridmod, only: periodic_s,nlon,nlat,jlon1,ilat1,istart,jstart
use mpimod, only: mype
implicit none

! Declare passed variables
Expand Down
9 changes: 5 additions & 4 deletions src/gsi/pcgsoi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,17 @@ subroutine pcgsoi()
enddo
endif


! Adjoint of control to state
call c2s_ad(gradx,rval,rbias,llprt)

! Print initial Jo table
if (iter==0) then
! if(print_diag_pcg .and. luse_obsdiag) then
! nprt=2
! call evaljo(zjo,iobs,nprt,llouter)
if(print_diag_pcg .and. luse_obsdiag) then
nprt=2
call evaljo(zjo,iobs,nprt,llouter)
call prt_control_norms(gradx,'gradx')
! end if
end if
endif

! Add contribution from background term
Expand Down
23 changes: 10 additions & 13 deletions src/gsi/read_dbz_nc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no
logical, allocatable,dimension(:) :: rusage,rthin
logical save_all
! integer(i_kind) numthin,numqc,numrem
integer(i_kind) ndata_start,ndata_end,pmot,numall
integer(i_kind) nxdata,pmot,numall

character(8) cstaid
character(4) this_staid
Expand Down Expand Up @@ -345,16 +345,15 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no
pmot=pmot_dbz
if(reduce_diag .and. pmot < 2)pmot=pmot+2
save_all=.false.
if(pmot /= 2) save_all=.true.
ndata_start=ndata+1
if(pmot /= 2 .and. pmot /= 0) save_all=.true.
rusage = .true.
rthin = .false.

ILOOP : &
do i = 1, dims(ivar,1)
do j = 1, dims(ivar,2)
do k = 1, dims(ivar,3)

rusage = .true.
rthin = .false.

imissing2nopcp = 0
! Missing data in the input file have the value -999.0
Expand Down Expand Up @@ -525,12 +524,13 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no
end do ! j
end do ILOOP ! i

numall=ndata-ndata_start+1
if(numall > 0)then
nxdata=ndata
ndata=0
if(nxdata > 0)then
! numthin=0
! numqc=0
! numrem=0
! do i=ndata_start,ndata
! do i=1,ndata
! if(.not. rusage(i))then
! numqc=numqc+1
! else if(rthin(i))then
Expand All @@ -543,9 +543,7 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no

! If flag to not save thinned data is set - compress data
if(pmot /= 1)then
ndata_end=ndata
ndata=ndata_start-1
do i=ndata_start,ndata_end
do i=1,nxdata
! pmot=0 - all obs - thin obs
! pmot=1 - all obs
! pmot=2 - use obs
Expand All @@ -565,8 +563,7 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no
end if
end if

nodata=nodata+2*(ndata-ndata_start+1)
ndata_start=ndata+1
nodata=nodata+nxdata

deallocate(dbzQC,lat,lon)

Expand Down
26 changes: 11 additions & 15 deletions src/gsi/read_fl_hdob.f90
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
logical, allocatable,dimension(:) :: rusage,rthin
logical save_all
! integer(i_kind) numthin,numqc,numrem
integer(i_kind) pmot,iqm,numall
integer(i_kind) ndata_end,ndata_start
integer(i_kind) pmot,iqm,numall
integer(i_kind) nxdata

! Real variables
real(r_kind), parameter :: r0_001 = 0.001_r_kind
Expand Down Expand Up @@ -358,8 +358,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
pmot=nint(pmot_conv(nc))
if(reduce_diag .and. pmot < 2)pmot=pmot+2
save_all=.false.
if(pmot /= 2) save_all=.true.
ndata_start=ndata+1
if(pmot /= 2 .and. pmot /= 0) save_all=.true.


!------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1178,12 +1177,13 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
call del3grids
endif

numall=ndata-ndata_start+1
if(numall > 0)then
nxdata=ndata
ndata=0
if(nxdata > 0)then
! numthin=0
! numqc=0
! numrem=0
! do i=ndata_start,ndata
! do i=1,ndata
! if(.not. rusage(i))then
! numqc=numqc+1
! else if(rthin(i))then
Expand All @@ -1196,16 +1196,14 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
! numrem,numqc,numthin
! If thinned data set quality mark to 16
if (ithin > 0 .and. ithin <5) then
do i=ndata_start,ndata
do i=1,nxdata
if(rthin(i))cdata_all(iqm,i)=14
end do
end if

! If flag to not save thinned data is set - compress data
if(pmot /= 1)then
ndata_end=ndata
ndata=ndata_start-1
do i=ndata_start,ndata_end
do i=1,nxdata

! pmot=0 - all obs - thin obs
! pmot=1 - all obs
Expand All @@ -1226,12 +1224,10 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
end if
end if
if(luvob)then
nodata=nodata+2*(ndata-ndata_start + 1)
nodata=nodata+2*ndata
else
nodata=nodata+ndata-ndata_start + 1
nodata=nodata+nxdata
end if
ndata_start=ndata+1


! Write header record and data to output file for further processing
! deallocate(etabl)
Expand Down
Loading

0 comments on commit 603b5c8

Please sign in to comment.