wolfhece 2.0.23__py3-none-any.whl → 2.0.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyCrosssections.py +3 -1
- wolfhece/PyDraw.py +47 -157
- wolfhece/PyGui.py +75 -73
- wolfhece/PyGuiHydrology.py +3 -2
- wolfhece/PyHydrographs.py +3 -2
- wolfhece/PyParams.py +12 -4
- wolfhece/PyVertex.py +12 -13
- wolfhece/RatingCurve.py +6 -2
- wolfhece/RatingCurve_xml.py +1 -1
- wolfhece/Results2DGPU.py +21 -66
- wolfhece/apps/__init__.py +1 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/drawing_obj.py +10 -1
- wolfhece/hydrology/Catchment.py +3 -4
- wolfhece/hydrology/Dumping.py +6 -5
- wolfhece/hydrology/Optimisation.py +76 -63
- wolfhece/hydrology/Outlet.py +16 -13
- wolfhece/hydrology/RetentionBasin.py +23 -23
- wolfhece/hydrology/SubBasin.py +8 -7
- wolfhece/lazviewer/points/expr.py +1 -1
- wolfhece/libs/WolfDll_debug.dll +0 -0
- wolfhece/mesh2d/config_manager.py +4 -3
- wolfhece/mesh2d/wolf2dprev.py +33 -24
- wolfhece/pybridges.py +2 -3
- wolfhece/scenario/config_manager.py +1 -1
- wolfhece/wolfresults_2D.py +164 -67
- {wolfhece-2.0.23.dist-info → wolfhece-2.0.25.dist-info}/METADATA +1 -1
- {wolfhece-2.0.23.dist-info → wolfhece-2.0.25.dist-info}/RECORD +31 -33
- wolfhece/lazviewer/vfuncs/__init__.py +0 -0
- wolfhece/lazviewer/vfuncs/vfuncs.cp310-win_amd64.pyd +0 -0
- wolfhece/lazviewer/vfuncs/vfuncs.cp39-win_amd64.pyd +0 -0
- {wolfhece-2.0.23.dist-info → wolfhece-2.0.25.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.23.dist-info → wolfhece-2.0.25.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.23.dist-info → wolfhece-2.0.25.dist-info}/top_level.txt +0 -0
wolfhece/Results2DGPU.py
CHANGED
@@ -18,7 +18,6 @@ try:
|
|
18
18
|
from wolfgpu.results_store import ResultsStore, ResultType
|
19
19
|
except :
|
20
20
|
logging.error(_("Unable to import wolfgpu.results_store.ResultsStore. Please install wolfgpu package or add a symlink to the wolfgpu package in the wolfhece directory"))
|
21
|
-
# raise ImportError(_("Unable to import wolfgpu.results_store.ResultsStore. Please install wolfgpu package or add a symlink to the wolfgpu package in the wolfhece directory"))
|
22
21
|
|
23
22
|
def _load_res(x) -> tuple[csr_array, csr_array, csr_array]:
|
24
23
|
store:ResultsStore
|
@@ -125,71 +124,6 @@ class Cache_Results2DGPU():
|
|
125
124
|
else:
|
126
125
|
return None
|
127
126
|
|
128
|
-
# def danger_map(self, start:int=0, end:int=-1, every:int=1) -> Union[WolfArray, tuple[WolfArray, WolfArray, WolfArray]]:
|
129
|
-
# """
|
130
|
-
# Create Danger Maps
|
131
|
-
|
132
|
-
# From start to end (index 0-based)
|
133
|
-
# Indexes are related to the self._results, not the absolute GPU results
|
134
|
-
# """
|
135
|
-
|
136
|
-
# # If __init__ with only_h==True, only wd is pre-loaded into memory
|
137
|
-
# # all_maps ==True is more than one Numpy array in self.results
|
138
|
-
# all_maps = not self.only_h
|
139
|
-
|
140
|
-
# # Number of time steps
|
141
|
-
# number_of_time_steps = len(self._results)
|
142
|
-
# if end ==-1:
|
143
|
-
# end = number_of_time_steps
|
144
|
-
|
145
|
-
# # Init Danger Maps based on results type
|
146
|
-
# # GPU --> 1 block, Numpy array
|
147
|
-
# danger_map_matrix_h = self.get_h(0, dense=True)
|
148
|
-
|
149
|
-
# # set zeros
|
150
|
-
# danger_map_matrix_h[:,:] = 0.
|
151
|
-
|
152
|
-
# if all_maps:
|
153
|
-
# danger_map_matrix_v = danger_map_matrix_h.copy()
|
154
|
-
# danger_map_matrix_mom = danger_map_matrix_h.copy()
|
155
|
-
# danger = [danger_map_matrix_h, danger_map_matrix_v, danger_map_matrix_mom]
|
156
|
-
|
157
|
-
# if all_maps:
|
158
|
-
|
159
|
-
# for time_step in tqdm(range(start, end, every)):
|
160
|
-
|
161
|
-
# wd = self.get_h(time_step, dense=True)
|
162
|
-
# qx = self.get_qx(time_step, dense=True)
|
163
|
-
# qy = self.get_qy(time_step, dense=True)
|
164
|
-
|
165
|
-
# v = np.zeros(wd.shape)
|
166
|
-
# mom = np.zeros(wd.shape)
|
167
|
-
|
168
|
-
# i,j = np.where(wd > 0.)
|
169
|
-
# v[i,j] = (qx[i,j]**2.+qy[i,j]**2.)**.5/wd[i,j]
|
170
|
-
|
171
|
-
# mom = v*wd
|
172
|
-
|
173
|
-
# comp = [wd, v, mom]
|
174
|
-
|
175
|
-
# # Comparison
|
176
|
-
# for curdanger, curcomp in zip(danger, comp):
|
177
|
-
# i,j = np.where(curdanger < curcomp)
|
178
|
-
# curdanger[i,j] = curcomp[i,j]
|
179
|
-
|
180
|
-
# else:
|
181
|
-
# for time_step in tqdm(range(start, end, every)):
|
182
|
-
|
183
|
-
# wd = self.get_h(time_step)
|
184
|
-
# i,j = np.where(danger_map_matrix_h < wd)
|
185
|
-
# danger_map_matrix_h[i,j] = wd[i,j]
|
186
|
-
|
187
|
-
|
188
|
-
# if all_maps:
|
189
|
-
# return (danger_map_matrix_h, danger_map_matrix_v, danger_map_matrix_mom)
|
190
|
-
# else:
|
191
|
-
# return danger_map_matrix_h
|
192
|
-
|
193
127
|
|
194
128
|
class wolfres2DGPU(Wolfresults_2D):
|
195
129
|
"""
|
@@ -442,3 +376,24 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
442
376
|
return self._cache.get_qy(idx+1, True).T
|
443
377
|
else:
|
444
378
|
return None
|
379
|
+
|
380
|
+
|
381
|
+
class Sim_2D_GPU():
|
382
|
+
""" Simulation 2D GPU -- Interface """
|
383
|
+
|
384
|
+
def __init__(self, fname:Union[str,Path] = '') -> None:
|
385
|
+
|
386
|
+
try:
|
387
|
+
from wolfgpu.simple_simulation import SimpleSimulation
|
388
|
+
except:
|
389
|
+
logging.error(_("Unable to import wolfgpu.simple_simulation.SimpleSimulation. Please install wolfgpu package or add a symlink to the wolfgpu package in the wolfhece directory"))
|
390
|
+
|
391
|
+
self.filename = Path(fname)
|
392
|
+
self.loaded = False
|
393
|
+
|
394
|
+
if self.filename.exists():
|
395
|
+
self.sim = SimpleSimulation()
|
396
|
+
self.sim.load(self.filename)
|
397
|
+
self.loaded = True
|
398
|
+
|
399
|
+
pass
|
wolfhece/apps/__init__.py
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
""" Ceci est une doc """
|
wolfhece/apps/version.py
CHANGED
wolfhece/drawing_obj.py
CHANGED
@@ -9,6 +9,15 @@ class Element_To_Draw:
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
def __init__(self, idx:str = '', plotted:bool = True, mapviewer = None, need_for_wx:bool = False) -> None:
|
12
|
+
"""
|
13
|
+
Constructor of the class
|
14
|
+
|
15
|
+
:param idx: identifier
|
16
|
+
:param plotted: boolean if plotting action must be processed
|
17
|
+
:param mapviewer: WolfMapViewer instance attached to the object
|
18
|
+
:param need_for_wx: test if wx App is running. If not, raise an error
|
19
|
+
|
20
|
+
"""
|
12
21
|
|
13
22
|
self.idx = idx # identifier
|
14
23
|
self.xmin=0. # spatial extension - lower left corner X
|
@@ -27,7 +36,7 @@ class Element_To_Draw:
|
|
27
36
|
if need_for_wx and (not self.wx_exists):
|
28
37
|
raise NameError(_('wx App is not running or you need it --> check your code and retry !'))
|
29
38
|
|
30
|
-
#FIXME : checked and plotted are the same thing ??
|
39
|
+
#FIXME : checked and plotted are the same thing ?? -- YES but conserve for retro-compatibility
|
31
40
|
@property
|
32
41
|
def checked(self) -> bool:
|
33
42
|
"""
|
wolfhece/hydrology/Catchment.py
CHANGED
@@ -1779,7 +1779,7 @@ class Catchment:
|
|
1779
1779
|
paramsInput = Wolf_Param(to_read=False,toShow=False)
|
1780
1780
|
paramsInput.ReadFile(fileToModif)
|
1781
1781
|
try:
|
1782
|
-
myInterval =
|
1782
|
+
myInterval = paramsInput.get_param("Distributed production model parameters", "Time span soil")
|
1783
1783
|
nbIntervals = math.floor(myInterval/myBasin.deltaT)
|
1784
1784
|
except:
|
1785
1785
|
nbIntervals = len(myBasin.myRain)-1
|
@@ -1847,12 +1847,11 @@ class Catchment:
|
|
1847
1847
|
if fileNameIn!="":
|
1848
1848
|
fileName = fileNameIn
|
1849
1849
|
else:
|
1850
|
-
directory = self.paramsInput.
|
1850
|
+
directory = self.paramsInput.get_param("Measuring stations SPW", "Directory")
|
1851
1851
|
isOk, directory = check_path(directory, self.workingDir)
|
1852
1852
|
if isOk<0:
|
1853
1853
|
print("ERROR : measuring station data path not present! ")
|
1854
|
-
fileName = directory
|
1855
|
-
fileName = os.path.join(directory, self.paramsInput.myparams["Measuring stations SPW"]["Filename"]["value"])
|
1854
|
+
fileName = os.path.join(directory, self.paramsInput.get_param("Measuring stations SPW", "Filename"))
|
1856
1855
|
|
1857
1856
|
|
1858
1857
|
if os.path.exists(fileName):
|
wolfhece/hydrology/Dumping.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import datetime # module which contains objects treating dates
|
2
|
+
from ..PyParams import key_Param
|
2
3
|
|
3
4
|
from ..PyTranslate import _
|
4
5
|
|
@@ -16,17 +17,17 @@ class Dumping:
|
|
16
17
|
self.flows = []
|
17
18
|
self.times = []
|
18
19
|
|
19
|
-
self.myType = self.myRbDict['type'][
|
20
|
+
self.myType = self.myRbDict['type'][key_Param.VALUE]
|
20
21
|
|
21
22
|
if("nb ecretages" in self.myRbDict):
|
22
|
-
self.nbFlows = int(self.myRbDict["nb ecretages"][
|
23
|
+
self.nbFlows = int(self.myRbDict["nb ecretages"][key_Param.VALUE])
|
23
24
|
|
24
25
|
for i in range(1,self.nbFlows+1):
|
25
|
-
self.flows.append(float(self.myRbDict['ecretage '+str(i)][
|
26
|
+
self.flows.append(float(self.myRbDict['ecretage '+str(i)][key_Param.VALUE]))
|
26
27
|
if(i==1):
|
27
28
|
self.times.append(-1.0)
|
28
29
|
else:
|
29
|
-
tmpDate = datetime.datetime.strptime(self.myRbDict['time ecr. '+str(i)][
|
30
|
+
tmpDate = datetime.datetime.strptime(self.myRbDict['time ecr. '+str(i)][key_Param.VALUE], "%d-%m-%Y %H:%M:%S").replace(tzinfo=datetime.timezone.utc)
|
30
31
|
tmpTime = datetime.datetime.timestamp(tmpDate)
|
31
32
|
self.times.append(tmpTime)
|
32
33
|
|
@@ -47,7 +48,7 @@ class Dumping:
|
|
47
48
|
|
48
49
|
|
49
50
|
def compute_constant(self):
|
50
|
-
qLim = float(self.myRbDict['ecretage'][
|
51
|
+
qLim = float(self.myRbDict['ecretage'][key_Param.VALUE])
|
51
52
|
return qLim
|
52
53
|
|
53
54
|
|
@@ -522,10 +522,12 @@ class Optimisation(wx.Frame):
|
|
522
522
|
# def init_2layers_linIF(self):
|
523
523
|
def init_lumped_model(self):
|
524
524
|
|
525
|
-
self.
|
525
|
+
curCase = self.myCases[0]
|
526
|
+
|
527
|
+
self.saParam.change_param("Initial parameters", "Read initial parameters?", 0)
|
526
528
|
|
527
529
|
# Retrieve the dictionnary with the properties of all models (parameters, files, etc)
|
528
|
-
myModel =
|
530
|
+
myModel = curCase.refCatchment.myModel
|
529
531
|
nbParams = cste.modelParamsDict[myModel]["Nb"]
|
530
532
|
myModelDict = cste.modelParamsDict[myModel]["Parameters"]
|
531
533
|
|
@@ -533,36 +535,40 @@ class Optimisation(wx.Frame):
|
|
533
535
|
i=1
|
534
536
|
for element in myModelDict:
|
535
537
|
paramName = prefix1 + str(i)
|
536
|
-
|
537
|
-
self.myCases[0].launcherParam.myparams[paramName]["type_of_data"] = {}
|
538
|
-
self.myCases[0].launcherParam.myparams[paramName]["type_of_data"]["value"] = element
|
538
|
+
curCase.launcherParam.add_param(groupname=paramName, name="type_of_data", value=element, type="int")
|
539
539
|
i+=1
|
540
540
|
|
541
|
-
|
541
|
+
curCase.launcherParam.change_param("Paramètres à varier","Nombre de paramètres à varier",nbParams)
|
542
542
|
self.nbParams = nbParams
|
543
543
|
|
544
544
|
prefix2 = "Parameter "
|
545
545
|
for i in range(1,self.nbParams+1):
|
546
546
|
paramName = prefix2 + str(i)
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
547
|
+
self.saParam.add_param(groupname="Lowest values", name=paramName, value=0.0)
|
548
|
+
# if not paramName in self.saParam.myparams["Lowest values"]:
|
549
|
+
# self.saParam.myparams["Lowest values"][paramName] = {}
|
550
|
+
# self.saParam.myparams["Lowest values"][paramName]["value"] = 0.0
|
551
|
+
self.saParam.add_param(groupname="Highest values", name=paramName, value=0.0)
|
552
|
+
# if not paramName in self.saParam.myparams["Highest values"]:
|
553
|
+
# self.saParam.myparams["Highest values"][paramName] = {}
|
554
|
+
# self.saParam.myparams["Highest values"][paramName]["value"] = 0.0
|
553
555
|
if not paramName in self.saParam.myparams["Steps"]:
|
554
556
|
self.saParam.myparams["Steps"][paramName] = {}
|
555
557
|
self.saParam.myparams["Steps"][paramName]["value"] = 0.0
|
556
|
-
|
557
|
-
|
558
|
-
|
558
|
+
self.saParam.add_param(groupname="Initial parameters", name=paramName, value=0.0)
|
559
|
+
# if not paramName in self.saParam.myparams["Initial parameters"]:
|
560
|
+
# self.saParam.myparams["Initial parameters"][paramName] = {}
|
561
|
+
# self.saParam.myparams["Initial parameters"][paramName]["value"] = 0.0
|
559
562
|
paramName = prefix1 + str(i)
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
self.myCases[0].launcherParam.myparams[paramName]["
|
564
|
-
self.myCases[0].launcherParam.myparams[paramName]["
|
565
|
-
self.myCases[0].launcherParam.myparams[paramName]["
|
563
|
+
curCase.launcherParam.add_param(groupname=paramName, name="geom_filename", value="my_geom.txt")
|
564
|
+
curCase.launcherParam.add_param(groupname=paramName, name="type_of_geom", value=0)
|
565
|
+
curCase.launcherParam.add_param(groupname=paramName, name="type_of_exchange", value=-3)
|
566
|
+
# self.myCases[0].launcherParam.myparams[paramName]["geom_filename"] = {}
|
567
|
+
# self.myCases[0].launcherParam.myparams[paramName]["geom_filename"]["value"] = "my_geom.txt"
|
568
|
+
# self.myCases[0].launcherParam.myparams[paramName]["type_of_geom"] = {}
|
569
|
+
# self.myCases[0].launcherParam.myparams[paramName]["type_of_geom"]["value"] = 0
|
570
|
+
# self.myCases[0].launcherParam.myparams[paramName]["type_of_exchange"] = {}
|
571
|
+
# self.myCases[0].launcherParam.myparams[paramName]["type_of_exchange"]["value"] = -3
|
566
572
|
|
567
573
|
|
568
574
|
def init_myParams(self, idLauncher=0):
|
@@ -636,6 +642,9 @@ class Optimisation(wx.Frame):
|
|
636
642
|
|
637
643
|
|
638
644
|
def init_with_reference(self, idLauncher=0):
|
645
|
+
|
646
|
+
curCase = self.myCases[idLauncher]
|
647
|
+
refCatch = curCase.refCatchment
|
639
648
|
|
640
649
|
# First path opened by the GUI selecting the the working directory
|
641
650
|
defaultPath = self.myCases[idLauncher].launcherParam.get_param("Calculs","Répertoire simulation de référence")
|
@@ -657,7 +666,7 @@ class Optimisation(wx.Frame):
|
|
657
666
|
|
658
667
|
# Recover the Catchment object
|
659
668
|
self.myCases[idLauncher].refCatchment = myPostPro.myCatchments["Catchment 1"]['Object']
|
660
|
-
|
669
|
+
curCase.launcherParam.change_param("Calculs", "Répertoire simulation de référence", refCatch.workingDir)
|
661
670
|
|
662
671
|
# Create an empty geom.txt file
|
663
672
|
geomName = self.myCases[idLauncher].launcherParam.get_param("Récupération des résultats","geom_filename")
|
@@ -668,10 +677,10 @@ class Optimisation(wx.Frame):
|
|
668
677
|
|
669
678
|
|
670
679
|
# Complete compare.how file
|
671
|
-
dateTmp =
|
672
|
-
self.comparHowParam.
|
673
|
-
dateTmp =
|
674
|
-
self.comparHowParam.
|
680
|
+
dateTmp = refCatch.paramsInput.get_param("Temporal Parameters","Start date time")
|
681
|
+
self.comparHowParam.change_param("Comparison 1","date begin 1",dateTmp)
|
682
|
+
dateTmp = refCatch.paramsInput.get_param("Temporal Parameters","End date time")
|
683
|
+
self.comparHowParam.change_param("Comparison 1","date end 1",dateTmp)
|
675
684
|
|
676
685
|
# update param files
|
677
686
|
self.myCases[idLauncher].launcherParam.SavetoFile(None)
|
@@ -716,36 +725,33 @@ class Optimisation(wx.Frame):
|
|
716
725
|
self.myCases[idLauncher].launcherParam.Reload(None)
|
717
726
|
|
718
727
|
# Init the outlet ID
|
719
|
-
|
720
|
-
|
721
|
-
stationOut = self.
|
722
|
-
|
723
|
-
shutil.copyfile(compareFileName, os.path.join(self.workingDir,"compare.txt"))
|
724
|
-
except:
|
725
|
-
# If only one station is specified, it could also be present in the compare.how file
|
726
|
-
try:
|
727
|
-
stationOut = self.comparHowParam.myparams["Comparison 1"]["station measures"]["value"]
|
728
|
-
except:
|
728
|
+
stationOut = self.optiParam.get_param("Semi-Distributed","Station measures 1")
|
729
|
+
if stationOut is None:
|
730
|
+
stationOut = self.comparHowParam.get_param("Comparison 1","station measures")
|
731
|
+
if stationOut is None:
|
729
732
|
stationOut = " "
|
733
|
+
else:
|
734
|
+
compareFileName = self.optiParam.get_param("Semi-Distributed","File reference 1")
|
735
|
+
shutil.copyfile(os.path.join(self.workingDir,compareFileName), os.path.join(self.workingDir,"compare.txt"))
|
730
736
|
self.myCases[idLauncher].refCatchment.define_station_out(stationOut)
|
731
737
|
|
732
738
|
|
733
739
|
def init_dir_in_params(self):
|
734
740
|
|
735
|
-
self.optiParam.
|
741
|
+
self.optiParam.change_param("Optimizer","dir", self.workingDir)
|
736
742
|
for i in range(len(self.myCases)):
|
737
|
-
self.optiParam.
|
738
|
-
self.optiParam.
|
743
|
+
self.optiParam.change_param("Cases","dir_"+str(i+1), os.path.join(self.workingDir,"simul_"+str(i+1)))
|
744
|
+
self.optiParam.change_param("Predefined parameters","fname", os.path.join(self.workingDir,"param.what"))
|
739
745
|
self.optiParam.SavetoFile(None)
|
740
746
|
self.optiParam.Reload(None)
|
741
747
|
|
742
748
|
|
743
749
|
def update_dir_in_params(self):
|
744
750
|
|
745
|
-
self.optiParam.
|
751
|
+
self.optiParam.change_param("Optimizer","dir", self.workingDir)
|
746
752
|
for i in range(len(self.myCases)):
|
747
|
-
self.optiParam.
|
748
|
-
self.optiParam.
|
753
|
+
self.optiParam.change_param("Cases","dir_"+str(i+1), self.myCases[i].launcherDir)
|
754
|
+
self.optiParam.change_param("Predefined parameters","fname", os.path.join(self.workingDir,"param.what"))
|
749
755
|
self.optiParam.SavetoFile(None)
|
750
756
|
self.optiParam.Reload(None)
|
751
757
|
|
@@ -757,7 +763,7 @@ class Optimisation(wx.Frame):
|
|
757
763
|
|
758
764
|
|
759
765
|
def update_parameters_launcher(self, idLauncher=0):
|
760
|
-
self.myCases[idLauncher].launcherParam.
|
766
|
+
self.myCases[idLauncher].launcherParam.change_param("Paramètres à varier","Nombre de paramètres à varier",self.nbParams)
|
761
767
|
|
762
768
|
|
763
769
|
def update_parameters_SA(self):
|
@@ -1232,8 +1238,8 @@ class Optimisation(wx.Frame):
|
|
1232
1238
|
previousLevel = 1
|
1233
1239
|
# Read all ref data
|
1234
1240
|
for iRef in range(1, nbRefs+1):
|
1235
|
-
stationOut = self.optiParam.
|
1236
|
-
compareFileName = self.optiParam.
|
1241
|
+
stationOut = self.optiParam.get_param("Semi-Distributed","Station measures "+str(iRef))
|
1242
|
+
compareFileName = self.optiParam.get_param("Semi-Distributed","File reference "+str(iRef))
|
1237
1243
|
readDict[stationOut] = compareFileName
|
1238
1244
|
self.compareFilesDict = readDict
|
1239
1245
|
# Get the initial number of intervals
|
@@ -1431,19 +1437,26 @@ class Optimisation(wx.Frame):
|
|
1431
1437
|
|
1432
1438
|
for i in range(nbInlets):
|
1433
1439
|
paramName = prefix1 + str(nbParamsModel+i+1)
|
1434
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]={}
|
1435
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_data"] = {}
|
1436
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_data"]["value"] = cste.exchange_parameters_py_timeDelay
|
1437
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_data"]["type"] = 'Integer'
|
1438
|
-
self.myCases[idLauncher].launcherParam.
|
1439
|
-
self.myCases[idLauncher].launcherParam.
|
1440
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["
|
1441
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["
|
1442
|
-
self.myCases[idLauncher].launcherParam.
|
1443
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["
|
1440
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]={}
|
1441
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_data"] = {}
|
1442
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_data"]["value"] = cste.exchange_parameters_py_timeDelay
|
1443
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_data"]["type"] = 'Integer'
|
1444
|
+
self.myCases[idLauncher].launcherParam.add_group(paramName)
|
1445
|
+
self.myCases[idLauncher].launcherParam.add_param(paramName, "type_of_data", cste.exchange_parameters_py_timeDelay, Type_Param.Integer)
|
1446
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["geom_filename"] = {}
|
1447
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["geom_filename"]["value"] = "my_geom.txt"
|
1448
|
+
self.myCases[idLauncher].launcherParam.add_param(paramName, "geom_filename", "my_geom.txt", Type_Param.File)
|
1449
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_geom"] = {}
|
1450
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_geom"]["value"] = 0
|
1451
|
+
self.myCases[idLauncher].launcherParam.add_param(paramName, "type_of_geom", 0, Type_Param.Integer)
|
1452
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_exchange"] = {}
|
1453
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["type_of_exchange"]["value"] = -3
|
1454
|
+
self.myCases[idLauncher].launcherParam.add_param(paramName, "type_of_exchange", -3, Type_Param.Integer)
|
1455
|
+
|
1444
1456
|
# Particularity of this Python parameter
|
1445
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["junction_name"] = {}
|
1446
|
-
self.myCases[idLauncher].launcherParam.myparams[paramName]["junction_name"]["value"] = inletsNames[i]
|
1457
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["junction_name"] = {}
|
1458
|
+
# self.myCases[idLauncher].launcherParam.myparams[paramName]["junction_name"]["value"] = inletsNames[i]
|
1459
|
+
self.myCases[idLauncher].launcherParam.add_param(paramName, "junction_name", inletsNames[i], Type_Param.String)
|
1447
1460
|
|
1448
1461
|
self.myParams[nbParamsModel+i+1] = {}
|
1449
1462
|
self.myParams[nbParamsModel+i+1]["type"] = self.myCases[idLauncher].launcherParam.get_param(paramName, "type_of_data")
|
@@ -1609,8 +1622,8 @@ class Optimisation(wx.Frame):
|
|
1609
1622
|
readDict = {}
|
1610
1623
|
# Read all ref data
|
1611
1624
|
for iRef in range(1, nbRefs+1):
|
1612
|
-
stationOut = self.optiParam.
|
1613
|
-
compareFileName = self.optiParam.
|
1625
|
+
stationOut = self.optiParam.get_param("Semi-Distributed","Station measures "+str(iRef))
|
1626
|
+
compareFileName = self.optiParam.get_param("Semi-Distributed","File reference "+str(iRef))
|
1614
1627
|
readDict[stationOut] = compareFileName
|
1615
1628
|
self.compareFilesDict = readDict
|
1616
1629
|
# Sort all the junctions by level
|
@@ -1672,8 +1685,8 @@ class Optimisation(wx.Frame):
|
|
1672
1685
|
readDict = {}
|
1673
1686
|
# Read all ref data
|
1674
1687
|
for iRef in range(1, nbRefs+1):
|
1675
|
-
stationOut = self.optiParam.
|
1676
|
-
compareFileName = self.optiParam.
|
1688
|
+
stationOut = self.optiParam.get_param("Semi-Distributed","Station measures "+str(iRef))
|
1689
|
+
compareFileName = self.optiParam.get_param("Semi-Distributed","File reference "+str(iRef))
|
1677
1690
|
readDict[stationOut] = compareFileName
|
1678
1691
|
self.compareFilesDict = readDict
|
1679
1692
|
# Sort all the junctions by level
|
@@ -1725,8 +1738,8 @@ class Optimisation(wx.Frame):
|
|
1725
1738
|
readDict = {}
|
1726
1739
|
# Read all ref data
|
1727
1740
|
for iRef in range(1, nbRefs+1):
|
1728
|
-
stationOut = self.optiParam.
|
1729
|
-
compareFileName = self.optiParam.
|
1741
|
+
stationOut = self.optiParam.get_param("Semi-Distributed","Station measures "+str(iRef))
|
1742
|
+
compareFileName = self.optiParam.get_param("Semi-Distributed","File reference "+str(iRef))
|
1730
1743
|
readDict[stationOut] = compareFileName
|
1731
1744
|
self.compareFilesDict = readDict
|
1732
1745
|
# Sort all the junctions by level
|
wolfhece/hydrology/Outlet.py
CHANGED
@@ -6,6 +6,8 @@ from scipy.interpolate import interp1d
|
|
6
6
|
import csv
|
7
7
|
import datetime # module which contains objects treating dates
|
8
8
|
|
9
|
+
from ..PyParams import key_Param
|
10
|
+
|
9
11
|
from .read import *
|
10
12
|
from ..PyTranslate import _
|
11
13
|
|
@@ -26,12 +28,12 @@ class Outlet:
|
|
26
28
|
self.times = []
|
27
29
|
self.time = time
|
28
30
|
|
29
|
-
self.myType = self.myRbDict['type'][
|
31
|
+
self.myType = self.myRbDict['type'][key_Param.VALUE]
|
30
32
|
self.myRef = []
|
31
33
|
self.myRefInterp = None
|
32
34
|
|
33
35
|
try:
|
34
|
-
fileRef = self.myRbDict["Reference fileName"][
|
36
|
+
fileRef = self.myRbDict["Reference fileName"][key_Param.VALUE]
|
35
37
|
isOk, fileRef = check_path(fileRef, self.fileNameRead, applyCWD=True)
|
36
38
|
if isOk<0:
|
37
39
|
print("ERROR : Problem in the Reference fileName!")
|
@@ -39,7 +41,8 @@ class Outlet:
|
|
39
41
|
except:
|
40
42
|
fileRef = ""
|
41
43
|
try:
|
42
|
-
tz = float(self.myRbDict["Time zone"][
|
44
|
+
tz = float(self.myRbDict["Time zone"][key_Param.VALUE])
|
45
|
+
tz = float(self.myRbDict["Time zone"][key_Param.VALUE])
|
43
46
|
except:
|
44
47
|
tz = 0.0
|
45
48
|
|
@@ -58,14 +61,14 @@ class Outlet:
|
|
58
61
|
|
59
62
|
|
60
63
|
if("nb flows" in self.myRbDict):
|
61
|
-
self.nbFlows = int(self.myRbDict["nb flows"][
|
64
|
+
self.nbFlows = int(self.myRbDict["nb flows"][key_Param.VALUE])
|
62
65
|
|
63
66
|
for i in range(1,self.nbFlows+1):
|
64
|
-
self.flows.append(float(self.myRbDict['flow '+str(i)][
|
67
|
+
self.flows.append(float(self.myRbDict['flow '+str(i)][key_Param.VALUE]))
|
65
68
|
if(i==1):
|
66
69
|
self.times.append(-1.0)
|
67
70
|
else:
|
68
|
-
tmpDate = datetime.datetime.strptime(self.myRbDict['time '+str(i)][
|
71
|
+
tmpDate = datetime.datetime.strptime(self.myRbDict['time '+str(i)][key_Param.VALUE], "%d-%m-%Y %H:%M:%S").replace(tzinfo=datetime.timezone.utc)
|
69
72
|
tmpTime = datetime.datetime.timestamp(tmpDate)
|
70
73
|
self.times.append(tmpTime)
|
71
74
|
|
@@ -90,11 +93,11 @@ class Outlet:
|
|
90
93
|
def compute_HighwayRB(self, h):
|
91
94
|
"This function compute the "
|
92
95
|
q = 0.0
|
93
|
-
h0 = float(self.myRbDict['stagnant height'][
|
94
|
-
h1 = float(self.myRbDict['height 1'][
|
95
|
-
h2 = float(self.myRbDict['height 2'][
|
96
|
-
q1 = float(self.myRbDict['flow 1'][
|
97
|
-
q2 = float(self.myRbDict['flow 2'][
|
96
|
+
h0 = float(self.myRbDict['stagnant height'][key_Param.VALUE])
|
97
|
+
h1 = float(self.myRbDict['height 1'][key_Param.VALUE])
|
98
|
+
h2 = float(self.myRbDict['height 2'][key_Param.VALUE])
|
99
|
+
q1 = float(self.myRbDict['flow 1'][key_Param.VALUE])
|
100
|
+
q2 = float(self.myRbDict['flow 2'][key_Param.VALUE])
|
98
101
|
|
99
102
|
if(h<=h1):
|
100
103
|
q = q1
|
@@ -103,11 +106,11 @@ class Outlet:
|
|
103
106
|
return q
|
104
107
|
|
105
108
|
def compute_RobiernuRB(self, h):
|
106
|
-
q = float(self.myRbDict['flow 1'][
|
109
|
+
q = float(self.myRbDict['flow 1'][key_Param.VALUE])
|
107
110
|
return q
|
108
111
|
|
109
112
|
def compute_OrbaisRB(self, h):
|
110
|
-
q = float(self.myRbDict['flow 1'][
|
113
|
+
q = float(self.myRbDict['flow 1'][key_Param.VALUE])
|
111
114
|
return q
|
112
115
|
|
113
116
|
|