Skip to content

Commit

Permalink
Further bug fixes on read_radar.f90 and stpcalc.f90
Browse files Browse the repository at this point in the history
    1. The deter_zsfc_model and deter_sfc2 in read_radar_l2rw subroutine should still be used. Otherwise the uninitialized skint and zsges may cause issue in debug mode.
    2. The logic of L840-865 in stpcalc.f90 is supposed to find the historical minimum outpen looping i from 1 to nsteptot, where nsteptot can be greater than istp_iter (the maximum possible is 3*istp_iter+1 depend on how many times it tried to search).
      When it stored the minimum outpen stepsize at L846:
              stp(ii)=outstp(i)
      It used ii, which is istp_iter according to the if statement at L840.
      Then the istp_use at L848 should also be ii for consistency, otherwise it may exceed the array in debug mode.
      The if statement at L851 should use nsteptot instead of istp_iter as well.
From @XuLu-NOAA
  • Loading branch information
XuLu-NOAA committed Jan 26, 2024
1 parent e9fe5f0 commit 863b9b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/gsi/read_radar.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4233,11 +4233,10 @@ subroutine read_radar_l2rw(ndata,nodata,lunout,obstype,sis,nobs,hgtl_full)
rusage(ndata)=.false.
usage=r100
end if
call deter_zsfc_model(dlat,dlon,zsges)

! Get information from surface file necessary for conventional data here
! call deter_zsfc_model(dlat,dlon,zsges)
! call deter_sfc2(dlat_earth,dlon_earth,t4dv,idomsfc,skint,ff10,sfcr)
call deter_zsfc_model(dlat,dlon,zsges)
call deter_sfc2(dlat_earth,dlon_earth,t4dvo,idomsfc,skint,ff10,sfcr)

nsuper2_kept=nsuper2_kept+1
cdata(1) = error ! wind obs error (m/s)
Expand Down
4 changes: 2 additions & 2 deletions src/gsi/stpcalc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,10 @@ subroutine stpcalc(stpinout,sval,sbias,dirx,dval,dbias, &
if(outpen(i) < outpensave)then
stp(ii)=outstp(i)
outpensave=outpen(i)
istp_use=i
istp_use=ii
end if
end do
if(istp_use /= istp_iter) then
if(istp_use /= nsteptot) then
final_ii=ii
exit stepsize
end if
Expand Down

0 comments on commit 863b9b9

Please sign in to comment.