From 863b9b99cc10ce74ad90345ea8523173d9df3e39 Mon Sep 17 00:00:00 2001 From: XL-OU Date: Fri, 26 Jan 2024 14:42:39 -0600 Subject: [PATCH] Further bug fixes on read_radar.f90 and stpcalc.f90 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 --- src/gsi/read_radar.f90 | 5 ++--- src/gsi/stpcalc.f90 | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gsi/read_radar.f90 b/src/gsi/read_radar.f90 index fd6ed8e8f7..a824bbbe4e 100644 --- a/src/gsi/read_radar.f90 +++ b/src/gsi/read_radar.f90 @@ -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) diff --git a/src/gsi/stpcalc.f90 b/src/gsi/stpcalc.f90 index c66bb58291..34030763db 100644 --- a/src/gsi/stpcalc.f90 +++ b/src/gsi/stpcalc.f90 @@ -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