diff --git a/GraphHydro.py b/GraphHydro.py index 644d04ebeb106f2f5db3678dbbefc5861be09f36..ff86ab8e9009d8957990b4b772ac3d62de6a2918 100644 --- a/GraphHydro.py +++ b/GraphHydro.py @@ -259,7 +259,7 @@ class HydroGraph : # # Build and save a map of all the structures located on the graph # - locations.addtonetcdf(self.nbpt, self.nbasmax, outnf, procgrid, part, ('y','x'), ('locations',)) + locations.addtonetcdf(self.nbpt, self.nbasmax, outnf, procgrid, part, ('y','x'), ('locations',), vtyp) # # Close the file # diff --git a/Locations.py b/Locations.py index bdd06d410845a6702651ec443ba268a7fe095b26..7d010e1ebeb989cccfa233f9f1bb0b500652ec00 100644 --- a/Locations.py +++ b/Locations.py @@ -148,7 +148,7 @@ class Locations : # # Function to place all IDs of structures onto a map and remove duplicated locations # - def addtonetcdf(self, nbpt, nbasmax, outnf, procgrid, part, spacecoord, loccoord) : + def addtonetcdf(self, nbpt, nbasmax, outnf, procgrid, part, spacecoord, loccoord, vtyp) : # locname = "locations" loctitle = "Basic information of located stations or structures" @@ -157,9 +157,9 @@ class Locations : montitle = "Index of HTU to be monitored in the model" monunits = "-" # - locmap = np.zeros((nbpt,nbasmax,self.nlmax), dtype=np.float64, order='F') + locmap = np.zeros((nbpt,nbasmax,self.nlmax), dtype=vtyp, order='F') locmap[:,:,:] = np.nan - costmap = np.zeros((nbpt,nbasmax,self.nlmax), dtype=np.float64, order='F') + costmap = np.zeros((nbpt,nbasmax,self.nlmax), dtype=vtyp, order='F') costmap[:,:,:] = np.nan # for i,lid in enumerate(self.lid) : @@ -217,13 +217,13 @@ class Locations : infocoord = ('locinfo',) outnf.createDimension(infocoord[0], 5) # Create variable for the list of stations - locvar = outnf.createVariable(locname, 'i4', infocoord+loccoord) + 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, 'i4', moncoord+spacecoord) + monvar = outnf.createVariable(monname, vtyp, moncoord+spacecoord) monvar.title = montitle monvar.units= monunits monvar[:,:,:] = htumon[0:monmax,:,:]