Commit a9f21abc authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Addititions to better understand the working of the routing...

Addititions to better understand the working of the routing routing_reg_bestsubbasin. It is suspected that in this routine there is part of the error found in the dz.
parent 4bcdeac6
......@@ -380,16 +380,19 @@ CONTAINS
! Local
!
INTEGER(i_std) :: i, j, sbl, nbfbas, nbopt
INTEGER(i_std), DIMENSION(1) :: ff
INTEGER(i_std) :: ih, id
INTEGER(i_std), DIMENSION(1) :: ff, gg
INTEGER(i_std), DIMENSION(basmax) :: fbas, tbas, sboptions, angle, subbas
INTEGER(i_std), DIMENSION(basmax) :: fbas_flowdir, tbas_flowdir
REAL(r_std), DIMENSION(basmax) :: fbas_hierarchy, tbas_hierarchy
REAL(r_std), DIMENSION(basmax) :: fbas_options
REAL(r_std), DIMENSION(basmax) :: fbas_fac, tbas_fac
REAL(r_std), DIMENSION(basmax) :: fbas_dist, tbas_dist
!
! Debug
!
LOGICAL, PARAMETER :: debug = .FALSE. !! Logical variable to debug
LOGICAL, PARAMETER :: verifchoice = .FALSE.
INTEGER(i_std) :: testbasinid
REAL(r_std) :: maxhiediff, dist
!
......@@ -488,6 +491,7 @@ CONTAINS
! Analyse our options if there are at least one
!
sbl = undef_int
!
IF (nbfbas .EQ. 1) THEN
!
! We check that this only option is valid to provide a quality flag.
......@@ -520,6 +524,13 @@ CONTAINS
! In this case, using MINLOC will return ff(1) = 1
! While, in fact, it should be greater than 1.
!
fbas_options(:) = -1
DO i=1,nbfbas
IF ((fbas_hierarchy(i) .LT. src_hierarchy) .AND. (fbas_fac(i) .GT. src_fac) ) THEN
fbas_options(i) = 1
ENDIF
ENDDO
!
ff(1) = 1
maxhiediff = ABS(fbas_hierarchy(ff(1))-src_hierarchy)
! Trung: Shorten iteration here by DO WHILE (instead of DO i = 1,nbfbas)
......@@ -589,6 +600,26 @@ CONTAINS
ENDIF
ENDIF
ENDIF
!
! Write the diagnostics of what was found
!
IF (sbl < undef_int) THEN
gg=MAXLOC(fbas_hierarchy, MASK=fbas_options > 0)
ih=gg(1)
gg=MINLOC(fbas_dist, MASK=fbas_options > 0)
id=gg(1)
!!
IF ( verifchoice ) THEN
WRITE(numout,*) "XXXX Source : hierarcy=", src_hierarchy, "fac=", src_fac
WRITE(numout,*) "XXXX point ",sbl, " hierarcy=", fbas_hierarchy(sbl), " fac=",fbas_fac(sbl), "nbopt=",nbopt
DO i=1,nbfbas
IF ( fbas_options(i) > 0 ) THEN
WRITE(numout,*) "XXXX Options ", i, " hierarcy=", fbas_hierarchy(i), " fac=",fbas_fac(i), " dist=", fbas_dist(i)
ENDIF
ENDDO
WRITE(numout,*) "XXXX Best Hierarchy :", ih, " Best distance :", id
ENDIF
ENDIF
ENDIF
!
! Now we have either found a basin or we have a number of options we can explore
......@@ -630,6 +661,7 @@ CONTAINS
ENDDO
ENDIF
ENDIF
!
END SUBROUTINE routing_reg_bestsubbasin
!! ================================================================================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment