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

Improve the estimation of the distribution of the stream_topoindex by removing...

Improve the estimation of the distribution of the stream_topoindex by removing the HTUs which are at the source of the stream and thus no water in the stream.
parent a020e207
......@@ -204,8 +204,15 @@ class HydroGraph :
#
#
#
def add_tstepdistrib(self, outnf, procgrid, NCFillValue, part, data, area, vtyp, nbbins, tcst, arrayorder = 'F', addname = "") :
var = procgrid.landscatter(data.astype(vtyp), order=arrayorder)
def add_tstepdistrib(self, outnf, procgrid, NCFillValue, part, topo, area, innum, vtyp, nbbins, tcst, arrayorder = 'F', addname = "") :
# In the stream case remove the source HTU without river.
if addname.lower() == "stream" :
data = np.copy(topo.astype(vtyp))
data[innum == 0] = NCFillValue
var = procgrid.landscatter(data, order=arrayorder)
else :
var = procgrid.landscatter(topo.astype(vtyp), order=arrayorder)
#
gvar = part.gather(var, default=NCFillValue)
larea = procgrid.landscatter(area.astype(vtyp), order=arrayorder)
garea = part.gather(larea, default=NCFillValue)
......@@ -361,14 +368,14 @@ class HydroGraph :
self.add_variable(outnf, procgrid, NCFillValue, part, ('z','y','x'), \
"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[:,:], \
vtyp, nbbins, tcst)
self.route_innum[:,:], 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, addname = "stream")
self.route_innum[:,:], vtyp, nbbins, tcst, addname = "stream")
#
# Geometric properties of HTU
......
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