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

Improved calculation and storage of the distribution of topoindex and minimal time-step.

parent 2da2d684
......@@ -172,15 +172,28 @@ class HydroGraph :
if part.rank == 0:
gvar[gvar >= NCFillValue] = np.nan
hist, bin_edges = np.histogram(gvar*tcst.stream_tcst, bins=nbbins, range=(0,RPP.OneDay/12))
ncbins = outnf.createVariable("timebin", vtyp, "nbbins")
ncbins.title = "Time bins"
ncbins.units = "s"
ncbins[:] = (bin_edges[0:-1]+bin_edges[1:])/2.0
ncvar = outnf.createVariable("stabtstep", vtyp, "nbbins", fill_value=NCFillValue)
#
hist, bin_edges = np.histogram(gvar, bins=nbbins, range=(0,max(10000, np.nanmax(gvar))))
topobins = outnf.createVariable("topobins", vtyp, ('nbbnds','nbbins'))
topobins.title = "Topographic index"
topobins.units = "km"
topobins[0,:] = bin_edges[:-1]
topobins[1,:] = bin_edges[1:]
topohist = outnf.createVariable("topocount", vtyp, ("nbbins",), fill_value=NCFillValue)
topohist.title = "Counts of HTU by topoindex"
topohist.units = "counts"
topohist[:] = hist[:]
#
thist, tbin_edges = np.histogram(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"
tbins[0,:] = tbin_edges[:-1]
tbins[1,:] = tbin_edges[1:]
ncvar = outnf.createVariable("stabtstepcount", vtyp, ("nbbins",), fill_value=NCFillValue)
ncvar.title = "Stable timestep distribution"
ncvar.units = "count"
ncvar[:] = hist[:]
ncvar[:] = thist[:]
return
#
#
......@@ -190,7 +203,7 @@ class HydroGraph :
vtyp=np.float64
cornerind=[0,2,4,6]
nbcorners = len(cornerind)
nbbins = 800
nbbins = 2000
#
nlmax, nblocated = locations.maxlocations(self.nbasmax, part)
#
......@@ -205,6 +218,7 @@ class HydroGraph :
outnf.createDimension('inflow', self.max_inflow)
outnf.createDimension('stnperhtu', nlmax)
outnf.createDimension('nbbins', nbbins)
outnf.createDimension('nbbnds',2)
outnf.createDimension('locations', nblocated)
else :
outnf = None
......
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