From 09c724532eda98a7429e815330c23be4942b78db Mon Sep 17 00:00:00 2001 From: wx20jjung Date: Tue, 3 Sep 2024 11:50:03 +0000 Subject: [PATCH] Fixed "NAN" issue for brightness temperatures in read_iasi.f90 These were caused by the radiance scaling factor being missing in the DBNet data. Corrected sending in profile counts into combine_radobs instead of total channel counts in most satellite data read routines. Not all of them were tested. Several no longer exist. --- src/gsi/combine_radobs.f90 | 2 +- src/gsi/read_abi.f90 | 6 ++++-- src/gsi/read_aerosol.f90 | 6 ++++-- src/gsi/read_ahi.f90 | 7 +++++-- src/gsi/read_airs.f90 | 7 +++++-- src/gsi/read_amsr2.f90 | 6 ++++-- src/gsi/read_amsre.f90 | 7 +++++-- src/gsi/read_atms.f90 | 6 ++++-- src/gsi/read_avhrr.f90 | 7 +++++-- src/gsi/read_avhrr_navy.f90 | 7 +++++-- src/gsi/read_bufrtovs.f90 | 8 +++++--- src/gsi/read_cris.f90 | 8 +++++--- src/gsi/read_gmi.f90 | 7 +++++-- src/gsi/read_goesimg.f90 | 6 ++++-- src/gsi/read_goesndr.f90 | 5 +++-- src/gsi/read_iasi.f90 | 20 +++++++++++--------- src/gsi/read_saphir.f90 | 7 ++++--- src/gsi/read_ssmi.f90 | 6 ++++-- src/gsi/read_ssmis.f90 | 6 ++++-- src/gsi/read_viirs.f90 | 6 +++--- 20 files changed, 90 insertions(+), 50 deletions(-) diff --git a/src/gsi/combine_radobs.f90 b/src/gsi/combine_radobs.f90 index 7692bdef3b..5c32188748 100644 --- a/src/gsi/combine_radobs.f90 +++ b/src/gsi/combine_radobs.f90 @@ -74,7 +74,7 @@ subroutine combine_radobs(mype_sub,mype_root,& nread=0 if (mype_sub==mype_root) nread = ncounts1 - if (ncounts1 == 0)return + if (ncounts1 <= 0)return ! Allocate arrays to hold data diff --git a/src/gsi/read_abi.f90 b/src/gsi/read_abi.f90 index eaa6b1675f..40f8f8e3be 100644 --- a/src/gsi/read_abi.f90 +++ b/src/gsi/read_abi.f90 @@ -92,7 +92,7 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& integer(i_kind) nmind,lnbufr,idate,ilat,ilon,nhdr,nchn,ncld,nbrst,jj integer(i_kind) ireadmg,ireadsb,iret,nreal,nele,itt integer(i_kind) itx,i,k,isflg,kidsat,n,iscan,idomsfc - integer(i_kind) idate5(5),maxinfo + integer(i_kind) idate5(5),maxinfo, number_profiles integer(i_kind),allocatable,dimension(:)::nrec real(r_kind) dg2ew,sstime,tdiff,t4dv,sfcr @@ -501,11 +501,13 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& enddo read_loop enddo read_msg + number_profiles = count(nrec(:) /= 999999,dim=1) + call closbf(lnbufr) close(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, ! and write out data to scratch file for further processing. diff --git a/src/gsi/read_aerosol.f90 b/src/gsi/read_aerosol.f90 index a58b2d4358..09a0419846 100644 --- a/src/gsi/read_aerosol.f90 +++ b/src/gsi/read_aerosol.f90 @@ -152,7 +152,7 @@ subroutine read_aerosol(nread,ndata,nodata,jsatid,infile,gstime,lunout, & 'SAID CLATH CLONH YEAR MNTH DAYS HOUR MINU SOZA SOLAZI RSST AOTQ RETRQ' integer(i_kind), parameter :: mxib = 20,imax=6 - integer(i_kind) :: nib + integer(i_kind) :: nib, number_profiles integer(i_kind) :: ibit(mxib) integer(i_kind) :: itx, itt, irec @@ -351,8 +351,10 @@ subroutine read_aerosol(nread,ndata,nodata,jsatid,infile,gstime,lunout, & end do read_modis + number_profiles = count(nrec(:) /= 999999,dim=1) + call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - naerodat,itxmax,nread,ndata,aeroout,score_crit,nrec) + naerodat,itxmax,number_profiles,ndata,aeroout,score_crit,nrec) if ( mype_sub == mype_root ) then do n = 1, ndata diff --git a/src/gsi/read_ahi.f90 b/src/gsi/read_ahi.f90 index 5191bbee19..b54a835d7b 100644 --- a/src/gsi/read_ahi.f90 +++ b/src/gsi/read_ahi.f90 @@ -98,7 +98,7 @@ subroutine read_ahi(mype,val_img,ithin,rmesh,jsatid,gstime,& integer(i_kind) nmind,lnbufr,idate,ilat,ilon integer(i_kind) ireadmg,ireadsb,iret,nreal,nele,itt integer(i_kind) itx,i,k,isflg,kidsat,n,iscan,idomsfc - integer(i_kind) idate5(5) + integer(i_kind) idate5(5),number_profiles integer(i_kind),allocatable,dimension(:)::nrec real(r_kind) dg2ew,sstime,tdiff,t4dv,sfcr @@ -511,11 +511,14 @@ subroutine read_ahi(mype,val_img,ithin,rmesh,jsatid,gstime,& enddo read_loop enddo read_msg + + number_profiles = count(nrec(:) /= 999999,dim=1) + call closbf(lnbufr) close(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! If no observations read, jump to end of routine. if (mype_sub==mype_root.and.ndata>0) then diff --git a/src/gsi/read_airs.f90 b/src/gsi/read_airs.f90 index c5392dad14..9647d4af8e 100644 --- a/src/gsi/read_airs.f90 +++ b/src/gsi/read_airs.f90 @@ -160,7 +160,7 @@ subroutine read_airs(mype,val_airs,ithin,isfcalc,rmesh,jsatid,gstime,& character(len=512) :: table_file integer(i_kind) :: lnbufr = 10 integer(i_kind) :: lnbufrtab = 11 - integer(i_kind) :: irec,next + integer(i_kind) :: irec,next, number_profiles ! Variables for BUFR IO real(r_double) :: crchn_reps @@ -860,6 +860,9 @@ subroutine read_airs(mype,val_airs,ithin,isfcalc,rmesh,jsatid,gstime,& enddo read_loop enddo read_subset + + number_profiles = count(nrec(:) /= 999999,dim=1) + deallocate(allchan, chan_map, bufr_chan_test) call closbf(lnbufr) ! Close bufr file close(lnbufr) @@ -868,7 +871,7 @@ subroutine read_airs(mype,val_airs,ithin,isfcalc,rmesh,jsatid,gstime,& ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,nread,number_profiles,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, ! and write out data to scratch file for further processing. diff --git a/src/gsi/read_amsr2.f90 b/src/gsi/read_amsr2.f90 index 9d8d4944d9..cfbf60089e 100644 --- a/src/gsi/read_amsr2.f90 +++ b/src/gsi/read_amsr2.f90 @@ -128,7 +128,7 @@ subroutine read_amsr2(mype,val_amsr2,ithin,rmesh,jsatid,gstime,& real(r_kind) :: dist1 real(r_kind),allocatable,dimension(:,:):: data_all integer(i_kind),allocatable,dimension(:)::nrec - integer(i_kind):: irec,next + integer(i_kind):: irec,next, number_profiles integer(i_kind):: method,iobs,num_obs integer(i_kind),parameter :: maxobs=2e7 @@ -659,11 +659,13 @@ subroutine read_amsr2(mype,val_amsr2,ithin,rmesh,jsatid,gstime,& enddo obsloop + number_profiles = count(nrec(:) /= 999999,dim=1) + ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, ! and write out data to scratch file for further processing. diff --git a/src/gsi/read_amsre.f90 b/src/gsi/read_amsre.f90 index ef0c2ad2bb..d36e34a4e2 100755 --- a/src/gsi/read_amsre.f90 +++ b/src/gsi/read_amsre.f90 @@ -169,7 +169,7 @@ subroutine read_amsre(mype,val_amsre,ithin,isfcalc,rmesh,jsatid,gstime,& real(r_kind) :: pred, crit1, dist1 real(r_kind),allocatable,dimension(:,:):: data_all integer(i_kind),allocatable,dimension(:)::nrec - integer(i_kind):: irec,next + integer(i_kind):: irec,next,number_profiles real(r_kind),dimension(0:3):: sfcpct real(r_kind),dimension(0:4):: rlndsea real(r_kind),dimension(0:3):: ts @@ -644,6 +644,9 @@ subroutine read_amsre(mype,val_amsre,ithin,isfcalc,rmesh,jsatid,gstime,& enddo read_loop enddo read_msg + + number_profiles = count(nrec(:) /= 999999,dim=1) + call closbf(lnbufr) close(lnbufr) @@ -651,7 +654,7 @@ subroutine read_amsre(mype,val_amsre,ithin,isfcalc,rmesh,jsatid,gstime,& ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, diff --git a/src/gsi/read_atms.f90 b/src/gsi/read_atms.f90 index 424843a7c1..47884b7909 100644 --- a/src/gsi/read_atms.f90 +++ b/src/gsi/read_atms.f90 @@ -134,7 +134,7 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& character(80) hdr1b,hdr2b integer(i_kind) ireadsb,ireadmg,nrec_startx - integer(i_kind) i,j,k,ntest,iob,llll + integer(i_kind) i,j,k,ntest,iob,llll, number_profiles integer(i_kind) iret,idate,nchanl,n,idomsfc(1) integer(i_kind) ich1,ich2,ich8,ich15,ich16,ich17 integer(i_kind) kidsat,maxinfo @@ -792,8 +792,10 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& DEALLOCATE(solazi_save) DEALLOCATE(bt_save) + number_profiles = count(nrec(:) /= 999999,dim=1) + call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! if(mype_sub==mype_root)then diff --git a/src/gsi/read_avhrr.f90 b/src/gsi/read_avhrr.f90 index c1509828ad..3e02af0d45 100755 --- a/src/gsi/read_avhrr.f90 +++ b/src/gsi/read_avhrr.f90 @@ -166,7 +166,7 @@ subroutine read_avhrr(mype,val_avhrr,ithin,rmesh,jsatid,& real(r_double), dimension(13) :: hdr real(r_double), dimension(3,5) :: bufrf - integer(i_kind) :: lnbufr,ireadsb,ireadmg,iskip,irec,next + integer(i_kind) :: lnbufr,ireadsb,ireadmg,iskip,irec,next,number_profiles integer(i_kind), allocatable, dimension(:) :: nrec real(r_kind), allocatable, dimension(:) :: amesh real(r_kind), allocatable, dimension(:) :: hsst_thd @@ -562,10 +562,13 @@ subroutine read_avhrr(mype,val_avhrr,ithin,rmesh,jsatid,& enddo read_loop enddo read_msg + + number_profiles = count(nrec(:) /= 999999,dim=1) + call closbf(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata_mesh,data_mesh,score_crit,nrec) + nele,itxmax,number_profiles,ndata_mesh,data_mesh,score_crit,nrec) if ( nread > 0 ) then write(*,'(a,a10,I3,F6.1,3I10)') 'read_avhrr,satid,imesh,amesh,itxmax,nread,ndata_mesh : ',jsatid,imesh,amesh(imesh),itxmax,nread,ndata_mesh diff --git a/src/gsi/read_avhrr_navy.f90 b/src/gsi/read_avhrr_navy.f90 index dd5a64083a..817028498d 100644 --- a/src/gsi/read_avhrr_navy.f90 +++ b/src/gsi/read_avhrr_navy.f90 @@ -135,7 +135,7 @@ subroutine read_avhrr_navy(mype,val_avhrr,ithin,rmesh,jsatid,& integer(i_kind) itx,k,i,bufsat integer(i_kind) ireadsb,ireadmg integer(i_kind) nreal,nele,itt - integer(i_kind) nlat_sst,nlon_sst,irec,next + integer(i_kind) nlat_sst,nlon_sst,irec,next, number_profiles integer(i_kind),allocatable,dimension(:)::nrec real(r_kind) dlon,dlat,sfcr @@ -255,6 +255,7 @@ subroutine read_avhrr_navy(mype,val_avhrr,ithin,rmesh,jsatid,& next=0 ! Read BUFR Navy data + nrec = 999999 irec=0 read_msg: do while (ireadmg(lnbufr,subset,idate) >= 0) irec=irec+1 @@ -463,8 +464,10 @@ subroutine read_avhrr_navy(mype,val_avhrr,ithin,rmesh,jsatid,& ! Normal exit 700 continue + number_profiles = count(nrec(:) /= 999999,dim=1) + call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Now that we've identified the "best" observations, pull out best obs diff --git a/src/gsi/read_bufrtovs.f90 b/src/gsi/read_bufrtovs.f90 index 2fc14b5cdf..5e0fde2c04 100644 --- a/src/gsi/read_bufrtovs.f90 +++ b/src/gsi/read_bufrtovs.f90 @@ -192,7 +192,7 @@ subroutine read_bufrtovs(mype,val_tovs,ithin,isfcalc,& character(len=8) :: subset character(len=80):: hdr1b,hdr2b - integer(i_kind) ireadsb,ireadmg,irec,next,nrec_startx + integer(i_kind) ireadsb,ireadmg,irec,next,nrec_startx, number_profiles integer(i_kind) i,j,k,ifov,ntest,llll integer(i_kind) sacv integer(i_kind) iret,idate,nchanl,n,idomsfc(1) @@ -490,7 +490,7 @@ subroutine read_bufrtovs(mype,val_tovs,ithin,isfcalc,& hdr2b ='SAZA SOZA BEARAZ SOLAZI' allocate(data_all(nele,itxmax),data1b8(nchanl),data1b4(nchanl),nrec(itxmax)) - + nrec = 999999 next=0 irec=0 ! Big loop over standard data feed and possible ears/db data @@ -1061,8 +1061,10 @@ subroutine read_bufrtovs(mype,val_tovs,ithin,isfcalc,& end do ears_db_loop deallocate(data1b8,data1b4) + number_profiles = count(nrec(:) /= 999999,dim=1) + call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! if(mype_sub==mype_root)then diff --git a/src/gsi/read_cris.f90 b/src/gsi/read_cris.f90 index 84288a7f04..38e820e7e0 100644 --- a/src/gsi/read_cris.f90 +++ b/src/gsi/read_cris.f90 @@ -187,7 +187,7 @@ subroutine read_cris(mype,val_cris,ithin,isfcalc,rmesh,jsatid,gstime,& integer(i_kind):: ntest integer(i_kind):: error_status, irecx,ierr integer(i_kind):: radedge_min, radedge_max - integer(i_kind):: bufr_size + integer(i_kind):: bufr_size, number_profiles character(len=20),allocatable,dimension(:) :: sensorlist ! Imager cluster information for CADS @@ -455,7 +455,7 @@ subroutine read_cris(mype,val_cris,ithin,isfcalc,rmesh,jsatid,gstime,& ! Big loop to read data file next=0 irec=0 - nrec = 99999 + nrec = 999999 ! Big loop over standard data feed and possible rars/db data ! llll=1 is normal feed, llll=2 RARS data, llll=3 DB/UW data) ears_db_loop: do llll= 1, 3 @@ -1013,11 +1013,13 @@ subroutine read_cris(mype,val_cris,ithin,isfcalc,rmesh,jsatid,gstime,& if (error_status /= success) & write(6,*)'OBSERVER: ***ERROR*** crtm_spccoeff_destroy error_status=',error_status + number_profiles = count(nrec(:) /= 999999,dim=1) + ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, ! and write out data to scratch file for further processing. diff --git a/src/gsi/read_gmi.f90 b/src/gsi/read_gmi.f90 index 6ad4d829a3..27bff7000d 100644 --- a/src/gsi/read_gmi.f90 +++ b/src/gsi/read_gmi.f90 @@ -165,7 +165,7 @@ subroutine read_gmi(mype,val_gmi,ithin,rmesh,jsatid,gstime,& logical :: assim,outside,iuse logical :: do_noise_reduction - integer(i_kind):: i,k,ntest,ireadsb,ireadmg,irec,next,j + integer(i_kind):: i,k,ntest,ireadsb,ireadmg,irec,number_profiles,next,j integer(i_kind):: iret,idate,nchanl,nchanla integer(i_kind):: isflg,nreal,idomsfc integer(i_kind):: nmind,itx,nele,itt @@ -782,10 +782,13 @@ subroutine read_gmi(mype,val_gmi,ithin,rmesh,jsatid,gstime,& nrec(itx)=irec end do obsloop + number_profiles = count(nrec(:) /= 999999,dim=1) + ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) + if( mype_sub==mype_root) write(6,*) 'READ_GMI: after combine_obs, nread,ndata is ',nread,ndata !========================================================================================================= diff --git a/src/gsi/read_goesimg.f90 b/src/gsi/read_goesimg.f90 index bf40a1f163..4de04e6969 100644 --- a/src/gsi/read_goesimg.f90 +++ b/src/gsi/read_goesimg.f90 @@ -116,7 +116,7 @@ subroutine read_goesimg(mype,val_img,ithin,rmesh,jsatid,gstime,& character(8) subset - integer(i_kind) nchanl,ilath,ilonh,ilzah,iszah,irec,next + integer(i_kind) nchanl,ilath,ilonh,ilzah,iszah,irec,next, number_profiles integer(i_kind) nmind,lnbufr,idate,ilat,ilon,maxinfo integer(i_kind) ireadmg,ireadsb,iret,nreal,nele,itt integer(i_kind) itx,i,k,isflg,kidsat,n,iscan,idomsfc @@ -410,8 +410,10 @@ subroutine read_goesimg(mype,val_img,ithin,rmesh,jsatid,gstime,& enddo read_loop enddo read_msg + number_profiles = count(nrec(:) /= 999999,dim=1) + call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! If no observations read, jump to end of routine. if (mype_sub==mype_root.and.ndata>0) then diff --git a/src/gsi/read_goesndr.f90 b/src/gsi/read_goesndr.f90 index 7c55b6ab4c..041437e367 100644 --- a/src/gsi/read_goesndr.f90 +++ b/src/gsi/read_goesndr.f90 @@ -147,7 +147,7 @@ subroutine read_goesndr(mype,val_goes,ithin,rmesh,jsatid,infile,& integer(i_kind) itx,k,i,itt,iskip,l,ifov,n integer(i_kind) ichan8,ich8 integer(i_kind) nele,iscan,nmind - integer(i_kind) ntest,ireadsb,ireadmg,irec,next + integer(i_kind) ntest,ireadsb,ireadmg,irec,next, number_profiles integer(i_kind),dimension(5):: idate5 integer(i_kind),allocatable,dimension(:)::nrec integer(i_kind) ibfms ! BUFR missing value function @@ -515,12 +515,13 @@ subroutine read_goesndr(mype,val_goes,ithin,rmesh,jsatid,infile,& call closbf(lnbufr) close(lnbufr) + number_profiles = count(nrec(:) /= 999999,dim=1) ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, diff --git a/src/gsi/read_iasi.f90 b/src/gsi/read_iasi.f90 index 75dc50bb76..d2f9157a38 100644 --- a/src/gsi/read_iasi.f90 +++ b/src/gsi/read_iasi.f90 @@ -219,7 +219,7 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& integer(i_kind):: error_status, irecx,ierr integer(i_kind):: radedge_min, radedge_max integer(i_kind) :: subset_start, subset_end, satinfo_nchan, sc_chan, bufr_chan - integer(i_kind) :: sfc_channel_index + integer(i_kind) :: sfc_channel_index, number_profiles integer(i_kind),allocatable, dimension(:) :: channel_number, sc_index, bufr_index integer(i_kind),allocatable, dimension(:) :: bufr_chan_test character(len=20),allocatable, dimension(:):: sensorlist @@ -711,14 +711,14 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& iexponent = -(nint(cscale(3,i)) - 5) sscale(i)=ten**iexponent else - sscale(i)=0.0_r_kind + sscale(i)= zero endif end do ! Read IASI channel number(CHNM) and radiance (SCRA) call ufbseq(lnbufr,allchan,2,bufr_nchan,iret,'IASICHN') jstart=1 - scalef=one + scalef=zero do i=1,bufr_nchan scaleloop: do j=jstart,10 if(allchan(1,i) >= cscale(1,j) .and. allchan(1,i) <= cscale(2,j))then @@ -757,17 +757,17 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& cycle read_loop endif + temperature(:) = tbmin !$omp parallel do schedule(dynamic,1) private(i,sc_chan,bufr_chan,radiance) channel_loop: do i=1,satinfo_nchan bufr_chan = bufr_index(i) if (bufr_chan > 0 ) then ! check that channel number is within reason - if (( allchan(2,bufr_chan) > zero .and. allchan(2,bufr_chan) < 99999._r_kind)) then ! radiance bounds + if (( allchan(2,bufr_chan) > zero .and. allchan(2,bufr_chan) < 99999._r_kind) & ! radiance bounds + .and. scalef(bufr_chan) > zero ) then ! radiance scale factor exists radiance = allchan(2,bufr_chan)*scalef(bufr_chan) sc_chan = sc_index(i) call crtm_planck_temperature(sensorindex_iasi,sc_chan,radiance,temperature(bufr_chan)) - else - temperature(bufr_chan) = tbmin endif end if end do channel_loop @@ -777,8 +777,8 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& skip_loop: do i=1,satinfo_nchan if ( bufr_index(i) == 0 ) cycle skip_loop bufr_chan = bufr_index(i) - if(temperature(bufr_chan) <= tbmin .or. temperature(bufr_chan) > tbmax ) then - temperature(bufr_chan) = min(tbmax,max(tbmin,temperature(bufr_chan))) + if(temperature(bufr_chan) <= tbmin .or. temperature(bufr_chan) >= tbmax ) then + temperature(bufr_chan) = tbmin if(iuse_rad(ioff+i) >= 0)iskip = iskip + 1 endif end do skip_loop @@ -970,6 +970,8 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& end do ears_db_loop + number_profiles = count(nrec(:) /= 999999,dim=1) + deallocate(temperature, allchan, bufr_chan_test,scalef) deallocate(channel_number,sc_index) deallocate(bufr_index) @@ -982,7 +984,7 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, ! and write out data to scratch file for further processing. diff --git a/src/gsi/read_saphir.f90 b/src/gsi/read_saphir.f90 index 06e992b03d..18f070b479 100644 --- a/src/gsi/read_saphir.f90 +++ b/src/gsi/read_saphir.f90 @@ -110,7 +110,7 @@ subroutine read_saphir(mype,val_tovs,ithin,isfcalc,& character(8) :: subset character(80) :: hdr1b,hdr2b - integer(i_kind) :: ireadsb,ireadmg,irec + integer(i_kind) :: ireadsb,ireadmg, number_profiles integer(i_kind) :: i,j,k,ntest,iob integer(i_kind) :: iret,idate,nchanl,n,idomsfc(1) integer(i_kind) :: kidsat,maxinfo @@ -293,7 +293,6 @@ subroutine read_saphir(mype,val_tovs,ithin,isfcalc,& ! hdr2b ='AGIND SOZA BEARAZ SOLAZI' ! AGIND instead of SAZA ! Loop to read bufr file - irec=0 read_subset: do while(ireadmg(lnbufr,subset,idate)>=0 .AND. iob < maxobs) read_loop: do while (ireadsb(lnbufr)==0 .and. iob < maxobs) @@ -601,8 +600,10 @@ subroutine read_saphir(mype,val_tovs,ithin,isfcalc,& DEALLOCATE(solazi_save) DEALLOCATE(bt_save) + number_profiles = count(nrec(:) /= 999999,dim=1) + call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) if(mype_sub==mype_root)then do n=1,ndata diff --git a/src/gsi/read_ssmi.f90 b/src/gsi/read_ssmi.f90 index cece78ac03..ac5d251adf 100755 --- a/src/gsi/read_ssmi.f90 +++ b/src/gsi/read_ssmi.f90 @@ -142,7 +142,7 @@ subroutine read_ssmi(mype,val_ssmi,ithin,rmesh,jsatid,gstime,& character(8) subset - integer(i_kind):: i,k,ntest,ireadsb,ireadmg,irec,next + integer(i_kind):: i,k,ntest,ireadsb,ireadmg,irec,next, number_profiles integer(i_kind):: iret,idate,nchanl integer(i_kind):: isflg,nreal,idomsfc integer(i_kind):: nmind,itx,nele,itt @@ -513,11 +513,13 @@ subroutine read_ssmi(mype,val_ssmi,ithin,rmesh,jsatid,gstime,& end do read_subset call closbf(lnbufr) + number_profiles = count(nrec(:) /= 999999,dim=1) + ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) write(6,*) 'READ_SSMI: after combine_obs, nread,ndata is ',nread,ndata diff --git a/src/gsi/read_ssmis.f90 b/src/gsi/read_ssmis.f90 index c6a1af2263..25ab7a9c6c 100755 --- a/src/gsi/read_ssmis.f90 +++ b/src/gsi/read_ssmis.f90 @@ -153,7 +153,7 @@ subroutine read_ssmis(mype,val_ssmis,ithin,isfcalc,rmesh,jsatid,gstime,& integer(i_kind) :: i,k,ifovoff,ntest integer(i_kind) :: nlv,idate,nchanl,nreal - integer(i_kind) :: n,ireadsb,ireadmg,irec + integer(i_kind) :: n,ireadsb,ireadmg,irec, number_profiles integer(i_kind) :: nmind,itx,nele,itt integer(i_kind) :: iskip integer(i_kind) :: lnbufr,isflg,idomsfc(1) @@ -811,11 +811,13 @@ subroutine read_ssmis(mype,val_ssmis,ithin,isfcalc,rmesh,jsatid,gstime,& deallocate(solazi_save) deallocate(bt_save) + number_profiles = count(nrec(:) /= 999999,dim=1) + ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata,data_all,score_crit,nrec) + nele,itxmax,number_profiles,ndata,data_all,score_crit,nrec) ! Allow single task to check for bad obs, update superobs sum, ! and write out data to scratch file for further processing. diff --git a/src/gsi/read_viirs.f90 b/src/gsi/read_viirs.f90 index 3ea50352ec..17b23328e2 100644 --- a/src/gsi/read_viirs.f90 +++ b/src/gsi/read_viirs.f90 @@ -123,7 +123,7 @@ subroutine read_sst_viirs(mype,val_viirs,ithin,rmesh,jsatid,& real(r_double), dimension(10) :: hdr real(r_double), dimension(2,3) :: bufrf - integer(i_kind) lnbufr,ireadsb,ireadmg,iskip,irec,next + integer(i_kind) lnbufr,ireadsb,ireadmg,iskip,irec,next, number_profiles integer(i_kind),allocatable,dimension(:)::nrec real(r_kind), allocatable, dimension(:) :: amesh real(r_kind), allocatable, dimension(:) :: hsst_thd @@ -469,10 +469,10 @@ subroutine read_sst_viirs(mype,val_viirs,ithin,rmesh,jsatid,& enddo read_msg call closbf(lnbufr) - + number_profiles = count(nrec(:) /= 999999,dim=1) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& - nele,itxmax,nread,ndata_mesh,data_mesh,score_crit,nrec) + nele,itxmax,number_profiles,ndata_mesh,data_mesh,score_crit,nrec) if ( nread > 0 ) then write(*,'(a,a11,I3,F6.1,3I10)') 'read_viirs,jsatid,imesh,amesh,itxmax,nread,ndata_mesh :',jsatid,imesh,amesh(imesh),itxmax,nread,ndata_mesh