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

Maximum time step is added to the routing graph file.

parent 8317c779
......@@ -173,7 +173,7 @@ class HydroGraph :
if part.rank == 0:
gvar[gvar >= NCFillValue] = np.nan
#
hist, bin_edges = np.histogram(gvar, bins=nbbins, range=(0,max(10000, np.nanmax(gvar))))
hist, bin_edges = np.histogram(gvar[~np.isnan(gvar)], bins=nbbins, range=(0,max(10000, np.nanmax(gvar))))
topobins = outnf.createVariable("topobins", vtyp, ('nbbnds','nbbins'))
topobins.title = "Topographic index"
topobins.units = "km"
......@@ -184,7 +184,7 @@ class HydroGraph :
topohist.units = "counts"
topohist[:] = hist[:]
#
thist, tbin_edges = np.histogram(gvar*tcst.stream_tcst, bins=nbbins, range=(0,RPP.OneDay/8))
thist, tbin_edges = np.histogram(gvar[~np.isnan(gvar)]*tcst.stream_tcst, bins=nbbins, range=(0,RPP.OneDay/8))
tbins = outnf.createVariable("tstepbins", vtyp, ('nbbnds','nbbins'))
tbins.title = "Time bins"
tbins.units = "s"
......@@ -194,6 +194,12 @@ class HydroGraph :
ncvar.title = "Stable timestep distribution"
ncvar.units = "count"
ncvar[:] = thist[:]
#
maxtstep = np.quantile(gvar[~np.isnan(gvar)], 0.1)
mtstep = outnf.createVariable("MaxTimeStep", vtyp, ('dimpara'), fill_value=NCFillValue)
mtstep.title = "The maximum time-step possible given the distribution of HTU properties"
mtstep.units = "s"
mtstep[:] = maxtstep
return
#
#
......
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