Commit 87ad0ae5 authored by Anthony's avatar Anthony
Browse files

More details about the orography : min, mean and max

parent 62527f6d
......@@ -177,7 +177,7 @@ SUBROUTINE globalize(nbpt, nb_htu, nbv, ijdimmax, area_bx, lon_bx, lat_bx, trip_
& fac_bx, topoind_bx, &
& min_topoind, nb_basin, basin_inbxid, basin_outlet, basin_outtp, basin_sz, basin_pts, basin_bxout, &
& basin_bbout, lshead, coast_pts, nwbas, basin_count, basin_notrun, basin_area, basin_cg, basin_hierarchy, &
& basin_orog, basin_floodp, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, &
& basin_fac, basin_topoind, basin_id, basin_coor, basin_type, basin_flowdir, basin_lshead, &
& outflow_grid, outflow_basin, nbcoastal, coastal_basin)
!
......@@ -221,7 +221,9 @@ SUBROUTINE globalize(nbpt, nb_htu, nbv, ijdimmax, area_bx, lon_bx, lat_bx, trip_
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_area !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas,2) :: basin_cg !! Centre of gravity of the HTU
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_hierarchy !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_orog !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_orog_mean !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_orog_min !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_orog_max !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_floodp !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_fac !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m)
......@@ -240,7 +242,8 @@ SUBROUTINE globalize(nbpt, nb_htu, nbv, ijdimmax, area_bx, lon_bx, lat_bx, trip_
& topoind_bx(ib,:,:), min_topoind, nb_basin(ib), basin_inbxid(ib,:), basin_outlet(ib,:,:), basin_outtp(ib,:), &
& basin_sz(ib,:), basin_pts(ib,:,:,:), basin_bxout(ib,:), basin_bbout(ib,:), lshead(ib,:), coast_pts(ib,:), nwbas, &
& basin_count, basin_notrun, basin_area, basin_cg, basin_hierarchy,&
& basin_orog, basin_floodp, basin_fac, basin_topoind, basin_id, basin_coor, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_fac,&
& basin_topoind, basin_id, basin_coor, &
& basin_type, basin_flowdir, basin_lshead, outflow_grid, outflow_basin, nbcoastal, coastal_basin)
ENDDO
!
......@@ -429,9 +432,11 @@ END SUBROUTINE rivclassification
SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridarea, cfrac, gridcenters, basin_count, &
& basin_notrun, basin_area, basin_orog, basin_floodp, basin_cg, basin_topoind, fetch_basin, &
& basin_notrun, basin_area, basin_orog_mean, basin_orog_min, basin_orog_max, &
& basin_floodp, basin_cg, basin_topoind, fetch_basin, &
& basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, &
& inflow_number, inflow_grid, inflow_basin, routing_area, routing_orog, routing_floodp, &
& inflow_number, inflow_grid, inflow_basin, routing_area, routing_orog_mean, &
& routing_orog_min, routing_orog_max, routing_floodp, &
& routing_cg, topo_resid, route_nbbasin, route_togrid, route_tobasin, route_nbintobas, &
& global_basinid, route_outlet, route_type, origin_nbintobas, routing_fetch)
!
......@@ -458,7 +463,9 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_type !!
INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_flowdir !! Water flow directions in the basin (unitless)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_area !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_mean !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_min !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_max !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_floodp !!
REAL(r_std), DIMENSION(nbpt,nwbas,2), INTENT(inout) :: basin_cg
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (m)
......@@ -475,7 +482,9 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
! Output variables
!
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_area !! Surface of basin (m^2)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_orog !! Mean Orography (m)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_orog_mean !! Mean Orography (m)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_orog_min !! Mean Orography (m)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_orog_max !! Mean Orography (m)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_floodp !! Surface of Floodplains (m^2)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_fetch !! Upstream are flowing into HTU (m^2)
REAL(r_std), DIMENSION(nbpt,nbasmax,2), INTENT(out) :: routing_cg !! Centre of gravity of HTU (Lat, Lon)
......@@ -493,12 +502,14 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
!
CALL routing_reg_end_truncate(nbpt, nbasmax, gridarea, cfrac, gridcenters, nwbas, inflowmax, num_largest, &
& basin_count, basin_notrun, basin_area, basin_orog, basin_floodp, basin_cg, &
& basin_topoind, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, &
& basin_count, basin_notrun, basin_area, basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp,&
& basin_cg, basin_topoind, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, &
& outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin)
routing_area(:,:) = routing_area_glo(:,:)
routing_orog(:,:) = routing_orog_glo(:,:)
routing_orog_mean(:,:) = routing_orog_mean_glo(:,:)
routing_orog_min(:,:) = routing_orog_min_glo(:,:)
routing_orog_max(:,:) = routing_orog_max_glo(:,:)
routing_floodp(:,:) = routing_floodp_glo(:,:)
routing_cg(:,:,:) = routing_cg_glo(:,:,:)
topo_resid(:,:) = topo_resid_glo(:,:)
......@@ -566,7 +577,7 @@ END SUBROUTINE finish_inflows
SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, numops, basin_count, basin_area, &
& basin_orog, basin_floodp, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, &
& basin_cg, basin_topoind, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, &
& inflow_number, inflow_grid, inflow_basin)
!
......@@ -590,7 +601,10 @@ SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, num
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_type !!
INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_flowdir !! Water flow directions in the basin (unitless)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_area !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_mean !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_min !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_max !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_floodp !!
REAL(r_std), DIMENSION(nbpt,nwbas,2), INTENT(inout) :: basin_cg
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (m)
......@@ -636,7 +650,7 @@ SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, num
END IF
END DO
CALL routing_reg_killbas(nbpt, ib, tok, totak, nwbas, inflowmax, basin_count, basin_area, &
& basin_orog, basin_floodp, basin_cg, basin_topoind,&
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin)
END IF
......@@ -917,7 +931,7 @@ SUBROUTINE finalfetch(nbpt, nbasmax, nbcore, nbhalo, in_core, halopts, corepts,
END IF
END IF
END DO
END DO
END DO
!
! Add the areas contributed by the core region of the domain.
! and propagate them till the flow flows out of the core domain.
......
......@@ -14,7 +14,9 @@ MODULE routing_reg
INTEGER(i_std), SAVE :: nbasmax_save
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: routing_area_glo !! Surface of basin (m^2)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: routing_orog_glo !! Mean topography (m)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: routing_orog_mean_glo !! Mean topography (m)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: routing_orog_min_glo !! Mean topography (m)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: routing_orog_max_glo !! Mean topography (m)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: routing_floodp_glo !! Surface of floodplains (m^2)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: routing_cg_glo !! Centre of gravity of HTU (Lat, Lon)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_resid_glo !! Topographic index of the retention time (m)
......@@ -1653,7 +1655,7 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
& hierarchy_bx, orog_bx, floodp_bx, fac_bx, topoind_bx, &
& min_topoind, nb_basin, basin_inbxid, basin_outlet, basin_outtp, basin_sz, basin_pts, basin_bxout, &
& basin_bbout, lshead, coast_pts, nwbas, basin_count, basin_notrun, basin_area, basin_cg, basin_hierarchy, &
& basin_orog, basin_floodp, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, &
& basin_fac, basin_topoind, basin_id, basin_coor, basin_type, basin_flowdir, basin_lshead, &
& outflow_grid, outflow_basin, nbcoastal, coastal_basin)
!
......@@ -1696,7 +1698,9 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_area !!
REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_cg !! Centre of gravity of the HTU in latitude, longitude
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_hierarchy !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog_mean !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog_min !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog_max !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_floodp !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_fac !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m)
......@@ -1769,7 +1773,9 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
basin_cg(ib,ij,:) = zero
basin_hierarchy(ib,ij) = zero
basin_fac(ib,ij) = zero
basin_orog(ib,ij) = zero
basin_orog_mean(ib,ij) = zero
basin_orog_min(ib,ij) = 99999
basin_orog_max(ib,ij) = zero
basin_floodp(ib,ij) = zero
!
SELECT CASE (hierar_method)
......@@ -1784,8 +1790,10 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
!
basin_area(ib,ij) = basin_area(ib,ij) + area_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2))
! Numerator for mean orography, then need to be divided by the HTUs area
basin_orog(ib,ij) = basin_orog(ib,ij) + orog_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2)) &
basin_orog_mean(ib,ij) = basin_orog_mean(ib,ij) + orog_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2)) &
& * area_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2))
basin_orog_min(ib,ij) = MIN(basin_orog_min(ib,ij), orog_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2)))
basin_orog_max(ib,ij) = MAX(basin_orog_min(ib,ij), orog_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2)))
basin_floodp(ib,ij) = basin_floodp(ib,ij) + floodp_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2))
!
! Compute centre of gravity
......@@ -1834,7 +1842,7 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
ENDDO
!
! Finish the calculation of mean orography
basin_orog(ib,ij) = basin_orog(ib,ij)/basin_area(ib,ij)
basin_orog_mean(ib,ij) = basin_orog_mean(ib,ij)/basin_area(ib,ij)
!
SELECT CASE (hierar_method)
!
......@@ -2438,7 +2446,7 @@ SUBROUTINE routing_reg_fetch(nbpt, gridarea, contfrac, nwbas, nbcore, nbhalo, &
!
!_ ================================================================================================================================
!
! Fill array with 1 where nbpt is a core point
! Fill array with 1 where nbpt is a core point
!
in_core(:) = 0
DO ig = 1, nbpt
......@@ -2479,7 +2487,7 @@ SUBROUTINE routing_reg_fetch(nbpt, gridarea, contfrac, nwbas, nbcore, nbhalo, &
END IF
END IF
END DO
END DO
END DO
!
! Add the areas contributed by the core region of the domain.
! and propagate them till the flow flows out of the core domain.
......@@ -2562,7 +2570,7 @@ SUBROUTINE routing_reg_fetch(nbpt, gridarea, contfrac, nwbas, nbcore, nbhalo, &
!! ================================================================================================================================
!! SUBROUTINE : isin_halo
!!
!>\BRIEF This subroutine establishes the list of the points
!>\BRIEF This subroutine establishes the list of the points
! and indicates whether if they are in the core (=1) or in the halo (=0).
SUBROUTINE isin_halo(ig, nbhalo, nbpt, halopts, isinhalo)
IMPLICIT NONE
......@@ -2631,9 +2639,10 @@ SUBROUTINE isin_halo(ig, nbhalo, nbpt, halopts, isinhalo)
!! \n
!_ ================================================================================================================================
SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcenters, nwbas, inflowmax, num_largest, &
& basin_count, basin_notrun, basin_area, basin_orog, basin_floodp, &
& basin_cg, basin_topoind, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, &
SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcenters, nwbas,&
& inflowmax, num_largest, basin_count, basin_notrun, basin_area, basin_orog_mean,&
& basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind, fetch_basin,&
& basin_id, basin_coor, basin_type, basin_flowdir, &
& outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin)
!
IMPLICIT NONE
......@@ -2660,7 +2669,9 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_type !!
INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_flowdir !! Water flow directions in the basin (unitless)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_area !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_mean !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_min !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_orog_max !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_floodp !!
REAL(r_std), DIMENSION(nbpt,nwbas,2), INTENT(inout) :: basin_cg !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (m)
......@@ -2718,28 +2729,33 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
route_count_glo(ib) = basin_count(ib)
route_nbintobas_glo(ib) = basin_count(ib)
origin_nbintobas_glo(ib) = basin_notrun(ib)
routing_floodp_glo(ib,:) = 0
! If the land point doesn't overlap with any hydrogrid point
routing_floodp_glo(ib,:) = 0
routing_orog_mean_glo(ib,:) = 0
routing_orog_min_glo(ib,:) = 0
routing_orog_max_glo(ib,:) = 0
! If the land point doesn't overlap with any hydrogrid point
! (cf 0.5° trip on coast or some particular grid points )
IF ( basin_count(ib) .EQ. 0) THEN
basin_area(ib,1) = contfrac(ib)*gridarea(ib)
basin_orog(ib,1) = 0
basin_orog_min(ib,1) = 0
basin_orog_max(ib,1) = 0
basin_orog_mean(ib,1) = 0
basin_floodp(ib,1) = 0
basin_cg(ib,1,1) = gridcenters(ib,1)
basin_cg(ib,1,1) = gridcenters(ib,1)
basin_cg(ib,1,2) = gridcenters(ib,2)
! To define in function of the minimum topoindex on the map
! (to revise)
basin_topoind(ib,1) = 1
basin_topoind(ib,1) = 1
basin_id(ib,1) = 0
basin_coor(ib,1,1) = basin_cg(ib,1,1)
basin_coor(ib,1,2) = basin_cg(ib,1,2)
fetch_basin(ib,1) = basin_area(ib,1)
basin_type(ib,1) = -4
basin_type(ib,1) = -4
outflow_grid(ib,1) = -2
basin_count(ib) = 1
route_count_glo(ib) = 1
route_nbintobas_glo(ib) = 1
END IF
END IF
!
ENDDO
!
......@@ -2749,7 +2765,9 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
DO ij=1,basin_count(ib)
!
routing_area_glo(ib,ij) = basin_area(ib,ij)
routing_orog_glo(ib,ij) = basin_orog(ib,ij)
routing_orog_mean_glo(ib,ij) = basin_orog_mean(ib,ij)
routing_orog_min_glo(ib,ij) = basin_orog_min(ib,ij)
routing_orog_max_glo(ib,ij) = basin_orog_max(ib,ij)
! Now the final floodplains is converted into fraction
routing_floodp_glo(ib,ij) = basin_floodp(ib,ij)/basin_area(ib,ij)
routing_cg_glo(ib,ij,:) = basin_cg(ib,ij,:)
......@@ -2862,7 +2880,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
!_ ================================================================================================================================
SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, basin_count, basin_area, &
& basin_orog, basin_floodp, basin_cg, basin_topoind,&
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin)
!
......@@ -2881,7 +2899,9 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_type !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_flowdir !! Water flow directions in the basin (unitless)
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_area !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog_mean !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog_min !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_orog_max !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_floodp !!
REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_cg !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m)
......@@ -2917,8 +2937,12 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
!
basin_floodp(ib, totakeover) = basin_floodp(ib, totakeover) + basin_floodp(ib,tokill)
!
basin_orog(ib, totakeover) = (basin_orog(ib, totakeover)*basin_area(ib, totakeover) &
& + basin_orog(ib, tokill)*basin_area(ib, tokill))/(basin_area(ib, totakeover) + basin_area(ib, tokill))
basin_orog_mean(ib, totakeover) = (basin_orog_mean(ib, totakeover)*basin_area(ib, totakeover) &
& + basin_orog_mean(ib, tokill)*basin_area(ib, tokill))/(basin_area(ib, totakeover) + basin_area(ib, tokill))
! If we want to keep the coherence among the upstream / downstream orography
! we should leave the original basin_orog_min
!basin_orog_min(ib, totakeover) =
basin_orog_max(ib, totakeover) = MAX(basin_orog_mean(ib, totakeover), basin_orog_mean(ib, tokill))
!
! Add the fetch of the basin will kill to the one which gets the water
!
......@@ -2981,7 +3005,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
inf = inf +1
END IF
END DO
IF (inf .GT. inflow_number(ing,inb)) THEN
WRITE(numout,*) 'tokill basin is not in the inflows of its outflow'
CALL ipslerr_p(3,'routing_reg_killbas','Inflows incoherence','','')
......@@ -3009,6 +3033,16 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
fetch_basin(ib, tokill:basin_count(ib)-1) = fetch_basin(ib, tokill+1:basin_count(ib))
fetch_basin(ib, basin_count(ib):nwbas) = zero
!
basin_floodp(ib, tokill:basin_count(ib)-1) = basin_floodp(ib, tokill+1:basin_count(ib))
basin_floodp(ib, basin_count(ib):nwbas) = zero
!
basin_orog_mean(ib, tokill:basin_count(ib)-1) = basin_orog_mean(ib, tokill+1:basin_count(ib))
basin_orog_mean(ib, basin_count(ib):nwbas) = zero
basin_orog_max(ib, tokill:basin_count(ib)-1) = basin_orog_max(ib, tokill+1:basin_count(ib))
basin_orog_max(ib, basin_count(ib):nwbas) = zero
basin_orog_min(ib, tokill:basin_count(ib)-1) = basin_orog_min(ib, tokill+1:basin_count(ib))
basin_orog_min(ib, basin_count(ib):nwbas) = zero
!
! Before we remove the information from the outflow fields we have to correct the corresponding inflow fields
! of the grids into which the flow goes
!
......@@ -3066,7 +3100,9 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
nbasmax_save = nbasmax
ALLOCATE (routing_area_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_orog_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_orog_mean_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_orog_min_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_orog_max_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_floodp_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (route_fetch_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_cg_glo(nbpt,nbasmax,2), stat=ier)
......
......@@ -184,7 +184,7 @@ def finalfetch(part, routing_area, basin_count, route_togrid, route_tobasin, fet
fetch_out = np.zeros(routing_area.shape, dtype=np.float32, order='F')
partial_sum = np.zeros(routing_area.shape, dtype=np.float32, order='F')
old_sorted = np.zeros(largest_pos, dtype=np.float32, order='F')
#
#
nbpt = routing_area.shape[0]
fhalolist = [i+1 for i in range(nbpt) if i not in part.landcorelist]
in_core = np.array([1 if i in part.landcorelist else 0 for i in range(nbpt)])
......@@ -351,9 +351,9 @@ class HydroSuper :
lat_bx_tmp[np.isnan(lat_bx_tmp)] = undef_int
#
self.basin_count, self.basin_notrun, self.basin_area, self.basin_cg, self.basin_hierarchy, \
self.basin_orog, self.basin_floodp, self.basin_fac, self.basin_topoind, \
self.basin_id, self.basin_outcoor, self.basin_type, self.basin_flowdir, \
self.basin_lshead, self.outflow_grid, self.outflow_basin, self.nbcoastal, self.coastal_basin = \
self.basin_orog_mean, self.basin_orog_min, self.basin_orog_max, self.basin_floodp, \
self.basin_fac, self.basin_topoind, self.basin_id, self.basin_outcoor, self.basin_type,\
self.basin_flowdir, self.basin_lshead, self.outflow_grid, self.outflow_basin, self.nbcoastal, self.coastal_basin = \
routing_interface.globalize(nbpt = self.nbpt, nb_htu = self.nbhtuext, nbv = nbv, ijdimmax = self.ijdimmax, \
area_bx = hydrooverlap.area_bx, lon_bx = lon_bx_tmp, lat_bx = lat_bx_tmp, trip_bx = hydrooverlap.trip_bx, \
hierarchy_bx = hydrooverlap.hierarchy_bx, orog_bx = hydrooverlap.orog_bx, floodp_bx = hydrooverlap.floodp_bx,\
......@@ -497,7 +497,8 @@ class HydroSuper :
routing_interface.killbas(nbpt = self.nbpt, inflowmax = nbxmax_tmp, \
nbasmax = self.nbasmax, nwbas = self.nwbas, ops = ops, tokill = tokill,\
totakeover = totakeover, numops = numops, basin_count = self.basin_count,\
basin_area = self.basin_area, basin_orog = self.basin_orog, basin_floodp = self.basin_floodp, \
basin_area = self.basin_area, basin_orog_mean = self.basin_orog_mean, \
basin_orog_min = self.basin_orog_min, basin_orog_max = self.basin_orog_max, basin_floodp = self.basin_floodp, \
basin_cg = self.basin_cg, basin_topoind = self.basin_topoind, fetch_basin = self.fetch_basin,\
basin_id = self.basin_id, basin_coor = self.basin_outcoor, basin_type = self.basin_type,\
basin_flowdir = self.basin_flowdir, outflow_grid = self.outflow_grid, outflow_basin = self.outflow_basin, \
......@@ -632,7 +633,8 @@ class HydroGraph :
nbxmax_in = hydrosuper.inflow_grid.shape[2]
#
#
self.routing_area, self.routing_orog, self.routing_floodp, self.routing_cg, self.topo_resid, self.route_nbbasin,\
self.routing_area, self.routing_orog_mean, self.routing_orog_min,self.routing_orog_max, \
self.routing_floodp, self.routing_cg, self.topo_resid, self.route_nbbasin,\
self.route_togrid, self.route_tobasin, self.route_nbintobas, self.global_basinid, \
self.route_outlet, self.route_type, self.origin_nbintobas, self.routing_fetch = \
routing_interface.finish_truncate(nbpt = self.nbpt, inflowmax = nbxmax_in, nbasmax = nbasmax, nwbas = nwbas, \
......@@ -640,7 +642,8 @@ class HydroGraph :
cfrac = modelgrid.contfrac, gridcenters = np.array(modelgrid.centers), \
basin_count = hydrosuper.basin_count, \
basin_notrun = hydrosuper.basin_notrun, basin_area = hydrosuper.basin_area, \
basin_orog = hydrosuper.basin_orog, basin_floodp = hydrosuper.basin_floodp, \
basin_orog_mean = hydrosuper.basin_orog_mean, basin_orog_min = hydrosuper.basin_orog_min,\
basin_orog_max = hydrosuper.basin_orog_max, basin_floodp = hydrosuper.basin_floodp, \
basin_cg = hydrosuper.basin_cg, \
basin_topoind = hydrosuper.basin_topoind, fetch_basin = hydrosuper.fetch_basin, \
basin_id = hydrosuper.basin_id, \
......@@ -746,7 +749,11 @@ class HydroGraph :
# basin area
self.add_variable(outnf, procgrid, NCFillValue, part, ('z', 'y','x'), "basin_area", "area of basin", "m^2", self.routing_area[:,:], vtyp, "float")
self.add_variable(outnf, procgrid, NCFillValue, part, ('z', 'y','x'), "basin_orog", "Mean orography", "m", self.routing_orog[:,:], vtyp, "float")
self.add_variable(outnf, procgrid, NCFillValue, part, ('z', 'y','x'), "basin_orog_mean", "Mean orography", "m", self.routing_orog_mean[:,:], vtyp, "float")
self.add_variable(outnf, procgrid, NCFillValue, part, ('z', 'y','x'), "basin_orog_min", "Min orography", "m", self.routing_orog_min[:,:], vtyp, "float")
self.add_variable(outnf, procgrid, NCFillValue, part, ('z', 'y','x'), "basin_orog_max", "Max orography", "m", self.routing_orog_max[:,:], vtyp, "float")
self.add_variable(outnf, procgrid, NCFillValue, part, ('z', 'y','x'), "basin_floodp", "Fraction of floodplains", "-", self.routing_floodp[:,:], vtyp, "float")
......
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