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

Add the tuned time constats for MERIT. The other hydrofiles still need to be done.

parent ce3feb48
......@@ -211,6 +211,12 @@ class HydroGraph :
garea = part.gather(larea, default=NCFillValue)
if part.rank == 0:
#
if addname.lower() == "stream" :
usedtcst = tcst.stream_tcst
else :
usedtcst = tcst.fast_tcst
#
gvar[gvar >= NCFillValue] = np.nan
#
hist, bin_edges = np.histogram(gvar[~np.isnan(gvar)], bins=nbbins, range=(0,min(10000, np.nanmax(gvar))))
......@@ -231,20 +237,26 @@ class HydroGraph :
wtopohist.units = "counts"
wtopohist[:] = whist[:]
#
thist, tbin_edges = np.histogram(gvar[~np.isnan(gvar)]*tcst.stream_tcst, bins=nbbins, range=(0,RPP.OneDay/8))
thist, tbin_edges = np.histogram(gvar[~np.isnan(gvar)]*usedtcst, bins=nbbins, range=(0,RPP.OneDay/8))
tbins = outnf.createVariable("tstepbins"+addname, vtyp, ('nbbnds','nbbins'))
tbins.title = "Time bins"
tbins.units = "s"
tbins[0,:] = tbin_edges[:-1]
tbins[1,:] = tbin_edges[1:]
ncvar = outnf.createVariable("stabtstepcount"+addname, vtyp, ("nbbins",), fill_value=NCFillValue)
ncvar.title = "Stable timestep distribution"
if addname.lower() == "stream" :
ncvar.title = "Stable timestep distribution for stream reservoir"
else :
ncvar.title = "Stable timestep distribution for fast reservoir"
ncvar.units = "count"
ncvar[:] = thist[:]
#
maxtstep = weighted_quantile(gvar[~np.isnan(gvar)]*tcst.stream_tcst, 0.50, sample_weight=garea[~np.isnan(gvar)])
maxtstep = weighted_quantile(gvar[~np.isnan(gvar)]*usedtcst, 0.50, sample_weight=garea[~np.isnan(gvar)])
mtstep = outnf.createVariable("MaxTimeStep"+addname, vtyp, ('dimpara'), fill_value=NCFillValue)
mtstep.title = "The maximum time-step possible given the distribution of HTU properties"
if addname.lower() == "stream" :
mtstep.title = "Maximum time-step for the HTU's stream reservoir"
else :
mtstep.title = "Maximum time-step for the HTU's fast reservoir"
mtstep.units = "s"
mtstep[:] = maxtstep
return
......@@ -345,7 +357,7 @@ class HydroGraph :
self.add_variable(outnf, procgrid, NCFillValue, part, ('z','y','x'), \
"outlettype", "Type of outlet", "code", self.route_type[:,:], vtyp)
#
# topographic index
# topographic index for fast and slow reservoirs
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[:,:], \
......
......@@ -317,9 +317,9 @@ class HydroParameter :
self.swamp_cst = 0.2
elif hydrogrid.hd >= 0.016 :
# Case for MERIT
self.stream_tcst = 2.6
self.fast_tcst = 550.0
self.slow_tcst = 7500.0
self.stream_tcst = 6.3
self.fast_tcst = 25.0
self.slow_tcst = 400.0
self.flood_tcst = 345.6
self.swamp_cst = 0.2
elif hydrogrid.hd >= 0.008 :
......
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