diff --git a/route/build/src/dfw_route.f90 b/route/build/src/dfw_route.f90 index 2781d66b..1be0b4af 100644 --- a/route/build/src/dfw_route.f90 +++ b/route/build/src/dfw_route.f90 @@ -76,12 +76,13 @@ SUBROUTINE dfw_rch(this, & ! dfw_route_rch object to bound this proced end if ! get discharge coming from upstream - nUps = size(NETOPO_in(segIndex)%UREACHI) + nUps = count(NETOPO_in(segIndex)%goodBas) ! reminder: goodBas is reach with >0 total contributory area isHW = .true. q_upstream = 0.0_dp if (nUps>0) then isHW = .false. do iUps = 1,nUps + if (.not. NETOPO_in(segIndex)%goodBas(iUps)) cycle ! skip upstream reach which does not any flow due to zero total contributory areas iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach if (qmodOption==1 .and. RCHFLX_out(iens,iRch_ups)%Qobs/=realMissing) then RCHFLX_out(iens, iRch_ups)%ROUTE(idxDW)%REACH_Q = RCHFLX_out(iens,iRch_ups)%Qobs diff --git a/route/build/src/kwe_route.f90 b/route/build/src/kwe_route.f90 index efb0f224..b431b27a 100644 --- a/route/build/src/kwe_route.f90 +++ b/route/build/src/kwe_route.f90 @@ -77,12 +77,13 @@ SUBROUTINE kw_rch(this, & ! kwe_route_rch object to bound this procedu end if ! get discharge coming from upstream - nUps = size(NETOPO_in(segIndex)%UREACHI) + nUps = count(NETOPO_in(segIndex)%goodBas) ! reminder: goodBas is reach with >0 total contributory area isHW = .true. q_upstream = 0.0_dp if (nUps>0) then isHW = .false. do iUps = 1,nUps + if (.not. NETOPO_in(segIndex)%goodBas(iUps)) cycle ! skip upstream reach which does not any flow due to zero total contributory areas iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach if (qmodOption==1 .and. RCHFLX_out(iens,iRch_ups)%Qobs/=realMissing) then RCHFLX_out(iens, iRch_ups)%ROUTE(idxKW)%REACH_Q = RCHFLX_out(iens,iRch_ups)%Qobs diff --git a/route/build/src/mc_route.f90 b/route/build/src/mc_route.f90 index a421b916..eac4164a 100644 --- a/route/build/src/mc_route.f90 +++ b/route/build/src/mc_route.f90 @@ -76,12 +76,13 @@ SUBROUTINE mc_rch(this, & ! mc_route_rch object to bound this procedur end if ! get discharge coming from upstream - nUps = size(NETOPO_in(segIndex)%UREACHI) + nUps = count(NETOPO_in(segIndex)%goodBas) ! reminder: goodBas is reach with >0 total contributory area isHW = .true. q_upstream = 0.0_dp if (nUps>0) then isHW = .false. do iUps = 1,nUps + if (.not. NETOPO_in(segIndex)%goodBas(iUps)) cycle ! skip upstream reach which does not any flow due to zero total contributory areas iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach if (qmodOption==1 .and. RCHFLX_out(iens,iRch_ups)%Qobs/=realMissing) then RCHFLX_out(iens, iRch_ups)%ROUTE(idxMC)%REACH_Q = RCHFLX_out(iens,iRch_ups)%Qobs