Skip to content

Commit

Permalink
This change fixes the debug failure problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
wx20jjung committed Sep 5, 2024
1 parent a430c50 commit 08624d6
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions src/gsi/read_iasi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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, number_profiles
integer(i_kind) :: sfc_channel_index
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
Expand Down Expand Up @@ -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)= zero
sscale(i)=0.0_r_kind
endif
end do

! Read IASI channel number(CHNM) and radiance (SCRA)
call ufbseq(lnbufr,allchan,2,bufr_nchan,iret,'IASICHN')
jstart=1
scalef=zero
scalef=one
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
Expand Down Expand Up @@ -757,28 +757,27 @@ 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
sc_chan = sc_index(i)
if ( bufr_index(i) == 0 ) cycle channel_loop
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) & ! 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))
endif
end if
! check that channel number is within reason
if (( allchan(2,bufr_chan) > zero .and. allchan(2,bufr_chan) < 99999._r_kind)) then ! radiance bounds
radiance = allchan(2,bufr_chan)*scalef(bufr_chan)
call crtm_planck_temperature(sensorindex_iasi,sc_chan,radiance,temperature(bufr_chan))
else
temperature(bufr_chan) = tbmin
endif
end do channel_loop

! Check for reasonable temperature values
iskip = 0
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) = tbmin
if(temperature(bufr_chan) <= tbmin .or. temperature(bufr_chan) > tbmax ) then
temperature(bufr_chan) = min(tbmax,max(tbmin,temperature(bufr_chan)))
if(iuse_rad(ioff+i) >= 0)iskip = iskip + 1
endif
end do skip_loop
Expand Down Expand Up @@ -950,10 +949,8 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,&

! Put satinfo defined channel temperatures into data array
do l=1,satinfo_nchan
! Prevent out of bounds reference from temperature
if ( bufr_index(l) == 0 ) cycle
i = bufr_index(l)
if(i /= 0)then
if(bufr_index(l) /= 0)then
data_all(l+nreal,itx) = temperature(i) ! brightness temerature
else
data_all(l+nreal,itx) = tbmin
Expand All @@ -978,14 +975,11 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,&
if (error_status /= success) &
write(6,*)'OBSERVER: ***ERROR*** crtm_destroy error_status=',error_status

! number of profiles kept after thinning and QC
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,number_profiles,ndata,data_all,score_crit,nrec)
nele,itxmax,nread,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.
Expand Down

0 comments on commit 08624d6

Please sign in to comment.