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

Take care of the case when there are no stations to be stored in the graph file.

parent 8be1ae13
......@@ -176,7 +176,6 @@ class HydroGraph :
outnf.createDimension('bnd', nbcorners)
outnf.createDimension('inflow', self.max_inflow)
outnf.createDimension('stnperhtu', nlmax)
outnf.createDimension('locations', nblocated)
else :
outnf = None
#
......
......@@ -212,20 +212,21 @@ class Locations :
if part.rank == 0:
# Create new dimension
monmax = np.max(monnb)
moncoord = ('htumon',)
outnf.createDimension(moncoord[0], monmax)
infocoord = ('locinfo',)
outnf.createDimension(infocoord[0], 5)
# Create variable for the list of stations
locvar = outnf.createVariable(locname, vtyp, infocoord+loccoord)
locvar.title = loctitle
locvar.units = locunits
locvar.description = "ID, i-index, j-index, HTU-index, monitoring-index"
locvar[:,:] = locationlist
# Create variable for the indices of the HTU to monitor
monvar = outnf.createVariable(monname, vtyp, moncoord+spacecoord)
monvar.title = montitle
monvar.units= monunits
monvar[:,:,:] = htumon[0:monmax,:,:]
if monmax > 0 :
moncoord = ('htumon',)
outnf.createDimension(moncoord[0], monmax)
infocoord = ('locinfo',)
outnf.createDimension(infocoord[0], 5)
# Create variable for the list of stations
locvar = outnf.createVariable(locname, vtyp, infocoord+loccoord)
locvar.title = loctitle
locvar.units = locunits
locvar.description = "ID, i-index, j-index, HTU-index, monitoring-index"
locvar[:,:] = locationlist
# Create variable for the indices of the HTU to monitor
monvar = outnf.createVariable(monname, vtyp, moncoord+spacecoord)
monvar.title = montitle
monvar.units= monunits
monvar[:,:,:] = htumon[0:monmax,:,:]
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