From 60ffd70a2e03e0ef469346bf77a5a30eb9f79112 Mon Sep 17 00:00:00 2001 From: Jack Woollen Date: Fri, 21 Jul 2023 13:05:05 +0000 Subject: [PATCH] fix ppb/r100 bug plus misc comment improvement --- src/gsi/read_satwnd.f90 | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/gsi/read_satwnd.f90 b/src/gsi/read_satwnd.f90 index de1d38a5d2..c31d056ba5 100644 --- a/src/gsi/read_satwnd.f90 +++ b/src/gsi/read_satwnd.f90 @@ -278,8 +278,8 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ntx(ntread)=0 ntxall=0 do nc=1,nconvtype - if( (trim(ioctype(nc)) == 'uv' .or. trim(ioctype(nc)) == 'wspd10m' .or. trim(ioctype(nc)) == 'uwnd10m' .or. trim(ioctype(nc)) == 'vwnd10m') .and. ictype(nc) >=240 & - .and. ictype(nc) <=265) then + if((trim(ioctype(nc)) == 'uv' .or. trim(ioctype(nc)) == 'wspd10m' .or. trim(ioctype(nc)) == 'uwnd10m' .or. & + trim(ioctype(nc)) == 'vwnd10m') .and. ictype(nc) >=240 .and. ictype(nc) <=265) then ntmatch=ntmatch+1 ntxall(ntmatch)=nc ithin=ithin_conv(nc) @@ -289,6 +289,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis end if end if end do + if(ntmatch == 0)then write(6,*) ' READ_SATWND: no matching obstype found in obsinfo ',obstype return @@ -301,7 +302,6 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis call getcount_bufr(infile,nmsgmax,mxtb) allocate(lmsg(nmsgmax,ntread),tab(mxtb,3),nrep(nmsgmax)) - lmsg = .false. maxobs=0 @@ -599,10 +599,9 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ilat=3 rusage=101.0_r_kind -! Open, then read date from bufr data -!! read satellite winds one type a time - loop_convinfo: do nx=1,ntread + + ! set parameters for processing the next satwind type use_all = .true. use_all_tm = .true. ithin=0 @@ -644,8 +643,8 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif endif + ! Open and read the file once for each satwnd type call closbf(lunin) - close(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -680,7 +679,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis qify=r110 qm=2 -! Test for BUFR version using lat/lon mnemonics + ! test for BUFR version using lat/lon mnemonics call ufbint(lunin,hdrdat_test,2,1,iret, 'CLAT CLON') if ( hdrdat_test(1) > 100000000.0_r_kind .and. hdrdat_test(2) > 100000000.0_r_kind ) then call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v2) @@ -690,20 +689,19 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis call ufbint(lunin,obsdat,4,1,iret,obstr_v1) endif -! run qc if the ob has qc information - + ! reject data with missing pressure or wind ppb=obsdat(2) - if (ppb > 100000000.0_r_kind .or. & - hdrdat(3) >100000000.0_r_kind .or. & - obsdat(4) > 100000000.0_r_kind) cycle loop_readsb - if(ppb >r10000) ppb=ppb/r100 + if (ppb>rmiss .or. hdrdat(3)>rmiss .or. obsdat(4)>rmiss) cycle loop_readsb + ppb=ppb/r100 + + ! reject date above 125mb (or 850 for regional) if (ppb r90 ) cycle loop_readsb if( hdrdat(3) =240.and.itype<=279) icnt(itype)=icnt(itype)+1 ! test for PCCF or MANDATORY QC - if none exists skip over the extra blocks