From ff23aa605ec8e5011620c74f3d92e616bcd9c3d8 Mon Sep 17 00:00:00 2001
From: POLCHER Jan <jan.polcher@lmd.jussieu.fr>
Date: Tue, 6 Oct 2020 17:36:09 +0200
Subject: [PATCH] Flinget in the model needs to have all the variables in REAL.
 So I needed to change the two new variables added.

---
 GraphHydro.py |  2 +-
 Locations.py  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/GraphHydro.py b/GraphHydro.py
index 644d04e..ff86ab8 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 bdd06d4..7d010e1 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,:,:]
-- 
GitLab