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

Add the diagnostic of the centre of gravity of the HTU to thegraph description.

parent 98f59ec8
...@@ -97,13 +97,15 @@ basin_pts : rank-4 array('i') with bounds (nbpt,nbvmax_in,nbvmax_in,2) ...@@ -97,13 +97,15 @@ basin_pts : rank-4 array('i') with bounds (nbpt,nbvmax_in,nbvmax_in,2)
basin_lshead : rank-2 array('f') with bounds (nbpt,nbvmax_in) basin_lshead : rank-2 array('f') with bounds (nbpt,nbvmax_in)
coast_pts : rank-2 array('i') with bounds (nbpt,nbvmax_in) coast_pts : rank-2 array('i') with bounds (nbpt,nbvmax_in)
==================================================================== ====================================================================
basin_count,basin_notrun,basin_area,basin_hierarchy,basin_fac,basin_topoind,basin_id,basin_coor,basin_type,basin_flowdir,basin_lshead,outflow_grid,outflow_basin,nbcoastal,coastal_basin = globalize(area_bx,trip_bx,hierarchy_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,[nbpt,nbvmax_in,nbxmax_in]) basin_count,basin_notrun,basin_area,basin_cg,basin_hierarchy,basin_fac,basin_topoind,basin_id,basin_coor,basin_type,basin_flowdir,basin_lshead,outflow_grid,outflow_basin,nbcoastal,coastal_basin = globalize(area_bx,lon_bx,lat_bx,trip_bx,hierarchy_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,[nbpt,nbvmax_in,nbxmax_in])
Wrapper for ``globalize``. Wrapper for ``globalize``.
Parameters Parameters
---------- ----------
area_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in) area_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in)
lon_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in)
lat_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in)
trip_bx : input rank-3 array('i') with bounds (nbpt,nbxmax_in,nbxmax_in) trip_bx : input rank-3 array('i') with bounds (nbpt,nbxmax_in,nbxmax_in)
hierarchy_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in) hierarchy_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in)
fac_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in) fac_bx : input rank-3 array('f') with bounds (nbpt,nbxmax_in,nbxmax_in)
...@@ -135,6 +137,7 @@ Returns ...@@ -135,6 +137,7 @@ Returns
basin_count : rank-1 array('i') with bounds (nbpt) basin_count : rank-1 array('i') with bounds (nbpt)
basin_notrun : rank-1 array('i') with bounds (nbpt) basin_notrun : rank-1 array('i') with bounds (nbpt)
basin_area : rank-2 array('f') with bounds (nbpt,nwbas) basin_area : rank-2 array('f') with bounds (nbpt,nwbas)
basin_cg : rank-3 array('f') with bounds (nbpt,nwbas,2)
basin_hierarchy : rank-2 array('f') with bounds (nbpt,nwbas) basin_hierarchy : rank-2 array('f') with bounds (nbpt,nwbas)
basin_fac : rank-2 array('f') with bounds (nbpt,nwbas) basin_fac : rank-2 array('f') with bounds (nbpt,nwbas)
basin_topoind : rank-2 array('f') with bounds (nbpt,nwbas) basin_topoind : rank-2 array('f') with bounds (nbpt,nwbas)
...@@ -206,7 +209,7 @@ Returns ...@@ -206,7 +209,7 @@ Returns
------- -------
fetch_basin : rank-2 array('f') with bounds (nbpt,nwbas) fetch_basin : rank-2 array('f') with bounds (nbpt,nwbas)
==================================================================== ====================================================================
routing_area,topo_resid,route_togrid,route_tobasin,route_nbintobas,global_basinid,route_outlet,route_type,origin_nbintobas = truncate(nbasmax,basin_count,basin_notrun,basin_area,basin_topoind,fetch_basin,basin_id,basin_coor,basin_type,basin_flowdir,outflow_grid,outflow_basin,inflow_number,inflow_grid,inflow_basin,[nbpt,nbxmax_in,nwbas]) routing_area,routing_cg,topo_resid,route_togrid,route_tobasin,route_nbintobas,global_basinid,route_outlet,route_type,origin_nbintobas = truncate(nbasmax,basin_count,basin_notrun,basin_area,basin_cg,basin_topoind,fetch_basin,basin_id,basin_coor,basin_type,basin_flowdir,outflow_grid,outflow_basin,inflow_number,inflow_grid,inflow_basin,[nbpt,nbxmax_in,nwbas])
Wrapper for ``truncate``. Wrapper for ``truncate``.
...@@ -216,6 +219,7 @@ nbasmax : input int ...@@ -216,6 +219,7 @@ nbasmax : input int
basin_count : in/output rank-1 array('i') with bounds (nbpt) basin_count : in/output rank-1 array('i') with bounds (nbpt)
basin_notrun : in/output rank-1 array('i') with bounds (nbpt) basin_notrun : in/output rank-1 array('i') with bounds (nbpt)
basin_area : in/output rank-2 array('f') with bounds (nbpt,nwbas) basin_area : in/output rank-2 array('f') with bounds (nbpt,nwbas)
basin_cg : in/output rank-3 array('f') with bounds (nbpt,nwbas,2)
basin_topoind : in/output rank-2 array('f') with bounds (nbpt,nwbas) basin_topoind : in/output rank-2 array('f') with bounds (nbpt,nwbas)
fetch_basin : in/output rank-2 array('f') with bounds (nbpt,nwbas) fetch_basin : in/output rank-2 array('f') with bounds (nbpt,nwbas)
basin_id : in/output rank-2 array('i') with bounds (nbpt,nwbas) basin_id : in/output rank-2 array('i') with bounds (nbpt,nwbas)
...@@ -240,6 +244,7 @@ nwbas : input int, optional ...@@ -240,6 +244,7 @@ nwbas : input int, optional
Returns Returns
------- -------
routing_area : rank-2 array('f') with bounds (nbpt,nbasmax) routing_area : rank-2 array('f') with bounds (nbpt,nbasmax)
routing_cg : rank-3 array('f') with bounds (nbpt,nbasmax,2)
topo_resid : rank-2 array('f') with bounds (nbpt,nbasmax) topo_resid : rank-2 array('f') with bounds (nbpt,nbasmax)
route_togrid : rank-2 array('i') with bounds (nbpt,nbasmax) route_togrid : rank-2 array('i') with bounds (nbpt,nbasmax)
route_tobasin : rank-2 array('i') with bounds (nbpt,nbasmax) route_tobasin : rank-2 array('i') with bounds (nbpt,nbasmax)
......
...@@ -154,9 +154,9 @@ SUBROUTINE findbasins(nbpt, nbvmax_in, nbxmax_in, nbi, nbj, trip_bx, basin_bx, f ...@@ -154,9 +154,9 @@ SUBROUTINE findbasins(nbpt, nbvmax_in, nbxmax_in, nbi, nbj, trip_bx, basin_bx, f
END SUBROUTINE findbasins END SUBROUTINE findbasins
SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx, fac_bx, topoind_bx, & SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, lon_bx, lat_bx, trip_bx, hierarchy_bx, fac_bx, topoind_bx, &
& min_topoind, nb_basin, basin_inbxid, basin_outlet, basin_outtp, basin_sz, basin_pts, basin_bxout, & & 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_hierarchy, & & basin_bbout, lshead, coast_pts, nwbas, basin_count, basin_notrun, basin_area, basin_cg, basin_hierarchy, &
& basin_fac, basin_topoind, basin_id, basin_coor, basin_type, basin_flowdir, basin_lshead, & & basin_fac, basin_topoind, basin_id, basin_coor, basin_type, basin_flowdir, basin_lshead, &
& outflow_grid, outflow_basin, nbcoastal, coastal_basin) & outflow_grid, outflow_basin, nbcoastal, coastal_basin)
! !
...@@ -169,8 +169,10 @@ SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx, ...@@ -169,8 +169,10 @@ SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx,
! !
!! INPUT VARIABLES !! INPUT VARIABLES
INTEGER(i_std), INTENT (in) :: nbpt !! Domain size (unitless) INTEGER(i_std), INTENT (in) :: nbpt !! Domain size (unitless)
INTEGER(i_std), INTENT(in) :: nbvmax_in, nbxmax_in INTEGER(i_std), INTENT(in) :: nbvmax_in, nbxmax_in
REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: area_bx !! Area of each small box in the grid box (m^2) REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: area_bx !! Area of each small box in the grid box (m^2)
REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: lon_bx !! Longitude of each small box in the grid box
REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: lat_bx !! Latitude of each small box in the grid box
INTEGER(i_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: trip_bx !! The trip field for each of the smaller boxes (unitless) INTEGER(i_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: trip_bx !! The trip field for each of the smaller boxes (unitless)
REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: hierarchy_bx !! Level in the basin of the point REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: hierarchy_bx !! Level in the basin of the point
REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: fac_bx !! Level in the basin of the point REAL(r_std), INTENT (in), DIMENSION(nbpt,nbxmax_in,nbxmax_in) :: fac_bx !! Level in the basin of the point
...@@ -194,6 +196,7 @@ SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx, ...@@ -194,6 +196,7 @@ SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx,
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_type !! REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_type !!
INTEGER(i_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_flowdir !! Water flow directions in the basin (unitless) INTEGER(i_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_flowdir !! Water flow directions in the basin (unitless)
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_area !! 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_hierarchy !!
REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_fac !! 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) REAL(r_std), INTENT (out), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m)
...@@ -211,10 +214,11 @@ SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx, ...@@ -211,10 +214,11 @@ SUBROUTINE globalize(nbpt, nbvmax_in, nbxmax_in, area_bx, trip_bx, hierarchy_bx,
ENDIF ENDIF
!! !!
DO ib=1,nbpt DO ib=1,nbpt
CALL routing_reg_globalize(nbpt, ib, neighbours, area_bx(ib,:,:), trip_bx(ib,:,:), hierarchy_bx(ib,:,:), fac_bx(ib,:,:), & CALL routing_reg_globalize(nbpt, ib, neighbours, area_bx(ib,:,:), lon_bx(ib,:,:), lat_bx(ib,:,:), trip_bx(ib,:,:), &
& hierarchy_bx(ib,:,:), fac_bx(ib,:,:), &
& topoind_bx(ib,:,:), min_topoind, nb_basin(ib), basin_inbxid(ib,:), basin_outlet(ib,:,:), basin_outtp(ib,:), & & 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_sz(ib,:), basin_pts(ib,:,:,:), basin_bxout(ib,:), basin_bbout(ib,:), lshead(ib,:), coast_pts(ib,:), nwbas, &
& basin_count, basin_notrun, basin_area, basin_hierarchy, basin_fac, basin_topoind, basin_id, basin_coor, & & basin_count, basin_notrun, basin_area, basin_cg, basin_hierarchy, basin_fac, basin_topoind, basin_id, basin_coor, &
& basin_type, basin_flowdir, basin_lshead, outflow_grid, outflow_basin, nbcoastal, coastal_basin) & basin_type, basin_flowdir, basin_lshead, outflow_grid, outflow_basin, nbcoastal, coastal_basin)
ENDDO ENDDO
! !
...@@ -296,9 +300,9 @@ SUBROUTINE fetch(nbpt, nwbas, basin_count, basin_area, basin_id, basin_hierarchy ...@@ -296,9 +300,9 @@ SUBROUTINE fetch(nbpt, nwbas, basin_count, basin_area, basin_id, basin_hierarchy
END SUBROUTINE fetch END SUBROUTINE fetch
SUBROUTINE truncate(nbpt, nbxmax_in, nbasmax, nwbas, basin_count, basin_notrun, basin_area, basin_topoind,& SUBROUTINE truncate(nbpt, nbxmax_in, nbasmax, nwbas, basin_count, basin_notrun, basin_area, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin, routing_area, topo_resid, route_togrid, route_tobasin, route_nbintobas, & & inflow_grid, inflow_basin, routing_area, routing_cg, topo_resid, route_togrid, route_tobasin, route_nbintobas, &
& global_basinid, route_outlet, route_type, origin_nbintobas) & global_basinid, route_outlet, route_type, origin_nbintobas)
! !
USE ioipsl USE ioipsl
...@@ -320,6 +324,7 @@ SUBROUTINE truncate(nbpt, nbxmax_in, nbasmax, nwbas, basin_count, basin_notrun, ...@@ -320,6 +324,7 @@ SUBROUTINE truncate(nbpt, nbxmax_in, nbasmax, nwbas, basin_count, basin_notrun,
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_type !! 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) 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_area !!
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) REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (m)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !! REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !!
INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: outflow_grid !! Type of outflow on the grid box (unitless) INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: outflow_grid !! Type of outflow on the grid box (unitless)
...@@ -333,26 +338,28 @@ SUBROUTINE truncate(nbpt, nbxmax_in, nbasmax, nwbas, basin_count, basin_notrun, ...@@ -333,26 +338,28 @@ SUBROUTINE truncate(nbpt, nbxmax_in, nbasmax, nwbas, basin_count, basin_notrun,
! !
! Output variables ! 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_area !! Surface of basin (m^2)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: topo_resid !! Topographic index of the retention time (m) 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 (m)
INTEGER(i_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: route_togrid !! Grid into which the basin flows (unitless) INTEGER(i_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: route_togrid !! Grid into which the basin flows (unitless)
INTEGER(i_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: route_tobasin !! Basin in to which the water goes (unitless) INTEGER(i_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: route_tobasin !! Basin in to which the water goes (unitless)
INTEGER(i_std), DIMENSION(nbpt), INTENT(out) :: route_nbintobas !! Number of basin into current one (unitless) INTEGER(i_std), DIMENSION(nbpt), INTENT(out) :: route_nbintobas !! Number of basin into current one (unitless)
INTEGER(i_std), DIMENSION(nbpt), INTENT(out) :: origin_nbintobas !! Number of sub-grid basin into current one before truncation (unitless) INTEGER(i_std), DIMENSION(nbpt), INTENT(out) :: origin_nbintobas !! Number of sub-grid basin into current one before truncation (unitless)
INTEGER(i_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: global_basinid !! ID of basin (unitless) INTEGER(i_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: global_basinid !! ID of basin (unitless)
REAL(r_std), DIMENSION(nbpt,nbasmax,2), INTENT(out) :: route_outlet !! Coordinate of outlet (-) REAL(r_std), DIMENSION(nbpt,nbasmax,2), INTENT(out) :: route_outlet !! Coordinate of outlet (-)
REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: route_type !! Coordinate of outlet (-) REAL(r_std), DIMENSION(nbpt,nbasmax), INTENT(out) :: route_type !! Coordinate of outlet (-)
! !
IF ( nbxmax_in .NE. nbxmax ) THEN IF ( nbxmax_in .NE. nbxmax ) THEN
WRITE(*,*) "TRUNCATE : nbxmax has changed !!" WRITE(*,*) "TRUNCATE : nbxmax has changed !!"
STOP STOP
ENDIF ENDIF
CALL routing_reg_truncate(nbpt, nbasmax, area, contfrac, nwbas, basin_count, basin_notrun, basin_area, basin_topoind,& CALL routing_reg_truncate(nbpt, nbasmax, area, contfrac, nwbas, basin_count, basin_notrun, basin_area, basin_cg, &
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & basin_topoind, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin) & inflow_grid, inflow_basin)
routing_area(:,:) = routing_area_glo(:,:) routing_area(:,:) = routing_area_glo(:,:)
routing_cg(:,:,:) = routing_cg_glo(:,:,:)
topo_resid(:,:) = topo_resid_glo(:,:) topo_resid(:,:) = topo_resid_glo(:,:)
route_togrid(:,:) = route_togrid_glo(:,:) route_togrid(:,:) = route_togrid_glo(:,:)
route_tobasin(:,:) = route_tobasin_glo(:,:) route_tobasin(:,:) = route_tobasin_glo(:,:)
......
...@@ -16,6 +16,7 @@ MODULE routing_reg ...@@ -16,6 +16,7 @@ MODULE routing_reg
INTEGER(i_std), SAVE :: nbasmax_save 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_area_glo !! Surface of basin (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) REAL(r_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: topo_resid_glo !! Topographic index of the retention time (m)
INTEGER(i_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: route_togrid_glo !! Grid into which the basin flows (unitless) INTEGER(i_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: route_togrid_glo !! Grid into which the basin flows (unitless)
INTEGER(i_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: route_tobasin_glo !! Basin in to which the water goes (unitless) INTEGER(i_std), SAVE, ALLOCATABLE, DIMENSION(:,:) :: route_tobasin_glo !! Basin in to which the water goes (unitless)
...@@ -1633,9 +1634,9 @@ CONTAINS ...@@ -1633,9 +1634,9 @@ CONTAINS
!! \n !! \n
!_ ================================================================================================================================ !_ ================================================================================================================================
SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarchy_bx, fac_bx, topoind_bx, & SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, lon_bx, lat_bx, trip_bx, hierarchy_bx, fac_bx, topoind_bx, &
& min_topoind, nb_basin, basin_inbxid, basin_outlet, basin_outtp, basin_sz, basin_pts, basin_bxout, & & 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_hierarchy, & & basin_bbout, lshead, coast_pts, nwbas, basin_count, basin_notrun, basin_area, basin_cg, basin_hierarchy, &
& basin_fac, basin_topoind, basin_id, basin_coor, basin_type, basin_flowdir, basin_lshead, & & basin_fac, basin_topoind, basin_id, basin_coor, basin_type, basin_flowdir, basin_lshead, &
& outflow_grid, outflow_basin, nbcoastal, coastal_basin) & outflow_grid, outflow_basin, nbcoastal, coastal_basin)
! !
...@@ -1648,6 +1649,8 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc ...@@ -1648,6 +1649,8 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc
!! (1=North and then clockwise) !! (1=North and then clockwise)
!! LOCAL VARIABLES !! LOCAL VARIABLES
REAL(r_std), DIMENSION(nbxmax,nbxmax) :: area_bx !! Area of each small box in the grid box (m^2) REAL(r_std), DIMENSION(nbxmax,nbxmax) :: area_bx !! Area of each small box in the grid box (m^2)
REAL(r_std), DIMENSION(nbxmax,nbxmax) :: lon_bx !! Longitude of each small box in the grid box
REAL(r_std), DIMENSION(nbxmax,nbxmax) :: lat_bx !! Latitude of each small box in the grid box
INTEGER(i_std), DIMENSION(nbxmax,nbxmax) :: trip_bx !! The trip field for each of the smaller boxes (unitless) INTEGER(i_std), DIMENSION(nbxmax,nbxmax) :: trip_bx !! The trip field for each of the smaller boxes (unitless)
REAL(r_std), DIMENSION(nbxmax,nbxmax) :: hierarchy_bx !! Level in the basin of the point REAL(r_std), DIMENSION(nbxmax,nbxmax) :: hierarchy_bx !! Level in the basin of the point
REAL(r_std), DIMENSION(nbxmax,nbxmax) :: fac_bx !! Level in the basin of the point REAL(r_std), DIMENSION(nbxmax,nbxmax) :: fac_bx !! Level in the basin of the point
...@@ -1655,7 +1658,7 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc ...@@ -1655,7 +1658,7 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc
REAL(r_std) :: min_topoind !! The current minimum of topographic index (m) REAL(r_std) :: min_topoind !! The current minimum of topographic index (m)
INTEGER(i_std) :: nb_basin !! Number of sub-basins (unitless) INTEGER(i_std) :: nb_basin !! Number of sub-basins (unitless)
INTEGER(i_std), DIMENSION(nbvmax) :: basin_inbxid, basin_sz !! ID of basin, number of points in the basin INTEGER(i_std), DIMENSION(nbvmax) :: basin_inbxid, basin_sz !! ID of basin, number of points in the basin
REAL(r_std), DIMENSION(nbvmax,2) :: basin_outlet !! Outlet coordinate of each subgrid basin REAL(r_std), DIMENSION(nbvmax,2) :: basin_outlet !! Outlet coordinate of each subgrid basin (lat,lon)
REAL(r_std), DIMENSION(nbvmax) :: basin_outtp !! REAL(r_std), DIMENSION(nbvmax) :: basin_outtp !!
INTEGER(i_std), DIMENSION(nbvmax,nbvmax,2) :: basin_pts !! Points in each basin INTEGER(i_std), DIMENSION(nbvmax,nbvmax,2) :: basin_pts !! Points in each basin
INTEGER(i_std), DIMENSION(nbvmax) :: basin_bxout !! outflow direction INTEGER(i_std), DIMENSION(nbvmax) :: basin_bxout !! outflow direction
...@@ -1667,10 +1670,11 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc ...@@ -1667,10 +1670,11 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc
INTEGER(i_std), DIMENSION(nbpt) :: basin_count !! INTEGER(i_std), DIMENSION(nbpt) :: basin_count !!
INTEGER(i_std), DIMENSION(nbpt) :: basin_notrun !! INTEGER(i_std), DIMENSION(nbpt) :: basin_notrun !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_id !! INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_id !!
REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_coor !! REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_coor !! Coordinates of the outflow point
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_type !! REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_type !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_flowdir !! Water flow directions in the basin (unitless) 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_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_hierarchy !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_fac !! 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) REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m)
...@@ -1747,6 +1751,7 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc ...@@ -1747,6 +1751,7 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc
! Compute the area of the basin ! Compute the area of the basin
! !
basin_area(ib,ij) = zero basin_area(ib,ij) = zero
basin_cg(ib,ij,:) = zero
basin_hierarchy(ib,ij) = zero basin_hierarchy(ib,ij) = zero
basin_fac(ib,ij) = zero basin_fac(ib,ij) = zero
! !
...@@ -1762,6 +1767,11 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc ...@@ -1762,6 +1767,11 @@ SUBROUTINE routing_reg_globalize(nbpt, ib, neighbours, area_bx, trip_bx, hierarc
! !
basin_area(ib,ij) = basin_area(ib,ij) + area_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2)) basin_area(ib,ij) = basin_area(ib,ij) + area_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2))
! !
! Compute centre of gravity
!
basin_cg(ib,ij,1) = basin_cg(ib,ij,1) + lat_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2))/basin_sz(ij)
basin_cg(ib,ij,2) = basin_cg(ib,ij,2) + lon_bx(basin_pts(ij,iz,1),basin_pts(ij,iz,2))/basin_sz(ij)
!
! There are a number of ways to determine the hierarchy of the entire basin. ! There are a number of ways to determine the hierarchy of the entire basin.
! We allow for three here : ! We allow for three here :
! - Take the mean value ! - Take the mean value
...@@ -2847,9 +2857,9 @@ SUBROUTINE routing_reg_fetch(nbpt, gridarea, contfrac, nwbas, basin_count, basin ...@@ -2847,9 +2857,9 @@ SUBROUTINE routing_reg_fetch(nbpt, gridarea, contfrac, nwbas, basin_count, basin
!! \n !! \n
!_ ================================================================================================================================ !_ ================================================================================================================================
SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_count, basin_notrun, basin_area, basin_topoind,& SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_count, basin_notrun, basin_area, basin_cg, &
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & basin_topoind, fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, &
& inflow_grid, inflow_basin) & inflow_number, inflow_grid, inflow_basin)
! !
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -2872,6 +2882,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_ ...@@ -2872,6 +2882,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_type !! 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) 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_area !!
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) REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_topoind !! Topographic index of the residence time for a basin (m)
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !! REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !!
INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: outflow_grid !! Type of outflow on the grid box (unitless) INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: outflow_grid !! Type of outflow on the grid box (unitless)
...@@ -3137,7 +3148,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_ ...@@ -3137,7 +3148,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_
! Then we call routing_reg_killbas to clean up the basins in this grid ! Then we call routing_reg_killbas to clean up the basins in this grid
! !
IF ( kbas .GT. 0 .AND. sbas .GT. 0 ) THEN IF ( kbas .GT. 0 .AND. sbas .GT. 0 ) THEN
CALL routing_reg_killbas(nbpt, ib, kbas, sbas, nwbas, basin_count, basin_area, basin_topoind,& CALL routing_reg_killbas(nbpt, ib, kbas, sbas, nwbas, basin_count, basin_area, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin) & inflow_grid, inflow_basin)
ENDIF ENDIF
...@@ -3189,7 +3200,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_ ...@@ -3189,7 +3200,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_
! Then we call routing_reg_killbas to clean up the basins in this grid ! Then we call routing_reg_killbas to clean up the basins in this grid
! !
IF ( kbas .GT. 0 .AND. sbas .GT. 0 ) THEN IF ( kbas .GT. 0 .AND. sbas .GT. 0 ) THEN
CALL routing_reg_killbas(nbpt, ib, kbas, sbas, nwbas, basin_count, basin_area, basin_topoind,& CALL routing_reg_killbas(nbpt, ib, kbas, sbas, nwbas, basin_count, basin_area, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin) & inflow_grid, inflow_basin)
ENDIF ENDIF
...@@ -3248,7 +3259,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_ ...@@ -3248,7 +3259,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_
ENDIF ENDIF
! !
IF ( kbas .GT. 0 .AND. sbas .GT. 0 ) THEN IF ( kbas .GT. 0 .AND. sbas .GT. 0 ) THEN
CALL routing_reg_killbas(nbpt, ib, kbas, sbas, nwbas, basin_count, basin_area, basin_topoind,& CALL routing_reg_killbas(nbpt, ib, kbas, sbas, nwbas, basin_count, basin_area, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin) & inflow_grid, inflow_basin)
ENDIF ENDIF
...@@ -3282,6 +3293,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_ ...@@ -3282,6 +3293,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_
DO ij=1,basin_count(ib) DO ij=1,basin_count(ib)
! !
routing_area_glo(ib,ij) = basin_area(ib,ij) routing_area_glo(ib,ij) = basin_area(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)
global_basinid_glo(ib,ij) = basin_id(ib,ij) global_basinid_glo(ib,ij) = basin_id(ib,ij)
route_outlet_glo(ib,ij,1) = basin_coor(ib,ij,1) route_outlet_glo(ib,ij,1) = basin_coor(ib,ij,1)
...@@ -3441,7 +3453,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_ ...@@ -3441,7 +3453,7 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, basin_
!! \n !! \n
!_ ================================================================================================================================ !_ ================================================================================================================================
SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count, basin_area, basin_topoind,& SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count, basin_area, basin_cg, basin_topoind,&
& fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,& & fetch_basin, basin_id, basin_coor, basin_type, basin_flowdir, outflow_grid, outflow_basin, inflow_number,&
& inflow_grid, inflow_basin) & inflow_grid, inflow_basin)
! !
...@@ -3456,12 +3468,13 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count, ...@@ -3456,12 +3468,13 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count,
INTEGER(i_std) :: nwbas !! INTEGER(i_std) :: nwbas !!
INTEGER(i_std), DIMENSION(nbpt) :: basin_count !! INTEGER(i_std), DIMENSION(nbpt) :: basin_count !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_id !! INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_id !!
REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_coor !! REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_coor !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_type !! REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_type !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: basin_flowdir !! Water flow directions in the basin (unitless) 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_area !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m) REAL(r_std), DIMENSION(nbpt,nwbas,2) :: basin_cg !!
REAL(r_std), DIMENSION(nbpt,nwbas) :: fetch_basin !! REAL(r_std), DIMENSION(nbpt,nwbas) :: basin_topoind !! Topographic index of the residence time for a basin (m)
REAL(r_std), DIMENSION(nbpt,nwbas) :: fetch_basin !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: outflow_grid !! Type of outflow on the grid box (unitless) INTEGER(i_std), DIMENSION(nbpt,nwbas) :: outflow_grid !! Type of outflow on the grid box (unitless)
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: outflow_basin !! INTEGER(i_std), DIMENSION(nbpt,nwbas) :: outflow_basin !!
! !
...@@ -3482,6 +3495,10 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count, ...@@ -3482,6 +3495,10 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count,
! !
! !
basin_area(ib, totakeover) = basin_area(ib, totakeover) + basin_area(ib, tokill) basin_area(ib, totakeover) = basin_area(ib, totakeover) + basin_area(ib, tokill)
!
basin_cg(ib, totakeover, 1) = (basin_cg(ib, totakeover, 1) + basin_cg(ib, tokill, 1))/2.0
basin_cg(ib, totakeover, 2) = (basin_cg(ib, totakeover, 2) + basin_cg(ib, tokill, 2))/2.0
!
basin_topoind(ib, totakeover) = (basin_topoind(ib, totakeover) + basin_topoind(ib, tokill))/2.0 basin_topoind(ib, totakeover) = (basin_topoind(ib, totakeover) + basin_topoind(ib, tokill))/2.0
! !
! Add the fetch of the basin will kill to the one which gets the water ! Add the fetch of the basin will kill to the one which gets the water
...@@ -3563,6 +3580,8 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count, ...@@ -3563,6 +3580,8 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count,
basin_flowdir(ib, tokill:basin_count(ib)-1) = basin_flowdir(ib, tokill+1:basin_count(ib)) basin_flowdir(ib, tokill:basin_count(ib)-1) = basin_flowdir(ib, tokill+1:basin_count(ib))
basin_area(ib, tokill:basin_count(ib)-1) = basin_area(ib, tokill+1:basin_count(ib)) basin_area(ib, tokill:basin_count(ib)-1) = basin_area(ib, tokill+1:basin_count(ib))
basin_area(ib, basin_count(ib):nwbas) = zero basin_area(ib, basin_count(ib):nwbas) = zero
basin_cg(ib, tokill:basin_count(ib)-1,:) = basin_cg(ib, tokill+1:basin_count(ib),:)
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
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))
...@@ -3615,6 +3634,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count, ...@@ -3615,6 +3634,7 @@ SUBROUTINE routing_reg_killbas(nbpt, ib, tokill, totakeover, nwbas, basin_count,
nbasmax_save = nbasmax nbasmax_save = nbasmax
ALLOCATE (routing_area_glo(nbpt,nbasmax), stat=ier) ALLOCATE (routing_area_glo(nbpt,nbasmax), 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 (route_togrid_glo(nbpt,nbasmax), stat=ier) ALLOCATE (route_togrid_glo(nbpt,nbasmax), stat=ier)
ALLOCATE (route_tobasin_glo(nbpt,nbasmax), stat=ier) ALLOCATE (route_tobasin_glo(nbpt,nbasmax), stat=ier)
......
...@@ -60,6 +60,7 @@ def initatmgrid(nbpt, modelgrid) : ...@@ -60,6 +60,7 @@ def initatmgrid(nbpt, modelgrid) :
return return
# #
# #
#
class HydroOverlap : class HydroOverlap :
# #
def __init__(self, nbpt, nbvmax, sub_pts, sub_index_in, sub_area_in, sub_lon_in, sub_lat_in, modelgrid, hydrodata) : def __init__(self, nbpt, nbvmax, sub_pts, sub_index_in, sub_area_in, sub_lon_in, sub_lat_in, modelgrid, hydrodata) :
...@@ -110,11 +111,11 @@ class HydroOverlap : ...@@ -110,11 +111,11 @@ class HydroOverlap :
# Clean-up these arrays so that they are easy to use in Python. # Clean-up these arrays so that they are easy to use in Python.
self.lon_bx[self.lon_bx > 360.]=np.nan self.lon_bx[self.lon_bx > 360.]=np.nan
self.lat_bx[self.lat_bx > 90.]=np.nan self.lat_bx[self.lat_bx > 90.]=np.nan
# with open("Grids.txt", 'wb') as fp:
# pickle.dump(lon_bx, fp)
# pickle.dump(lat_bx, fp)
# #
return
#
#
#
class HydroSuper : class HydroSuper :
def __init__(self, nbvmax, hydrodata, hydrooverlap) : def __init__(self, nbvmax, hydrodata, hydrooverlap) :
# #
...@@ -128,14 +129,19 @@ class HydroSuper : ...@@ -128,14 +129,19 @@ class HydroSuper :
# #
# Call Globalize # Call Globalize
# #
self.basin_count, self.basin_notrun, self.basin_area, self.basin_hierarchy, self.basin_fac, self.basin_topoind, \ lon_bx_tmp = hydrooverlap.lon_bx
self.basin_id, self.basin_coor, self.basin_type, self.basin_flowdir, \ lon_bx_tmp[np.isnan(lon_bx_tmp)] = undef_int
lat_bx_tmp = hydrooverlap.lat_bx
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_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