Commit 7b806d25 authored by Anthony's avatar Anthony
Browse files

topoindex_stream variable flows to the output file

parent 71fe0f70
...@@ -128,7 +128,8 @@ END SUBROUTINE gethydrogrid ...@@ -128,7 +128,8 @@ END SUBROUTINE gethydrogrid
SUBROUTINE findbasins(nbpt, nb_htu, nbv, ijdimmax, nbi, nbj, trip_bx, basin_bx, fac_bx, hierarchy_bx, topoind_bx, & SUBROUTINE findbasins(nbpt, nb_htu, nbv, ijdimmax, nbi, nbj, trip_bx, basin_bx, fac_bx, hierarchy_bx, topoind_bx, &
& rlen_bx, rdz_bx, rweight_bx, lshead_bx, nb_basin, basin_inbxid, basin_outlet, basin_outtp, & & rlen_bx, rdz_bx, rweight_bx, lshead_bx, nb_basin, basin_inbxid, basin_outlet, basin_outtp, &
& basin_sz, basin_bxout, basin_bbout, basin_pts, basin_lshead, coast_pts, lontmp, lattmp, orog_bx) & basin_sz, basin_bxout, basin_bbout, basin_pts, basin_lshead, coast_pts, lontmp, lattmp, orog_bx, &
& basin_topoindex_stream)
! !
USE ioipsl USE ioipsl
USE grid USE grid
...@@ -163,6 +164,7 @@ SUBROUTINE findbasins(nbpt, nb_htu, nbv, ijdimmax, nbi, nbj, trip_bx, basin_bx, ...@@ -163,6 +164,7 @@ SUBROUTINE findbasins(nbpt, nb_htu, nbv, ijdimmax, nbi, nbj, trip_bx, basin_bx,
INTEGER, INTENT(out) :: basin_pts(nbpt,nb_htu, nbv, 2) !! INTEGER, INTENT(out) :: basin_pts(nbpt,nb_htu, nbv, 2) !!
REAL, INTENT(out) :: basin_lshead(nbpt,nb_htu) !! REAL, INTENT(out) :: basin_lshead(nbpt,nb_htu) !!
INTEGER, INTENT(out) :: coast_pts(nbpt,nb_htu) !! The coastal flow points (unitless) INTEGER, INTENT(out) :: coast_pts(nbpt,nb_htu) !! The coastal flow points (unitless)
REAL, INTENT(out) :: basin_topoindex_stream(nbpt,nb_htu) !!
! !
! For debug and get coordinate of river outlet ! For debug and get coordinate of river outlet
! !
...@@ -184,7 +186,7 @@ SUBROUTINE findbasins(nbpt, nb_htu, nbv, ijdimmax, nbi, nbj, trip_bx, basin_bx, ...@@ -184,7 +186,7 @@ SUBROUTINE findbasins(nbpt, nb_htu, nbv, ijdimmax, nbi, nbj, trip_bx, basin_bx,
& rlen_bx(ib,:,:), rdz_bx(ib,:,:), rweight_bx(ib,:,:), lshead_bx(ib,:,:), diaglalo, nb_basin(ib), & & rlen_bx(ib,:,:), rdz_bx(ib,:,:), rweight_bx(ib,:,:), lshead_bx(ib,:,:), diaglalo, nb_basin(ib), &
& basin_inbxid(ib,:), basin_outlet(ib,:,:), basin_outtp(ib,:), basin_sz(ib,:), basin_bxout(ib,:), & & basin_inbxid(ib,:), basin_outlet(ib,:,:), basin_outtp(ib,:), basin_sz(ib,:), basin_bxout(ib,:), &
& basin_bbout(ib,:), basin_pts(ib,:,:,:), basin_lshead(ib,:), coast_pts(ib,:), lontmp(ib,:,:), lattmp(ib,:,:),& & basin_bbout(ib,:), basin_pts(ib,:,:,:), basin_lshead(ib,:), coast_pts(ib,:), lontmp(ib,:,:), lattmp(ib,:,:),&
& orog_bx(ib,:,:)) & orog_bx(ib,:,:), basin_topoindex_stream(ib,:))
ENDDO ENDDO
END SUBROUTINE findbasins END SUBROUTINE findbasins
...@@ -456,11 +458,13 @@ END SUBROUTINE rivclassification ...@@ -456,11 +458,13 @@ END SUBROUTINE rivclassification
SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridarea, cfrac, gridcenters, basin_count, & SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridarea, cfrac, gridcenters, basin_count, &
& basin_notrun, basin_area, basin_orog_mean, basin_orog_min, basin_orog_max, & & basin_notrun, basin_area, basin_orog_mean, basin_orog_min, basin_orog_max, &
& basin_floodp, basin_cg, basin_topoind, basin_rlen, basin_rdz, basin_beta_fp, fetch_basin, & & basin_floodp, basin_cg, basin_topoind, basin_topoindex_stream, basin_rlen, &
& basin_rdz, basin_beta_fp, fetch_basin, &
& basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, & & basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, &
& inflow_number, inflow_grid, inflow_basin, floodcri, routing_area, routing_orog_mean, & & inflow_number, inflow_grid, inflow_basin, floodcri, routing_area, routing_orog_mean, &
& routing_orog_min, routing_orog_max, routing_floodp, routing_beta,& & routing_orog_min, routing_orog_max, routing_floodp, routing_beta, &
& routing_cg, topo_resid, topo_rlen, topo_rdz, route_nbbasin, route_togrid, route_tobasin, route_nbintobas, & & routing_cg, topo_resid, topo_resid_stream, topo_rlen, topo_rdz, &
& route_nbbasin, route_togrid, route_tobasin, route_nbintobas, &
& global_basinid, route_outlet, route_type, origin_nbintobas, routing_fetch,routing_floodcri, & & global_basinid, route_outlet, route_type, origin_nbintobas, routing_fetch,routing_floodcri, &
& rfillval, ifillval) & rfillval, ifillval)
! !
...@@ -493,6 +497,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare ...@@ -493,6 +497,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_floodp !! 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,2), INTENT(inout) :: basin_cg
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (km) REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (km)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoindex_stream !! Topographic index of the residence time for a basin (km) - stream res.
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rlen REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rlen
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rdz REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rdz
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_beta_fp REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_beta_fp
...@@ -521,6 +526,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare ...@@ -521,6 +526,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: routing_fetch !! Upstream are flowing into HTU (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) REAL(r_std), DIMENSION(nbpt,nbasmax,2), INTENT(out) :: routing_cg !! Centre of gravity of HTU (Lat, Lon)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_resid !! Topographic index of the retention time (km) REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_resid !! Topographic index of the retention time (km)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_resid_stream !! Topographic index of the retention time (km)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_rlen !! REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_rlen !!
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_rdz !! REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_rdz !!
INTEGER(i_std), DIMENSION(nbpt), INTENT(out) :: route_nbbasin !! INTEGER(i_std), DIMENSION(nbpt), INTENT(out) :: route_nbbasin !!
...@@ -538,7 +544,8 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare ...@@ -538,7 +544,8 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
! !
CALL routing_reg_end_truncate(nbpt, nbasmax, gridarea, cfrac, gridcenters, nwbas, inflowmax, num_largest, & CALL routing_reg_end_truncate(nbpt, nbasmax, gridarea, cfrac, gridcenters, nwbas, inflowmax, num_largest, &
& basin_count, basin_notrun, basin_area, basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp,& & basin_count, basin_notrun, basin_area, basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp,&
& basin_cg, basin_topoind, basin_rlen, basin_rdz, basin_beta_fp, fetch_basin, basin_id, basin_coor, & & basin_cg, basin_topoind, basin_topoindex_stream, basin_rlen, basin_rdz, &
& basin_beta_fp, fetch_basin, basin_id, basin_coor, &
& basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin, floodcri) & basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin, floodcri)
routing_area(:,:) = rfillval routing_area(:,:) = rfillval
...@@ -548,6 +555,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare ...@@ -548,6 +555,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
routing_floodp(:,:) = rfillval routing_floodp(:,:) = rfillval
routing_cg(:,:,:) = rfillval routing_cg(:,:,:) = rfillval
topo_resid(:,:) = rfillval topo_resid(:,:) = rfillval
topo_resid_stream(:,:) = rfillval
topo_rlen(:,:) = rfillval topo_rlen(:,:) = rfillval
topo_rdz(:,:) = rfillval topo_rdz(:,:) = rfillval
route_nbbasin(:) = ifillval route_nbbasin(:) = ifillval
...@@ -572,6 +580,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare ...@@ -572,6 +580,7 @@ SUBROUTINE finish_truncate(nbpt, inflowmax, nbasmax, nwbas, num_largest, gridare
routing_cg(ij,ib,:) = routing_cg_glo(ij,ib,:) routing_cg(ij,ib,:) = routing_cg_glo(ij,ib,:)
! !
topo_resid(ij,ib) = topo_resid_glo(ij,ib) topo_resid(ij,ib) = topo_resid_glo(ij,ib)
topo_resid_stream(ij,ib) = topo_resid_stream_glo(ij,ib)
topo_rlen(ij,ib) = topo_rlen_glo(ij,ib) topo_rlen(ij,ib) = topo_rlen_glo(ij,ib)
topo_rdz(ij,ib) = topo_rdz_glo(ij,ib) topo_rdz(ij,ib) = topo_rdz_glo(ij,ib)
! !
...@@ -643,7 +652,8 @@ END SUBROUTINE finish_inflows ...@@ -643,7 +652,8 @@ END SUBROUTINE finish_inflows
SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, numops, basin_count, basin_area, & SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, numops, basin_count, basin_area, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, & & basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, &
& basin_topoind, basin_rlen, basin_rdz, basin_beta_fp, fetch_basin, basin_id, basin_coor, basin_type, & & basin_topoind, basin_topoindex_stream, basin_rlen, basin_rdz, basin_beta_fp, &
& fetch_basin, basin_id, basin_coor, basin_type, &
& basin_flowdir, outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin) & basin_flowdir, outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin)
! !
! !
...@@ -673,6 +683,7 @@ SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, num ...@@ -673,6 +683,7 @@ SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, num
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_floodp !! 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,2), INTENT(inout) :: basin_cg
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (km) REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (km)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoindex_stream !! Topographic index of the residence time for a basin (km)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rlen REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rlen
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rdz REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rdz
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_beta_fp REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_beta_fp
...@@ -725,7 +736,8 @@ SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, num ...@@ -725,7 +736,8 @@ SUBROUTINE killbas(nbpt, inflowmax, nbasmax, nwbas, ops, tokill, totakeover, num
END IF END IF
END DO END DO
CALL routing_reg_killbas(nbpt, ib, tok, totak, nwbas, inflowmax, basin_count, basin_area, & CALL routing_reg_killbas(nbpt, ib, tok, totak, nwbas, inflowmax, basin_count, basin_area, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind, basin_rlen, & & basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg,&
& basin_topoind, basin_topoindex_stream, basin_rlen, &
& basin_rdz, basin_beta_fp, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, & & basin_rdz, basin_beta_fp, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, &
& outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin) & outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin)
END IF END IF
......
...@@ -26,6 +26,7 @@ MODULE routing_reg ...@@ -26,6 +26,7 @@ MODULE routing_reg
! !
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: routing_cg_glo !! Centre of gravity of HTU (Lat, Lon) 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 (km) REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_resid_glo !! Topographic index of the retention time (km)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_resid_stream_glo !! Topographic index of the retention time (km) - stream
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_rlen_glo !! HTU river length (m) REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_rlen_glo !! HTU river length (m)
REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_rdz_glo !! HTU river elevation change (m) REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_rdz_glo !! HTU river elevation change (m)
! !
...@@ -427,7 +428,7 @@ CONTAINS ...@@ -427,7 +428,7 @@ CONTAINS
SUBROUTINE routing_reg_findbasins(nb_htu, nbv, ib, ijdimmax, nbi, nbj, trip, basin, fac, hierarchy, topoind, & SUBROUTINE routing_reg_findbasins(nb_htu, nbv, ib, ijdimmax, nbi, nbj, trip, basin, fac, hierarchy, topoind, &
& rlen, rdz, rweight, lshead, diaglalo, nb_basin, basin_inbxid, basin_outlet, basin_outtp, basin_sz, & & rlen, rdz, rweight, lshead, diaglalo, nb_basin, basin_inbxid, basin_outlet, basin_outtp, basin_sz, &
& basin_bxout, basin_bbout, basin_pts, basin_lshead, coast_pts, lontmp, lattmp, orog) !basin_topoindex_stream & basin_bxout, basin_bbout, basin_pts, basin_lshead, coast_pts, lontmp, lattmp, orog, basin_topoindex_stream )
! !
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -469,7 +470,7 @@ CONTAINS ...@@ -469,7 +470,7 @@ CONTAINS
INTEGER(i_std), INTENT(out) :: basin_bbout(nb_htu) !! INTEGER(i_std), INTENT(out) :: basin_bbout(nb_htu) !!
INTEGER(i_std), INTENT(out) :: basin_pts(nb_htu, nbv, 2) !! INTEGER(i_std), INTENT(out) :: basin_pts(nb_htu, nbv, 2) !!
INTEGER(i_std), INTENT(out) :: coast_pts(nb_htu) !! The coastal flow points (unitless) INTEGER(i_std), INTENT(out) :: coast_pts(nb_htu) !! The coastal flow points (unitless)
REAL(r_std) :: basin_topoindex_stream(nb_htu) !! INTENT(out) REAL(r_std), INTENT(out) :: basin_topoindex_stream(nb_htu) !!
! !
!! LOCAL VARIABLES !! LOCAL VARIABLES
LOGICAL, PARAMETER :: debug=.FALSE. LOGICAL, PARAMETER :: debug=.FALSE.
...@@ -775,7 +776,6 @@ CONTAINS ...@@ -775,7 +776,6 @@ CONTAINS
! and if the HTU is not too small -> more than 4 pixels ! and if the HTU is not too small -> more than 4 pixels
IF (( fac_glo_trib .GT. fac_lim ) .AND. ( fac_loc_trib .GT. 4 )) THEN IF (( fac_glo_trib .GT. fac_lim ) .AND. ( fac_loc_trib .GT. 4 )) THEN
changes = changes + 1 changes = changes + 1
WRITE(*,*) "Here global cut"
CALL routing_reg_divbas_cut(nb_htu, nbv, nbi, nbj, ibas,toutloc(ibas,1), toutloc(ibas,2),& CALL routing_reg_divbas_cut(nb_htu, nbv, nbi, nbj, ibas,toutloc(ibas,1), toutloc(ibas,2),&
& tsz(ibas), toutbas(ibas), toutdir(ibas), & & tsz(ibas), toutbas(ibas), toutdir(ibas), &
& toutlshead(ibas), tpts, trip, basin, fac, lontmp, lattmp, il_trib, jl_trib, & & toutlshead(ibas), tpts, trip, basin, fac, lontmp, lattmp, il_trib, jl_trib, &
...@@ -803,7 +803,6 @@ CONTAINS ...@@ -803,7 +803,6 @@ CONTAINS
! Check with the local fac if the tributary is not too small (>1%) ! Check with the local fac if the tributary is not too small (>1%)
IF ( fac_loc_trib / REAL(totsz) .GT. 1./REAL(100) ) THEN IF ( fac_loc_trib / REAL(totsz) .GT. 1./REAL(100) ) THEN
changes = changes + 1 changes = changes + 1
WRITE(*,*) "Here local cut"
CALL routing_reg_divbas_cut(nb_htu, nbv, nbi, nbj, ibas,toutloc(ibas,1), toutloc(ibas,2),& CALL routing_reg_divbas_cut(nb_htu, nbv, nbi, nbj, ibas,toutloc(ibas,1), toutloc(ibas,2),&
& tsz(ibas), toutbas(ibas), toutdir(ibas), & & tsz(ibas), toutbas(ibas), toutdir(ibas), &
& toutlshead(ibas), tpts, trip, basin, fac, lontmp, lattmp, il_trib, jl_trib, & & toutlshead(ibas), tpts, trip, basin, fac, lontmp, lattmp, il_trib, jl_trib, &
...@@ -3220,7 +3219,8 @@ SUBROUTINE isin_halo(ig, nbhalo, nbpt, halopts, isinhalo) ...@@ -3220,7 +3219,8 @@ SUBROUTINE isin_halo(ig, nbhalo, nbpt, halopts, isinhalo)
SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcenters, nwbas,& SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcenters, nwbas,&
& inflowmax, num_largest, basin_count, basin_notrun, basin_area, basin_orog_mean,& & inflowmax, num_largest, basin_count, basin_notrun, basin_area, basin_orog_mean,&
& basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind, basin_rlen, basin_rdz, & & basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind, &
& basin_topoindex_stream, basin_rlen, basin_rdz, &
& basin_beta_fp, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, & & basin_beta_fp, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, &
& outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin, floodcri) & outflow_grid, outflow_basin, inflow_number, inflow_grid, inflow_basin, floodcri)
! !
...@@ -3254,6 +3254,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente ...@@ -3254,6 +3254,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_floodp !! 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,2), INTENT(inout) :: basin_cg !!
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Mean Topographic index of HTU (km) REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Mean Topographic index of HTU (km)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoindex_stream !! Topographic index of HTU (km) - stream
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rlen REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rlen
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rdz REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_rdz
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_beta_fp !! REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_beta_fp !!
...@@ -3315,6 +3316,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente ...@@ -3315,6 +3316,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
routing_cg_glo(ib,:,:) = 0.0 routing_cg_glo(ib,:,:) = 0.0
! Perhaps here we should put a NaN so we can filter it out later !!! ! Perhaps here we should put a NaN so we can filter it out later !!!
topo_resid_glo(ib,:) = topoindexmin topo_resid_glo(ib,:) = topoindexmin
topo_resid_stream_glo(ib,:) = topoindexmin
topo_rlen_glo(ib,:) = hydro_meanlen topo_rlen_glo(ib,:) = hydro_meanlen
topo_rdz_glo(ib,:) = hydro_meandz topo_rdz_glo(ib,:) = hydro_meandz
global_basinid_glo(ib,:) = zero global_basinid_glo(ib,:) = zero
...@@ -3374,6 +3376,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente ...@@ -3374,6 +3376,7 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
routing_cg_glo(ib,ij,:) = basin_cg(ib,ij,:) routing_cg_glo(ib,ij,:) = basin_cg(ib,ij,:)
! !
topo_resid_glo(ib,ij) = basin_topoind(ib,ij) topo_resid_glo(ib,ij) = basin_topoind(ib,ij)
topo_resid_stream_glo(ib,ij) = basin_topoindex_stream(ib,ij)
topo_rlen_glo(ib,ij) = basin_rlen(ib,ij) topo_rlen_glo(ib,ij) = basin_rlen(ib,ij)
topo_rdz_glo(ib,ij) = basin_rdz(ib,ij) topo_rdz_glo(ib,ij) = basin_rdz(ib,ij)
! !
...@@ -3484,8 +3487,9 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente ...@@ -3484,8 +3487,9 @@ SUBROUTINE routing_reg_end_truncate(nbpt, nbasmax, gridarea, contfrac, gridcente
!_ ================================================================================================================================ !_ ================================================================================================================================
SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, basin_count, basin_area, & SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, basin_count, basin_area, &
& basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind, basin_rlen, & & basin_orog_mean, basin_orog_min, basin_orog_max, basin_floodp, basin_cg, basin_topoind, &
& basin_rdz, basin_beta_fp, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, & & basin_topoindex_stream, basin_rlen, basin_rdz, basin_beta_fp, fetch_basin, &
& basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, &
& outflow_basin, inflow_number, inflow_grid, inflow_basin) & outflow_basin, inflow_number, inflow_grid, inflow_basin)
! !
! !
...@@ -3509,6 +3513,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b ...@@ -3509,6 +3513,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_floodp !! REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_floodp !!
REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_cg !! 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 (km) REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (km)
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoindex_stream !! Topographic index of the residence time for a basin (km) - stream res
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_rlen REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_rlen
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_rdz REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_rdz
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_beta_fp !! REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_beta_fp !!
...@@ -3537,6 +3542,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b ...@@ -3537,6 +3542,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
! !
basin_topoind(ib, totakeover) = (basin_topoind(ib, totakeover)*basin_area(ib, totakeover) & basin_topoind(ib, totakeover) = (basin_topoind(ib, totakeover)*basin_area(ib, totakeover) &
& + basin_topoind(ib, tokill)*basin_area(ib, tokill))/(basin_area(ib, totakeover) + basin_area(ib, tokill)) & + basin_topoind(ib, tokill)*basin_area(ib, tokill))/(basin_area(ib, totakeover) + basin_area(ib, tokill))
!
basin_rlen(ib, totakeover) = (basin_rlen(ib, totakeover)+basin_rlen(ib, tokill))*0.5 basin_rlen(ib, totakeover) = (basin_rlen(ib, totakeover)+basin_rlen(ib, tokill))*0.5
basin_rdz(ib, totakeover) = (basin_rdz(ib, totakeover)+basin_rdz(ib, tokill))*0.5 basin_rdz(ib, totakeover) = (basin_rdz(ib, totakeover)+basin_rdz(ib, tokill))*0.5
! !
...@@ -3670,6 +3676,8 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b ...@@ -3670,6 +3676,8 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
basin_cg(ib, basin_count(ib):nwbas,:) = zero basin_cg(ib, basin_count(ib):nwbas,:) = zero
basin_topoind(ib, tokill:basin_count(ib)-1) = basin_topoind(ib, tokill+1:basin_count(ib)) basin_topoind(ib, tokill:basin_count(ib)-1) = basin_topoind(ib, tokill+1:basin_count(ib))
basin_topoind(ib, basin_count(ib):nwbas) = zero basin_topoind(ib, basin_count(ib):nwbas) = zero
basin_topoindex_stream(ib, tokill:basin_count(ib)-1) = basin_topoindex_stream(ib, tokill+1:basin_count(ib))
basin_topoindex_stream(ib, basin_count(ib):nwbas) = zero
basin_rlen(ib, basin_count(ib):nwbas) = zero basin_rlen(ib, basin_count(ib):nwbas) = zero
basin_rdz(ib, basin_count(ib):nwbas) = zero basin_rdz(ib, basin_count(ib):nwbas) = zero
fetch_basin(ib, tokill:basin_count(ib)-1) = fetch_basin(ib, tokill+1:basin_count(ib)) fetch_basin(ib, tokill:basin_count(ib)-1) = fetch_basin(ib, tokill+1:basin_count(ib))
...@@ -3749,6 +3757,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b ...@@ -3749,6 +3757,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, inflowmax, b
ALLOCATE (route_fetch_glo(nbpt,nbasmax), stat=ier) ALLOCATE (route_fetch_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (routing_cg_glo(nbpt,nbasmax,2), stat=ier) ALLOCATE (routing_cg_glo(nbpt,nbasmax,2), stat=ier)
ALLOCATE (topo_resid_glo(nbpt,nbasmax), stat=ier) ALLOCATE (topo_resid_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (topo_resid_stream_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (topo_rlen_glo(nbpt,nbasmax), stat=ier) ALLOCATE (topo_rlen_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (topo_rdz_glo(nbpt,nbasmax), stat=ier) ALLOCATE (topo_rdz_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (route_count_glo(nbpt), stat=ier) ALLOCATE (route_count_glo(nbpt), stat=ier)
......
...@@ -105,7 +105,7 @@ class HydroGraph : ...@@ -105,7 +105,7 @@ class HydroGraph :
# #
# #
self.routing_area, self.routing_orog_mean, self.routing_orog_min,self.routing_orog_max, \ self.routing_area, self.routing_orog_mean, self.routing_orog_min,self.routing_orog_max, \
self.routing_floodp,self.routing_beta, self.routing_cg, self.topo_resid, self.topo_rlen, \ self.routing_floodp,self.routing_beta, self.routing_cg, self.topo_resid, self.topo_resid_stream, self.topo_rlen, \
self.topo_rdz, self.route_nbbasin, self.route_togrid, self.route_tobasin, self.route_nbintobas, \ self.topo_rdz, 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, self.floodcri = \ self.global_basinid, self.route_outlet, self.route_type, self.origin_nbintobas, self.routing_fetch, self.floodcri = \
routing_interface.finish_truncate(nbpt = self.nbpt, inflowmax = nbxmax_in, nbasmax = nbasmax, nwbas = nwbas, \ routing_interface.finish_truncate(nbpt = self.nbpt, inflowmax = nbxmax_in, nbasmax = nbasmax, nwbas = nwbas, \
...@@ -116,6 +116,7 @@ class HydroGraph : ...@@ -116,6 +116,7 @@ class HydroGraph :
basin_orog_mean = hydrosuper.basin_orog_mean, basin_orog_min = hydrosuper.basin_orog_min,\ 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_orog_max = hydrosuper.basin_orog_max, basin_floodp = hydrosuper.basin_floodp, \
basin_cg = hydrosuper.basin_cg, basin_topoind = hydrosuper.basin_topoind, \ basin_cg = hydrosuper.basin_cg, basin_topoind = hydrosuper.basin_topoind, \
basin_topoindex_stream = hydrosuper.basin_topoindex_stream, \
basin_rlen = hydrosuper.basin_rlen, basin_rdz = hydrosuper.basin_rdz, \ basin_rlen = hydrosuper.basin_rlen, basin_rdz = hydrosuper.basin_rdz, \
basin_beta_fp = hydrosuper.basin_beta_fp , fetch_basin = hydrosuper.fetch_basin, \ basin_beta_fp = hydrosuper.basin_beta_fp , fetch_basin = hydrosuper.fetch_basin, \
basin_id = hydrosuper.basin_id, \ basin_id = hydrosuper.basin_id, \
...@@ -351,6 +352,14 @@ class HydroGraph : ...@@ -351,6 +352,14 @@ class HydroGraph :
"topoindex", "Topographic index of the retention time", "km", self.topo_resid[:,:], vtyp) "topoindex", "Topographic index of the retention time", "km", self.topo_resid[:,:], vtyp)
self.add_tstepdistrib(outnf, procgrid, NCFillValue, part, self.topo_resid[:,:], self.routing_area[:,:], \ self.add_tstepdistrib(outnf, procgrid, NCFillValue, part, self.topo_resid[:,:], self.routing_area[:,:], \
vtyp, nbbins, tcst) vtyp, nbbins, tcst)
#
# topoindex stream
self.add_variable(outnf, procgrid, NCFillValue, part, ('z','y','x'), \
"topoindex_stream", "Topographic index of the retention time for stream res.", "km", self.topo_resid_stream[:,:], vtyp)
# Add another distribution ? Or replace the other ?
#self.add_tstepdistrib(outnf, procgrid, NCFillValue, part, self.topo_resid_stream[:,:], self.routing_area[:,:], \
# vtyp, nbbins, tcst)
# #
# Geometric properties of HTU # Geometric properties of HTU
self.add_variable(outnf, procgrid, NCFillValue, part, ('z','y','x'), \ self.add_variable(outnf, procgrid, NCFillValue, part, ('z','y','x'), \
......
...@@ -172,7 +172,7 @@ class HydroSuper : ...@@ -172,7 +172,7 @@ class HydroSuper :
# Call findbasins # Call findbasins
# #
nb_basin, basin_inbxid, basin_outlet, basin_outtp, self.basin_sz, basin_bxout, basin_bbout, self.basin_pts, \ nb_basin, basin_inbxid, basin_outlet, basin_outtp, self.basin_sz, basin_bxout, basin_bbout, self.basin_pts, \
basin_lshead, coast_pts = \ basin_lshead, coast_pts, self.basin_topoindex_stream = \
routing_interface.findbasins(nbpt = self.nbpt, nb_htu = self.nbhtuext, nbv = nbv, nbi = hydrooverlap.nbi, \ routing_interface.findbasins(nbpt = self.nbpt, nb_htu = self.nbhtuext, nbv = nbv, nbi = hydrooverlap.nbi, \
nbj = hydrooverlap.nbj, trip_bx = hydrooverlap.trip_bx, \ nbj = hydrooverlap.nbj, trip_bx = hydrooverlap.trip_bx, \
basin_bx = hydrooverlap.basin_bx, fac_bx = hydrooverlap.fac_bx, \ basin_bx = hydrooverlap.basin_bx, fac_bx = hydrooverlap.fac_bx, \
...@@ -184,6 +184,7 @@ class HydroSuper : ...@@ -184,6 +184,7 @@ class HydroSuper :
# Adjust nwbas to the maximum found over the domain # Adjust nwbas to the maximum found over the domain
# #
self.nwbas = part.domainmax(np.max(nb_basin)) self.nwbas = part.domainmax(np.max(nb_basin))
self.basin_topoindex_stream = self.basin_topoindex_stream[:,:self.nwbas]
# Set the number of inflows per basin. For the moment twice the maximum number of basins. # Set the number of inflows per basin. For the moment twice the maximum number of basins.
self.inflowmax = max(10, self.nwbas*2) self.inflowmax = max(10, self.nwbas*2)
print("Maximum number of basin created : {0}".format(self.nwbas)) print("Maximum number of basin created : {0}".format(self.nwbas))
...@@ -223,7 +224,7 @@ class HydroSuper : ...@@ -223,7 +224,7 @@ class HydroSuper :
for variable in [self.basin_count, self.basin_notrun, self.basin_area, self.basin_hierarchy,\ for variable in [self.basin_count, self.basin_notrun, self.basin_area, self.basin_hierarchy,\
self.basin_orog_mean,self.basin_orog_min,self.basin_orog_max,self.basin_floodp,\ 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_type,self.basin_flowdir,\ self.basin_fac, self.basin_topoind, self.basin_id,self.basin_type,self.basin_flowdir,\
self.basin_lshead, self.outflow_basin,self.nbcoastal,self.coastal_basin]: self.basin_lshead, self.outflow_basin,self.nbcoastal,self.coastal_basin, self.basin_topoindex_stream]:
part.landsendtohalo(variable, order='F') part.landsendtohalo(variable, order='F')
comm.Barrier() comm.Barrier()
# #
...@@ -362,7 +363,8 @@ class HydroSuper : ...@@ -362,7 +363,8 @@ class HydroSuper :
totakeover = totakeover, numops = numops, basin_count = self.basin_count,\ totakeover = totakeover, numops = numops, basin_count = self.basin_count,\
basin_area = self.basin_area, basin_orog_mean = self.basin_orog_mean, \ 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_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, basin_rlen = self.basin_rlen, \ basin_cg = self.basin_cg, basin_topoind = self.basin_topoind, \
basin_topoindex_stream = self.basin_topoindex_stream, basin_rlen = self.basin_rlen, \
basin_rdz = self.basin_rdz, basin_beta_fp = self.basin_beta_fp, fetch_basin = self.fetch_basin,\ basin_rdz = self.basin_rdz, basin_beta_fp = self.basin_beta_fp, fetch_basin = self.fetch_basin,\
basin_id = self.basin_id, basin_coor = self.basin_outcoor, basin_type = self.basin_type,\ 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, \ basin_flowdir = self.basin_flowdir, outflow_grid = self.outflow_grid, outflow_basin = self.outflow_basin, \
......
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