wolfhece 1.8.12__py3-none-any.whl → 2.0.0__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/GraphNotebook.py +0 -1
- wolfhece/PyCrosssections.py +591 -5
- wolfhece/PyDraw.py +1151 -413
- wolfhece/PyGui.py +2 -4
- wolfhece/PyParams.py +1515 -852
- wolfhece/PyVertex.py +73 -73
- wolfhece/PyVertexvectors.py +226 -808
- wolfhece/RatingCurve.py +19 -6
- wolfhece/apps/wolf2D.py +11 -0
- wolfhece/apps/wolfcompare2Darrays.py +51 -22
- wolfhece/bernoulli/NetworkOpenGL.py +337 -341
- wolfhece/drawing_obj.py +25 -0
- wolfhece/hydrology/Catchment.py +77 -77
- wolfhece/hydrology/Optimisation.py +206 -53
- wolfhece/hydrology/PostProcessHydrology.py +22 -22
- wolfhece/hydrology/SubBasin.py +17 -17
- wolfhece/hydrology/constant.py +4 -0
- wolfhece/hydrology/cst_exchanges.py +2 -1
- wolfhece/lazviewer/processing/estimate_normals/estimate_normals.cp310-win_amd64.pyd +0 -0
- wolfhece/lazviewer/vfuncs/vfuncs.cp310-win_amd64.pyd +0 -0
- wolfhece/libs/WolfDll.dll +0 -0
- wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
- wolfhece/libs/wolfpy.cp310-win_amd64.pyd +0 -0
- wolfhece/mesh2d/wolf2dprev.py +4 -4
- wolfhece/multiprojects.py +13 -13
- wolfhece/pylogging.py +1 -1
- wolfhece/pyshields.py +213 -136
- wolfhece/pyviews.py +23 -23
- wolfhece/wolf_array.py +69 -152
- wolfhece/wolf_texture.py +39 -16
- wolfhece/wolfresults_2D.py +4 -4
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/METADATA +3 -2
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/RECORD +38 -34
- wolfhece/apps/wolfgpu.py +0 -19
- /wolfhece/lazviewer/processing/estimate_normals/{estimate_normals.pyd → estimate_normals.cp39-win_amd64.pyd} +0 -0
- /wolfhece/lazviewer/vfuncs/{vfuncs.pyd → vfuncs.cp39-win_amd64.pyd} +0 -0
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/LICENCE +0 -0
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/WHEEL +0 -0
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/top_level.txt +0 -0
wolfhece/drawing_obj.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from wx import App
|
2
|
+
import logging
|
2
3
|
|
3
4
|
from .PyTranslate import _
|
4
5
|
|
@@ -21,9 +22,26 @@ class Element_To_Draw:
|
|
21
22
|
self.mapviewer = mapviewer # WolfMapViewer instance attached to the object
|
22
23
|
self.wx_exists = App.Get() is not None # test if wx App is running
|
23
24
|
|
25
|
+
self._filename:str = ''
|
26
|
+
|
24
27
|
if need_for_wx and (not self.wx_exists):
|
25
28
|
raise NameError(_('wx App is not running or you need it --> check your code and retry !'))
|
26
29
|
|
30
|
+
#FIXME : checked and plotted are the same thing ??
|
31
|
+
@property
|
32
|
+
def checked(self) -> bool:
|
33
|
+
"""
|
34
|
+
Return the checked status.
|
35
|
+
"""
|
36
|
+
return self.plotted
|
37
|
+
|
38
|
+
@checked.setter
|
39
|
+
def checked(self, value:bool) -> None:
|
40
|
+
"""
|
41
|
+
Set the checked status.
|
42
|
+
"""
|
43
|
+
self.plotted = value
|
44
|
+
|
27
45
|
def get_mapviewer(self):
|
28
46
|
"""
|
29
47
|
Return the mapviewer
|
@@ -48,6 +66,13 @@ class Element_To_Draw:
|
|
48
66
|
"""
|
49
67
|
self.plotted = False
|
50
68
|
|
69
|
+
def show_properties(self):
|
70
|
+
"""
|
71
|
+
Generic function to show properties of the object
|
72
|
+
"""
|
73
|
+
logging.warning('No properties to show for this object !')
|
74
|
+
pass
|
75
|
+
|
51
76
|
def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
52
77
|
"""
|
53
78
|
Plot data in OpenGL context
|
wolfhece/hydrology/Catchment.py
CHANGED
@@ -176,9 +176,9 @@ class Catchment:
|
|
176
176
|
|
177
177
|
# Get the number of subbasins
|
178
178
|
try:
|
179
|
-
self.nbSubBasin = int(self.paramsInput.myparams['Semi distributed model']['How many?'][
|
179
|
+
self.nbSubBasin = int(self.paramsInput.myparams['Semi distributed model']['How many?'][key_Param.VALUE]) + 1 # +1 because the outlet is also counted
|
180
180
|
except:
|
181
|
-
self.nbSubBasin = int(self.paramsInput.myparams_default['Semi distributed model']['How many?'][
|
181
|
+
self.nbSubBasin = int(self.paramsInput.myparams_default['Semi distributed model']['How many?'][key_Param.VALUE]) + 1 # +1 because the outlet is also counted
|
182
182
|
|
183
183
|
# Fill the dictionary containing the id of the sorted subbasin returned by the Fortran code
|
184
184
|
self.init_dictIdConversion(self.workingDir)
|
@@ -199,7 +199,7 @@ class Catchment:
|
|
199
199
|
# TO DO: Check how the rain is read for the first time
|
200
200
|
|
201
201
|
# Get the hydrology model used (1-linear reservoir, 2-VHM, 3-Unit Hydrograph)
|
202
|
-
self.myModel = int(self.paramsInput.myparams['Model Type']['Type of hydrological model'][
|
202
|
+
self.myModel = int(self.paramsInput.myparams['Model Type']['Type of hydrological model'][key_Param.VALUE])
|
203
203
|
|
204
204
|
# Save the stations SPW characteristics in a dictionnary
|
205
205
|
self.read_measuring_stations_SPW()
|
@@ -333,8 +333,8 @@ class Catchment:
|
|
333
333
|
NB : If any change in the convention is mentionned in the comment following the dates the code will return an error
|
334
334
|
Otherwise, no procedure will warn the user that a converntion is modified.
|
335
335
|
"""
|
336
|
-
commentRead1 = self.paramsInput.myparams_default['Temporal Parameters']['Start date time'][
|
337
|
-
commentRead2 = self.paramsInput.myparams_default['Temporal Parameters']['End date time'][
|
336
|
+
commentRead1 = self.paramsInput.myparams_default['Temporal Parameters']['Start date time'][key_Param.COMMENT]
|
337
|
+
commentRead2 = self.paramsInput.myparams_default['Temporal Parameters']['End date time'][key_Param.COMMENT]
|
338
338
|
if (commentRead1.replace(' ', '') != 'Startdate[YYYYMMDD-HHMMSS]'):
|
339
339
|
print("ERROR: The convention in the start date is different from the one treated in this code. Please change it or modify the function get_time().")
|
340
340
|
sys.exit()
|
@@ -342,16 +342,16 @@ class Catchment:
|
|
342
342
|
print("ERROR:The convention in the end date is different from the one treated in this code. Please change it or modify the function get_time().")
|
343
343
|
sys.out()
|
344
344
|
try:
|
345
|
-
dateRead1 = self.paramsInput.myparams['Temporal Parameters']['Start date time'][
|
345
|
+
dateRead1 = self.paramsInput.myparams['Temporal Parameters']['Start date time'][key_Param.VALUE]
|
346
346
|
except:
|
347
|
-
dateRead1 = self.paramsInput.myparams_default['Temporal Parameters']['Start date time'][
|
347
|
+
dateRead1 = self.paramsInput.myparams_default['Temporal Parameters']['Start date time'][key_Param.VALUE]
|
348
348
|
|
349
349
|
try:
|
350
|
-
dateRead2 = self.paramsInput.myparams['Temporal Parameters']['End date time'][
|
350
|
+
dateRead2 = self.paramsInput.myparams['Temporal Parameters']['End date time'][key_Param.VALUE]
|
351
351
|
except:
|
352
|
-
dateRead2 = self.paramsInput.myparams_default['Temporal Parameters']['End date time'][
|
352
|
+
dateRead2 = self.paramsInput.myparams_default['Temporal Parameters']['End date time'][key_Param.VALUE]
|
353
353
|
tzDelta = datetime.timedelta(hours=self.tz)
|
354
|
-
self.deltaT = float(self.paramsInput.myparams['Temporal Parameters']['Time step'][
|
354
|
+
self.deltaT = float(self.paramsInput.myparams['Temporal Parameters']['Time step'][key_Param.VALUE])
|
355
355
|
self.dateBegin = datetime.datetime(year=int(dateRead1[0:4]), month=int(dateRead1[4:6]), day=int(dateRead1[6:8]), hour=int(dateRead1[9:11]), minute=int(dateRead1[11:13]), second=int(dateRead1[13:15]), microsecond=0, tzinfo=datetime.timezone.utc)
|
356
356
|
self.dateBegin -= tzDelta
|
357
357
|
self.dateEnd = datetime.datetime(year=int(dateRead2[0:4]), month=int(dateRead2[4:6]), day=int(dateRead2[6:8]), hour=int(dateRead2[9:11]), minute=int(dateRead2[11:13]), second=int(dateRead2[13:15]), microsecond=0, tzinfo=datetime.timezone.utc)
|
@@ -461,20 +461,20 @@ class Catchment:
|
|
461
461
|
for counter in range(1, self.nbSubBasin):
|
462
462
|
tmpNameParam = 'Interior point '+ str(counter)
|
463
463
|
if('X' in self.paramsInput.myparams[tmpNameParam] and 'Y' in self.paramsInput.myparams[tmpNameParam]):
|
464
|
-
x = float(self.paramsInput.myparams[tmpNameParam]['X'][
|
465
|
-
y = float(self.paramsInput.myparams[tmpNameParam]['Y'][
|
464
|
+
x = float(self.paramsInput.myparams[tmpNameParam]['X'][key_Param.VALUE])
|
465
|
+
y = float(self.paramsInput.myparams[tmpNameParam]['Y'][key_Param.VALUE])
|
466
466
|
elif("Station Code" in self.paramsInput.myparams[tmpNameParam]):
|
467
|
-
stationCode = self.paramsInput.myparams[tmpNameParam]["Station Code"][
|
467
|
+
stationCode = self.paramsInput.myparams[tmpNameParam]["Station Code"][key_Param.VALUE]
|
468
468
|
x = self.myStationsDict[int(stationCode)]["X"]
|
469
469
|
y = self.myStationsDict[int(stationCode)]["Y"]
|
470
470
|
elif("Station Name" in self.paramsInput.myparams[tmpNameParam]):
|
471
|
-
stationName = self.paramsInput.myparams[tmpNameParam]["Station Name"][
|
471
|
+
stationName = self.paramsInput.myparams[tmpNameParam]["Station Name"][key_Param.VALUE]
|
472
472
|
x = self.myStationsDict[stationName]["X"]
|
473
473
|
y = self.myStationsDict[stationName]["Y"]
|
474
474
|
else:
|
475
475
|
print("ERROR: Impossible to indentify the position of the interior points! Please check your param file!")
|
476
476
|
sys.exit()
|
477
|
-
|
477
|
+
|
478
478
|
mysubxy=wolfvertex(x,y)
|
479
479
|
self.iP_Cloud.add_vertex(mysubxy)
|
480
480
|
|
@@ -491,21 +491,21 @@ class Catchment:
|
|
491
491
|
counter += 1
|
492
492
|
tmpNameParam = 'Outlet Coordinates'
|
493
493
|
if('X' in self.paramsInput.myparams[tmpNameParam] and 'Y' in self.paramsInput.myparams[tmpNameParam]):
|
494
|
-
x = float(self.paramsInput.myparams[tmpNameParam]['X'][
|
495
|
-
y = float(self.paramsInput.myparams[tmpNameParam]['Y'][
|
494
|
+
x = float(self.paramsInput.myparams[tmpNameParam]['X'][key_Param.VALUE])
|
495
|
+
y = float(self.paramsInput.myparams[tmpNameParam]['Y'][key_Param.VALUE])
|
496
496
|
elif("Station Code" in self.paramsInput.myparams[tmpNameParam]):
|
497
|
-
stationCode = self.paramsInput.myparams[tmpNameParam]["Station Code"][
|
497
|
+
stationCode = self.paramsInput.myparams[tmpNameParam]["Station Code"][key_Param.VALUE]
|
498
498
|
x = self.myStationsDict[int(stationCode)]["X"]
|
499
499
|
y = self.myStationsDict[int(stationCode)]["Y"]
|
500
500
|
elif("Station Name" in self.paramsInput.myparams[tmpNameParam]):
|
501
|
-
stationName = self.paramsInput.myparams[tmpNameParam]["Station Name"][
|
501
|
+
stationName = self.paramsInput.myparams[tmpNameParam]["Station Name"][key_Param.VALUE]
|
502
502
|
x = self.myStationsDict[stationName]["X"]
|
503
503
|
y = self.myStationsDict[stationName]["Y"]
|
504
504
|
else:
|
505
505
|
print("ERROR: Impossible to indentify the position of the interior points! Please check your param file!")
|
506
506
|
sys.exit()
|
507
|
-
# x = float(self.paramsInput.myparams[tmpNameParam]['X'][
|
508
|
-
# y = float(self.paramsInput.myparams[tmpNameParam]['Y'][
|
507
|
+
# x = float(self.paramsInput.myparams[tmpNameParam]['X'][key_Param.VALUE])
|
508
|
+
# y = float(self.paramsInput.myparams[tmpNameParam]['Y'][key_Param.VALUE])
|
509
509
|
idSorted = self.catchmentDict['dictIdConversion'][counter]
|
510
510
|
cur_outlet:wolfvertex = self.subBasinCloud.myvertices[idSorted-1]["vertex"]
|
511
511
|
# self.subBasinDict[counter] = SubBasin(counter, self.time, self.workingDir, self.hyeto, x, y, idSorted)
|
@@ -523,10 +523,10 @@ class Catchment:
|
|
523
523
|
# Creates RB and checking if the topo file contains only these types of junction
|
524
524
|
for element in self.paramsTopology.myparams:
|
525
525
|
# If Subbasin:
|
526
|
-
if(self.paramsTopology.myparams[element]['type'][
|
527
|
-
idBasin = int(self.paramsTopology.myparams[element]['number'][
|
528
|
-
nameBasin = self.paramsTopology.myparams[element]['name'][
|
529
|
-
inletsString = self.paramsTopology.myparams[element]['inlets'][
|
526
|
+
if(self.paramsTopology.myparams[element]['type'][key_Param.VALUE] == 'Subbasin'):
|
527
|
+
idBasin = int(self.paramsTopology.myparams[element]['number'][key_Param.VALUE].replace('ss', ''))
|
528
|
+
nameBasin = self.paramsTopology.myparams[element]['name'][key_Param.VALUE]
|
529
|
+
inletsString = self.paramsTopology.myparams[element]['inlets'][key_Param.VALUE].strip()
|
530
530
|
# Save the name of the basin
|
531
531
|
self.subBasinDict[idBasin].add_name(nameBasin)
|
532
532
|
# Check if the subbasin have inlets or not => if not can be on the first layer of the topology tree.
|
@@ -537,28 +537,28 @@ class Catchment:
|
|
537
537
|
# Save the element of the subbasin dictionnary also in the global Cachment dictionnary with 'ss' prefix
|
538
538
|
# -> First free the object aleady created with the 'ss' prefix
|
539
539
|
# Therefore a subbasin with several inputs can be called in the Catchment dictionnary with prefix 'J' or 'ss' or the name of the station
|
540
|
-
self.catchmentDict[self.paramsTopology.myparams[element]['number'][
|
541
|
-
self.catchmentDict[self.paramsTopology.myparams[element]['number'][
|
542
|
-
self.junctionNamesDict[self.paramsTopology.myparams[element]['name'][
|
540
|
+
self.catchmentDict[self.paramsTopology.myparams[element]['number'][key_Param.VALUE]] = None
|
541
|
+
self.catchmentDict[self.paramsTopology.myparams[element]['number'][key_Param.VALUE]] = self.subBasinDict[idBasin]
|
542
|
+
self.junctionNamesDict[self.paramsTopology.myparams[element]['name'][key_Param.VALUE]] = element
|
543
543
|
# If RB:
|
544
|
-
elif(self.paramsTopology.myparams[element]['type'][
|
544
|
+
elif(self.paramsTopology.myparams[element]['type'][key_Param.VALUE] == 'RB'):
|
545
545
|
idBasin = element
|
546
546
|
# Save the name of the RB
|
547
|
-
nameBasin = self.paramsTopology.myparams[element]['name'][
|
547
|
+
nameBasin = self.paramsTopology.myparams[element]['name'][key_Param.VALUE]
|
548
548
|
# Create the RB object
|
549
|
-
typeOfRB = self.paramsTopology.myparams[element]['type of RB'][
|
549
|
+
typeOfRB = self.paramsTopology.myparams[element]['type of RB'][key_Param.VALUE]
|
550
550
|
# Outlet names if present
|
551
551
|
myOutletsNames = []
|
552
|
-
self.junctionNamesDict[self.paramsTopology.myparams[element]['name'][
|
552
|
+
self.junctionNamesDict[self.paramsTopology.myparams[element]['name'][key_Param.VALUE]] = element
|
553
553
|
try:
|
554
|
-
nbOutlets = int(self.paramsTopology.myparams[element]['nb outlets'][
|
554
|
+
nbOutlets = int(self.paramsTopology.myparams[element]['nb outlets'][key_Param.VALUE])
|
555
555
|
except:
|
556
556
|
nbOutlets = 0
|
557
557
|
myOutletsNames.append(element)
|
558
558
|
|
559
559
|
for iOutlet in range(nbOutlets):
|
560
|
-
myOutletsNames.append(self.paramsTopology.myparams[element]["outlet "+str(iOutlet+1)][
|
561
|
-
self.junctionNamesDict[self.paramsTopology.myparams[element]["outlet "+str(iOutlet+1)][
|
560
|
+
myOutletsNames.append(self.paramsTopology.myparams[element]["outlet "+str(iOutlet+1)][key_Param.VALUE])
|
561
|
+
self.junctionNamesDict[self.paramsTopology.myparams[element]["outlet "+str(iOutlet+1)][key_Param.VALUE]] = element
|
562
562
|
|
563
563
|
self.retentionBasinDict[element] = RetentionBasin(self.dateBegin, self.dateEnd, self.deltaT, self.time, idBasin, nameBasin, typeOfRB, self.paramsRB.myparams, _tz=self.tz, _outletNames=myOutletsNames, _workingDir=self.workingDir)
|
564
564
|
# Save the RB in the RB dictionnary into the global Catchment dictionnary
|
@@ -589,11 +589,11 @@ class Catchment:
|
|
589
589
|
|
590
590
|
|
591
591
|
for element in self.paramsTopology.myparams:
|
592
|
-
if(self.paramsTopology.myparams[element]['type'][
|
592
|
+
if(self.paramsTopology.myparams[element]['type'][key_Param.VALUE] == 'RB'):
|
593
593
|
# Case 1) inlets
|
594
594
|
if('inlets' in self.paramsTopology.myparams[element]):
|
595
595
|
# Split the string at each ',' in several smaller strings
|
596
|
-
tmpString = self.paramsTopology.myparams[element]['inlets'][
|
596
|
+
tmpString = self.paramsTopology.myparams[element]['inlets'][key_Param.VALUE].split(',')
|
597
597
|
# Loop on the strings representing the inlets
|
598
598
|
for i in range(len(tmpString)):
|
599
599
|
# Remove leading and trailing white spaces
|
@@ -626,9 +626,9 @@ class Catchment:
|
|
626
626
|
# This variable count the number of iteration to see if all are used.
|
627
627
|
nbInter += 1
|
628
628
|
# if the inlet is a subbasin:
|
629
|
-
if(self.paramsTopology.myparams[tmpString[i]]['type'][
|
629
|
+
if(self.paramsTopology.myparams[tmpString[i]]['type'][key_Param.VALUE] == 'Subbasin'):
|
630
630
|
nbSub += 1
|
631
|
-
iDSub = int(self.paramsTopology.myparams[tmpString[i]]['number'][
|
631
|
+
iDSub = int(self.paramsTopology.myparams[tmpString[i]]['number'][key_Param.VALUE].replace('ss', ''))
|
632
632
|
# A same subbasin cannot be used twice
|
633
633
|
if(self.subBasinDict[iDSub].alreadyUsed):
|
634
634
|
print("ERROR: a subbasin has already been used. Please check the topology file!")
|
@@ -643,7 +643,7 @@ class Catchment:
|
|
643
643
|
else:
|
644
644
|
self.subBasinDict[iDSub].increment_level()
|
645
645
|
# if the inlet is a RB:
|
646
|
-
elif(self.paramsTopology.myparams[tmpString[i]]['type'][
|
646
|
+
elif(self.paramsTopology.myparams[tmpString[i]]['type'][key_Param.VALUE] == 'RB'):
|
647
647
|
# A RB can be used used twice
|
648
648
|
if(self.retentionBasinDict[tmpString[i]].alreadyUsed):
|
649
649
|
# print("ERROR: this RB was already used! Please check the topo file.")
|
@@ -660,9 +660,9 @@ class Catchment:
|
|
660
660
|
# This variable count the number of iteration to see if all are used.
|
661
661
|
nbInter += 1
|
662
662
|
# if the inlet is a subbasin:
|
663
|
-
if(self.paramsTopology.myparams[junctionName]['type'][
|
663
|
+
if(self.paramsTopology.myparams[junctionName]['type'][key_Param.VALUE] == 'Subbasin'):
|
664
664
|
nbSub += 1
|
665
|
-
iDSub = int(self.paramsTopology.myparams[junctionName]['number'][
|
665
|
+
iDSub = int(self.paramsTopology.myparams[junctionName]['number'][key_Param.VALUE].replace('ss', ''))
|
666
666
|
# A same subbasin cannot be used twice
|
667
667
|
if(self.subBasinDict[iDSub].alreadyUsed):
|
668
668
|
print("ERROR: a subbasin has already been used. Please check the topology file!")
|
@@ -677,22 +677,22 @@ class Catchment:
|
|
677
677
|
else:
|
678
678
|
self.subBasinDict[iDSub].increment_level()
|
679
679
|
# if the inlet is a RB:
|
680
|
-
elif(self.paramsTopology.myparams[junctionName]['type'][
|
680
|
+
elif(self.paramsTopology.myparams[junctionName]['type'][key_Param.VALUE] == 'RB'):
|
681
681
|
# Check delta time applied to all exits
|
682
682
|
tmpNbOutlets = 1
|
683
683
|
deltaTime = 0.0
|
684
684
|
if('nb outlets' in self.paramsTopology.myparams[junctionName]):
|
685
|
-
tmpNbOutlets = int(self.paramsTopology.myparams[junctionName]['nb outlets'][
|
685
|
+
tmpNbOutlets = int(self.paramsTopology.myparams[junctionName]['nb outlets'][key_Param.VALUE])
|
686
686
|
if(tmpNbOutlets>1):
|
687
687
|
for iOutlets in range(tmpNbOutlets):
|
688
|
-
if(self.paramsTopology.myparams[junctionName]['outlet '+str(iOutlets+1)][
|
688
|
+
if(self.paramsTopology.myparams[junctionName]['outlet '+str(iOutlets+1)][key_Param.VALUE]==tmpString[i]):
|
689
689
|
try:
|
690
|
-
deltaTime = float(self.paramsTopology.myparams[junctionName]['delta time '+str(iOutlets+1)][
|
690
|
+
deltaTime = float(self.paramsTopology.myparams[junctionName]['delta time '+str(iOutlets+1)][key_Param.VALUE])
|
691
691
|
except:
|
692
692
|
deltaTime = 0.0
|
693
693
|
|
694
694
|
elif('delta time 1' in self.paramsTopology.myparams[junctionName]):
|
695
|
-
deltaTime = float(self.paramsTopology.myparams[junctionName]['delta time 1'][
|
695
|
+
deltaTime = float(self.paramsTopology.myparams[junctionName]['delta time 1'][key_Param.VALUE])
|
696
696
|
|
697
697
|
# A RB can be used used twice
|
698
698
|
if(self.retentionBasinDict[junctionName].alreadyUsed):
|
@@ -709,7 +709,7 @@ class Catchment:
|
|
709
709
|
sys.exit()
|
710
710
|
# Case 2 : same procedure but for the flux entering the directly in RB
|
711
711
|
if('direct inside RB' in self.paramsTopology.myparams[element]):
|
712
|
-
tmpString = self.paramsTopology.myparams[element]['direct inside RB'][
|
712
|
+
tmpString = self.paramsTopology.myparams[element]['direct inside RB'][key_Param.VALUE].split(',')
|
713
713
|
for i in range(len(tmpString)):
|
714
714
|
tmpString[i]= tmpString[i].strip()
|
715
715
|
# Save the dowstream link of each element in the dictionnary
|
@@ -730,9 +730,9 @@ class Catchment:
|
|
730
730
|
self.subBasinDict[iDSub].increment_level()
|
731
731
|
elif(tmpString[i][0] == 'J' and (tmpString[i] in self.paramsTopology.myparams)):
|
732
732
|
nbInter += 1
|
733
|
-
if(self.paramsTopology.myparams[tmpString[i]]['type'][
|
733
|
+
if(self.paramsTopology.myparams[tmpString[i]]['type'][key_Param.VALUE] == 'Subbasin'):
|
734
734
|
nbSub += 1
|
735
|
-
iDSub = int(self.paramsTopology.myparams[tmpString[i]]['number'][
|
735
|
+
iDSub = int(self.paramsTopology.myparams[tmpString[i]]['number'][key_Param.VALUE].replace('ss', ''))
|
736
736
|
if(self.subBasinDict[iDSub].alreadyUsed):
|
737
737
|
print("ERROR: a subbasin has already been used. Please check the topology file!")
|
738
738
|
sys.exit()
|
@@ -744,7 +744,7 @@ class Catchment:
|
|
744
744
|
else:
|
745
745
|
self.subBasinDict[iDSub].increment_level()
|
746
746
|
|
747
|
-
elif(self.paramsTopology.myparams[tmpString[i]]['type'][
|
747
|
+
elif(self.paramsTopology.myparams[tmpString[i]]['type'][key_Param.VALUE] == 'RB'):
|
748
748
|
if(self.retentionBasinDict[tmpString[i]].alreadyUsed):
|
749
749
|
# print("ERROR: a RB has aleady been used! Please check your topo file.")
|
750
750
|
# sys.exit()
|
@@ -760,9 +760,9 @@ class Catchment:
|
|
760
760
|
junctionName = self.junctionNamesDict[tmpString[i]]
|
761
761
|
|
762
762
|
nbInter += 1
|
763
|
-
if(self.paramsTopology.myparams[junctionName]['type'][
|
763
|
+
if(self.paramsTopology.myparams[junctionName]['type'][key_Param.VALUE] == 'Subbasin'):
|
764
764
|
nbSub += 1
|
765
|
-
iDSub = int(self.paramsTopology.myparams[junctionName]['number'][
|
765
|
+
iDSub = int(self.paramsTopology.myparams[junctionName]['number'][key_Param.VALUE].replace('ss', ''))
|
766
766
|
if(self.subBasinDict[iDSub].alreadyUsed):
|
767
767
|
print("ERROR: a subbasin has already been used. Please check the topology file!")
|
768
768
|
sys.exit()
|
@@ -774,7 +774,7 @@ class Catchment:
|
|
774
774
|
else:
|
775
775
|
self.subBasinDict[iDSub].increment_level()
|
776
776
|
|
777
|
-
elif(self.paramsTopology.myparams[junctionName]['type'][
|
777
|
+
elif(self.paramsTopology.myparams[junctionName]['type'][key_Param.VALUE] == 'RB'):
|
778
778
|
if(self.retentionBasinDict[junctionName].alreadyUsed):
|
779
779
|
# print("ERROR: a RB has aleady been used! Please check your topo file.")
|
780
780
|
# sys.exit()
|
@@ -787,9 +787,9 @@ class Catchment:
|
|
787
787
|
sys.exit()
|
788
788
|
# If the intersection is a subbasin, same procedure as for the RB, exept that no direct flux
|
789
789
|
# are considered anymore.
|
790
|
-
elif(self.paramsTopology.myparams[element]['type'][
|
791
|
-
elementId = int(self.paramsTopology.myparams[element]['number'][
|
792
|
-
tmpString = self.paramsTopology.myparams[element]['inlets'][
|
790
|
+
elif(self.paramsTopology.myparams[element]['type'][key_Param.VALUE] == 'Subbasin'):
|
791
|
+
elementId = int(self.paramsTopology.myparams[element]['number'][key_Param.VALUE].replace('ss', ''))
|
792
|
+
tmpString = self.paramsTopology.myparams[element]['inlets'][key_Param.VALUE].split(',')
|
793
793
|
# If there are no inlet labelled by "--", add it on the first level
|
794
794
|
if(len(tmpString)==1 and tmpString[0].strip()=='--'):
|
795
795
|
# self.topologyDict['Level 1'][element] = self.subBasinDict[elementId]
|
@@ -814,9 +814,9 @@ class Catchment:
|
|
814
814
|
self.subBasinDict[iDSub].increment_level()
|
815
815
|
elif tmpString[i][0] == 'J' and (tmpString[i] in self.paramsTopology.myparams):
|
816
816
|
nbInter += 1
|
817
|
-
if(self.paramsTopology.myparams[tmpString[i]]['type'][
|
817
|
+
if(self.paramsTopology.myparams[tmpString[i]]['type'][key_Param.VALUE] == 'Subbasin'):
|
818
818
|
nbSub += 1
|
819
|
-
iDSub = int(self.paramsTopology.myparams[tmpString[i]]['number'][
|
819
|
+
iDSub = int(self.paramsTopology.myparams[tmpString[i]]['number'][key_Param.VALUE].replace('ss', ''))
|
820
820
|
if(self.subBasinDict[iDSub].alreadyUsed):
|
821
821
|
print("ERROR: a subbasin has already been used. Please check the topology file!")
|
822
822
|
sys.exit()
|
@@ -827,7 +827,7 @@ class Catchment:
|
|
827
827
|
self.topologyDict['Level 1'][tmpString[i]] = self.subBasinDict[iDSub]
|
828
828
|
elif(self.subBasinDict[iDSub].myLevel == 1):
|
829
829
|
self.subBasinDict[iDSub].increment_level()
|
830
|
-
elif(self.paramsTopology.myparams[tmpString[i]]['type'][
|
830
|
+
elif(self.paramsTopology.myparams[tmpString[i]]['type'][key_Param.VALUE] == 'RB'):
|
831
831
|
if(self.retentionBasinDict[tmpString[i]].alreadyUsed):
|
832
832
|
print("ERROR: a RB has already been used! Please check your topo file.")
|
833
833
|
sys.exit()
|
@@ -841,9 +841,9 @@ class Catchment:
|
|
841
841
|
junctionName = self.junctionNamesDict[tmpString[i]]
|
842
842
|
|
843
843
|
nbInter += 1
|
844
|
-
if(self.paramsTopology.myparams[junctionName]['type'][
|
844
|
+
if(self.paramsTopology.myparams[junctionName]['type'][key_Param.VALUE] == 'Subbasin'):
|
845
845
|
nbSub += 1
|
846
|
-
iDSub = int(self.paramsTopology.myparams[junctionName]['number'][
|
846
|
+
iDSub = int(self.paramsTopology.myparams[junctionName]['number'][key_Param.VALUE].replace('ss', ''))
|
847
847
|
if(self.subBasinDict[iDSub].alreadyUsed):
|
848
848
|
print("ERROR: a subbasin has already been used. Please check the topology file!")
|
849
849
|
sys.exit()
|
@@ -854,7 +854,7 @@ class Catchment:
|
|
854
854
|
self.topologyDict['Level 1'][junctionName] = self.subBasinDict[iDSub]
|
855
855
|
elif(self.subBasinDict[iDSub].myLevel == 1):
|
856
856
|
self.subBasinDict[iDSub].increment_level()
|
857
|
-
elif(self.paramsTopology.myparams[junctionName]['type'][
|
857
|
+
elif(self.paramsTopology.myparams[junctionName]['type'][key_Param.VALUE] == 'RB'):
|
858
858
|
if(self.retentionBasinDict[junctionName].alreadyUsed):
|
859
859
|
print("ERROR: a RB has already been used! Please check your topo file.")
|
860
860
|
sys.exit()
|
@@ -1361,7 +1361,7 @@ class Catchment:
|
|
1361
1361
|
excelData[0].append(self.topologyDict[level][curBasin].x)
|
1362
1362
|
excelData[1].append(self.topologyDict[level][curBasin].y)
|
1363
1363
|
for curChar in self.topologyDict[level][curBasin].mainCharactDict:
|
1364
|
-
excelData[iChar].append(self.topologyDict[level][curBasin].mainCharactDict[curChar][
|
1364
|
+
excelData[iChar].append(self.topologyDict[level][curBasin].mainCharactDict[curChar][key_Param.VALUE])
|
1365
1365
|
iChar += 1
|
1366
1366
|
iBasin += 1
|
1367
1367
|
|
@@ -1784,7 +1784,7 @@ class Catchment:
|
|
1784
1784
|
except:
|
1785
1785
|
nbIntervals = len(myBasin.myRain)-1
|
1786
1786
|
|
1787
|
-
# ['Semi distributed model']['How many?'][
|
1787
|
+
# ['Semi distributed model']['How many?'][key_Param.VALUE]
|
1788
1788
|
|
1789
1789
|
maxRain = 0.0
|
1790
1790
|
for iel in range(len(myBasin.myRain)-nbIntervals):
|
@@ -1792,7 +1792,7 @@ class Catchment:
|
|
1792
1792
|
if maxRain < mySum:
|
1793
1793
|
maxRain = mySum
|
1794
1794
|
|
1795
|
-
paramsInput.myparams["Distributed production model parameters"][which][
|
1795
|
+
paramsInput.myparams["Distributed production model parameters"][which][key_Param.VALUE] = maxRain
|
1796
1796
|
|
1797
1797
|
# paramsInput.ApplytoMemory(None)
|
1798
1798
|
paramsInput.SavetoFile(None)
|
@@ -1817,7 +1817,7 @@ class Catchment:
|
|
1817
1817
|
if(show):
|
1818
1818
|
plt.show()
|
1819
1819
|
|
1820
|
-
|
1820
|
+
|
1821
1821
|
def get_all_cumulRain(self, selection_by_iD=[]) -> tuple[np.array, list[np.array]]:
|
1822
1822
|
'''
|
1823
1823
|
|
@@ -1834,7 +1834,7 @@ class Catchment:
|
|
1834
1834
|
curBasin:SubBasin = self.subBasinDict[iBasin]
|
1835
1835
|
list_rain.append(curBasin.cumul_rain)
|
1836
1836
|
|
1837
|
-
|
1837
|
+
|
1838
1838
|
return self.time, list_rain
|
1839
1839
|
|
1840
1840
|
|
@@ -2374,9 +2374,9 @@ class Catchment:
|
|
2374
2374
|
|
2375
2375
|
|
2376
2376
|
def get_sub_Nash(self, measure:SubBasin,
|
2377
|
-
selection_by_iD,
|
2377
|
+
selection_by_iD,
|
2378
2378
|
intervals:list[tuple[datetime.datetime]]=[]):
|
2379
|
-
|
2379
|
+
|
2380
2380
|
# for element in selection_by_iD:
|
2381
2381
|
# junctionKey = self.get_key_catchmentDict(name=element)
|
2382
2382
|
# if junctionKey in self.subBasinDict:
|
@@ -2388,22 +2388,22 @@ class Catchment:
|
|
2388
2388
|
ns = curSub.evaluate_Nash(measure=measure, intervals=intervals)
|
2389
2389
|
|
2390
2390
|
return ns
|
2391
|
-
|
2392
2391
|
|
2393
2392
|
|
2394
|
-
|
2393
|
+
|
2394
|
+
def get_sub_peak(self, selection_by_iD,
|
2395
2395
|
intervals:list[tuple[datetime.datetime]]=[]):
|
2396
|
-
|
2396
|
+
|
2397
2397
|
junctionKey = self.get_key_catchmentDict(name=selection_by_iD)
|
2398
2398
|
if junctionKey in self.catchmentDict:
|
2399
2399
|
curSub:SubBasin = self.catchmentDict[junctionKey]
|
2400
2400
|
ns = curSub.get_peak(intervals=intervals)
|
2401
|
-
|
2401
|
+
|
2402
2402
|
return ns
|
2403
|
-
|
2403
|
+
|
2404
2404
|
|
2405
2405
|
def set_eff_outlet_coord(self):
|
2406
|
-
|
2406
|
+
|
2407
2407
|
all_nodes = [self.charact_watrshd.find_rivers(whichsub=ii+1)[0][0] for ii in range(self.nbSubBasin)]
|
2408
2408
|
for el in all_nodes:
|
2409
2409
|
el:Node_Watershed
|
@@ -2416,7 +2416,7 @@ class Catchment:
|
|
2416
2416
|
def update_charact_watrshd(self):
|
2417
2417
|
if self.charact_watrshd.to_update_times:
|
2418
2418
|
self.charact_watrshd.update_times(self.time_wolf_array)
|
2419
|
-
|
2419
|
+
|
2420
2420
|
|
2421
2421
|
def make_nd_array(self, c_pointer, shape, dtype=np.float64, order='C', own_data=True,readonly=False):
|
2422
2422
|
arr_size = np.prod(shape[:]) * np.dtype(dtype).itemsize
|