wolfhece 2.2.15__py3-none-any.whl → 2.2.17__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/Model1D.py +12 -12
- wolfhece/PyDraw.py +31 -6
- wolfhece/PyGui.py +9 -1
- wolfhece/PyParams.py +29 -0
- wolfhece/Results2DGPU.py +6 -0
- wolfhece/__init__.py +1 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/apps/wolf.py +1 -1
- wolfhece/assets/__init__.py +0 -1
- wolfhece/assets/mesh.py +807 -0
- wolfhece/friction_law.py +3 -3
- wolfhece/hydrology/SubBasin.py +154 -154
- wolfhece/hydrometry/kiwis.py +55 -16
- wolfhece/lazviewer/laz_viewer.py +4 -4
- wolfhece/mesh2d/wolf2dprev.py +23 -0
- wolfhece/pyshields.py +38 -2
- wolfhece/wolf_array.py +78 -24
- wolfhece/wolfresults_2D.py +698 -183
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/METADATA +2 -3
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/RECORD +23 -22
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/WHEEL +1 -1
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/top_level.txt +0 -0
wolfhece/hydrology/SubBasin.py
CHANGED
@@ -130,7 +130,7 @@ class SubBasin:
|
|
130
130
|
_version:float # version of the wolfHydro python code. Useful for identifying the file versions to read and how to interpret them
|
131
131
|
|
132
132
|
|
133
|
-
def __init__(self, _dateBegin:datetime.datetime=None, _dateEnd:datetime.datetime=None, _deltaT:int=0, _model=cst.measures,_workingDir:str="",
|
133
|
+
def __init__(self, _dateBegin:datetime.datetime=None, _dateEnd:datetime.datetime=None, _deltaT:int=0, _model=cst.measures,_workingDir:str="",
|
134
134
|
_hyeto:dict={}, _x:float=0.0, _y:float=0.0, surfaceDrained:float=0.0,
|
135
135
|
_iD_interiorPoint:int=1,_idSorted:int=1, name:str=None, readHydro=True, _tz:int=0, version:str=cst.VERSION_WOLFHYDRO):
|
136
136
|
if(name is None):
|
@@ -296,19 +296,19 @@ class SubBasin:
|
|
296
296
|
|
297
297
|
# Init the time properties if not already done
|
298
298
|
if self.dateBegin is None or self.dateEnd is None or self.deltaT == 0:
|
299
|
-
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
300
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
299
|
+
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
300
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
301
301
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
302
|
-
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
303
|
-
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
302
|
+
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
303
|
+
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
304
304
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
305
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
306
|
-
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
305
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
306
|
+
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
307
307
|
microsecond=0, tzinfo=datetime.timezone.utc) - self.dateBegin).total_seconds()
|
308
308
|
|
309
309
|
secondsInDay = 24*60*60
|
310
|
-
prevDate = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
311
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
310
|
+
prevDate = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
311
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
312
312
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
313
313
|
prevDate -= tzDelta
|
314
314
|
if(self.dateBegin!=prevDate):
|
@@ -327,12 +327,12 @@ class SubBasin:
|
|
327
327
|
nbData = len(matrixData)
|
328
328
|
|
329
329
|
for i in range(1,nbData):
|
330
|
-
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
331
|
-
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
330
|
+
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
331
|
+
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
332
332
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
333
333
|
currDate -= tzDelta
|
334
|
-
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
335
|
-
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
334
|
+
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
335
|
+
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
336
336
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
337
337
|
prevDate -= tzDelta
|
338
338
|
diffDate = currDate - prevDate
|
@@ -432,14 +432,14 @@ class SubBasin:
|
|
432
432
|
|
433
433
|
# Init the time properties if not already done
|
434
434
|
if self.dateBegin is None or self.dateEnd is None or self.deltaT == 0:
|
435
|
-
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
436
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
435
|
+
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
436
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
437
437
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
438
|
-
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
439
|
-
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
438
|
+
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
439
|
+
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
440
440
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
441
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
442
|
-
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
441
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
442
|
+
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
443
443
|
microsecond=0, tzinfo=datetime.timezone.utc) - self.dateBegin).total_seconds()
|
444
444
|
|
445
445
|
secondsInDay = 24*60*60
|
@@ -458,12 +458,12 @@ class SubBasin:
|
|
458
458
|
outFlow[0][0] = matrixData[0][6]
|
459
459
|
for i in range(1,len(matrixData)):
|
460
460
|
|
461
|
-
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
462
|
-
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
461
|
+
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
462
|
+
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
463
463
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
464
464
|
currDate -= tzDelta
|
465
|
-
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
466
|
-
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
465
|
+
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
466
|
+
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
467
467
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
468
468
|
prevDate -= tzDelta
|
469
469
|
diffDate = currDate - prevDate
|
@@ -593,16 +593,16 @@ class SubBasin:
|
|
593
593
|
|
594
594
|
# Init the time properties if not already done
|
595
595
|
if self.dateBegin is None or self.dateEnd is None or self.deltaT == 0:
|
596
|
-
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
597
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
596
|
+
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
597
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
598
598
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
599
|
-
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
600
|
-
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
599
|
+
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
600
|
+
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
601
601
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
602
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
603
|
-
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
602
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
603
|
+
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
604
604
|
microsecond=0, tzinfo=datetime.timezone.utc) - self.dateBegin).total_seconds()
|
605
|
-
|
605
|
+
|
606
606
|
# Init of the outflow array
|
607
607
|
outFlow = np.zeros((len(matrixData),3),dtype=ct.c_double, order='F')
|
608
608
|
|
@@ -734,14 +734,14 @@ class SubBasin:
|
|
734
734
|
|
735
735
|
# Init the time properties if not already done
|
736
736
|
if self.dateBegin is None or self.dateEnd is None or self.deltaT == 0:
|
737
|
-
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
738
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
737
|
+
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
738
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
739
739
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
740
|
-
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
741
|
-
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
740
|
+
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
741
|
+
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
742
742
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
743
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
744
|
-
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
743
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
744
|
+
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
745
745
|
microsecond=0, tzinfo=datetime.timezone.utc) - self.dateBegin).total_seconds()
|
746
746
|
|
747
747
|
secondsInDay = 24*60*60
|
@@ -756,12 +756,12 @@ class SubBasin:
|
|
756
756
|
# outFlow[0][0] = matrixData[0][6]*self.surfaceDrained/3.6
|
757
757
|
outFlow[0][0] = matrixData[0][6]
|
758
758
|
for i in range(1,len(matrixData)):
|
759
|
-
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
760
|
-
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
759
|
+
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
760
|
+
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
761
761
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
762
762
|
currDate -= tzDelta
|
763
|
-
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
764
|
-
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
763
|
+
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
764
|
+
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
765
765
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
766
766
|
prevDate -= tzDelta
|
767
767
|
diffDate = currDate - prevDate
|
@@ -819,20 +819,20 @@ class SubBasin:
|
|
819
819
|
if nbCl==5:
|
820
820
|
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]), hour=int(matrixData[0][3]), tzinfo=datetime.timezone.utc)
|
821
821
|
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]), hour=int(matrixData[-1][3]), tzinfo=datetime.timezone.utc)
|
822
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]), hour=int(matrixData[1][3]), tzinfo=datetime.timezone.utc)
|
822
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]), hour=int(matrixData[1][3]), tzinfo=datetime.timezone.utc)
|
823
823
|
- self.dateBegin).total_seconds()
|
824
824
|
if nbCl==7:
|
825
|
-
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
826
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
825
|
+
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
826
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
827
827
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
828
|
-
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
829
|
-
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
828
|
+
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
829
|
+
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
830
830
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
831
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
832
|
-
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
831
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
832
|
+
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
833
833
|
microsecond=0, tzinfo=datetime.timezone.utc) - self.dateBegin).total_seconds()
|
834
|
-
|
835
|
-
# Init of the outflow array
|
834
|
+
|
835
|
+
# Init of the outflow array
|
836
836
|
timeInterval = self.dateEnd-self.dateBegin+datetime.timedelta(seconds=self.deltaT)
|
837
837
|
outFlow = np.zeros(int(timeInterval.total_seconds()/self.deltaT),dtype=ct.c_double, order='F')
|
838
838
|
timeArray = np.zeros(int(timeInterval.total_seconds()/self.deltaT))
|
@@ -932,7 +932,7 @@ class SubBasin:
|
|
932
932
|
i += 1
|
933
933
|
|
934
934
|
matrixData = np.array(list_data).astype("float")
|
935
|
-
|
935
|
+
|
936
936
|
# Init the time properties if not already done
|
937
937
|
if self.dateBegin is None or self.dateEnd is None or self.deltaT == 0:
|
938
938
|
self.dateBegin = datetime.datetime.fromtimestamp(matrixData[0][0], tz=datetime.timezone.utc)
|
@@ -991,7 +991,7 @@ class SubBasin:
|
|
991
991
|
print("ERROR: the dates read are not consitent with the dates already recored in this subbasin!")
|
992
992
|
sys.exit()
|
993
993
|
return timeArray[:index], outFlow[:index]
|
994
|
-
|
994
|
+
|
995
995
|
else:
|
996
996
|
# Valid for any hydro model with an assement module at the end, there is only 1 output to consider.
|
997
997
|
|
@@ -1027,14 +1027,14 @@ class SubBasin:
|
|
1027
1027
|
|
1028
1028
|
# Init the time properties if not already done
|
1029
1029
|
if self.dateBegin is None or self.dateEnd is None or self.deltaT == 0:
|
1030
|
-
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
1031
|
-
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
1030
|
+
self.dateBegin = datetime.datetime(year=int(matrixData[0][2]), month=int(matrixData[0][1]), day=int(matrixData[0][0]),
|
1031
|
+
hour=int(matrixData[0][3]), minute=int(matrixData[0][4]), second=int(matrixData[0][5]),
|
1032
1032
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
1033
|
-
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
1034
|
-
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
1033
|
+
self.dateEnd = datetime.datetime(year=int(matrixData[-1][2]), month=int(matrixData[-1][1]), day=int(matrixData[-1][0]),
|
1034
|
+
hour=int(matrixData[-1][3]), minute=int(matrixData[-1][4]), second=int(matrixData[-1][5]),
|
1035
1035
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
1036
|
-
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
1037
|
-
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
1036
|
+
self.deltaT = (datetime.datetime(year=int(matrixData[1][2]), month=int(matrixData[1][1]), day=int(matrixData[1][0]),
|
1037
|
+
hour=int(matrixData[1][3]), minute=int(matrixData[1][4]), second=int(matrixData[1][5]),
|
1038
1038
|
microsecond=0, tzinfo=datetime.timezone.utc) - self.dateBegin).total_seconds()
|
1039
1039
|
|
1040
1040
|
secondsInDay = 24*60*60
|
@@ -1047,14 +1047,14 @@ class SubBasin:
|
|
1047
1047
|
sys.exit()
|
1048
1048
|
timeArray[0] = datetime.datetime.timestamp(prevDate)
|
1049
1049
|
outFlow[0][0] = matrixData[0][6]
|
1050
|
-
|
1050
|
+
|
1051
1051
|
for i in range(1,len(matrixData)):
|
1052
|
-
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
1053
|
-
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
1052
|
+
currDate = datetime.datetime(year=int(matrixData[i][2]), month=int(matrixData[i][1]), day=int(matrixData[i][0]),
|
1053
|
+
hour=int(matrixData[i][3]), minute=int(matrixData[i][4]), second=int(matrixData[i][5]),
|
1054
1054
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
1055
1055
|
currDate -= tzDelta
|
1056
|
-
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
1057
|
-
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
1056
|
+
prevDate = datetime.datetime(year=int(matrixData[i-1][2]), month=int(matrixData[i-1][1]), day=int(matrixData[i-1][0]),
|
1057
|
+
hour=int(matrixData[i-1][3]), minute=int(matrixData[i-1][4]), second=int(matrixData[i-1][5]),
|
1058
1058
|
microsecond=0, tzinfo=datetime.timezone.utc)
|
1059
1059
|
prevDate -= tzDelta
|
1060
1060
|
diffDate = currDate - prevDate
|
@@ -1209,7 +1209,7 @@ class SubBasin:
|
|
1209
1209
|
|
1210
1210
|
|
1211
1211
|
def compute_hydro(self):
|
1212
|
-
"""
|
1212
|
+
r"""
|
1213
1213
|
This procedure computes the total hydrograph and raw hydrograph of subbasin
|
1214
1214
|
|
1215
1215
|
The total hydrograph $q_{tot} is obtained with the formula:
|
@@ -1230,7 +1230,7 @@ class SubBasin:
|
|
1230
1230
|
nameOutFlow = list(self._outFlow.items())[0][0]
|
1231
1231
|
# Sum all the inlets hydrographs
|
1232
1232
|
self.sum_inlets()
|
1233
|
-
if(self.model==cst.tom_UH or self.model==cst.measures or
|
1233
|
+
if(self.model==cst.tom_UH or self.model==cst.measures or
|
1234
1234
|
self.model==cst.tom_GR4 or self.model==cst.compare_opti):
|
1235
1235
|
tmpHydro = np.zeros(len(self.myHydro),dtype=ct.c_double, order='F')
|
1236
1236
|
if(self.model==cst.tom_GR4):
|
@@ -1243,7 +1243,7 @@ class SubBasin:
|
|
1243
1243
|
self._outFlow[nameOutFlow]["Raw"] = self.inletsRaw + tmpHydro
|
1244
1244
|
# Real hydrograph
|
1245
1245
|
self._outFlow[nameOutFlow]["Net"] = self.inlets + tmpHydro
|
1246
|
-
elif(self.model==cst.tom_VHM or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or
|
1246
|
+
elif(self.model==cst.tom_VHM or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or
|
1247
1247
|
self.model==cst.tom_HBV, self.model==cst.tom_SAC_SMA, self.model==cst.tom_NAM):
|
1248
1248
|
tmpOutFlow = np.sum(self.myHydro,1)*self.surfaceDrained/3.6
|
1249
1249
|
|
@@ -1551,7 +1551,7 @@ class SubBasin:
|
|
1551
1551
|
- the raw outlet: in black dashed line
|
1552
1552
|
"""
|
1553
1553
|
|
1554
|
-
if(self.model==cst.tom_UH or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or self.model==cst.tom_GR4 or
|
1554
|
+
if(self.model==cst.tom_UH or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or self.model==cst.tom_GR4 or
|
1555
1555
|
self.model==cst.tom_HBV, self.model==cst.tom_SAC_SMA, self.model==cst.tom_NAM):
|
1556
1556
|
# x = self.time/3600.0
|
1557
1557
|
if(axis=="Hours"):
|
@@ -1983,7 +1983,7 @@ class SubBasin:
|
|
1983
1983
|
tmpSum = np.zeros(len(myOutFlow)-lastElement)
|
1984
1984
|
# y = np.zeros((len(self.outFlow)-lastElement,nbElements))
|
1985
1985
|
y = []
|
1986
|
-
if(self.model==cst.tom_UH or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or
|
1986
|
+
if(self.model==cst.tom_UH or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or
|
1987
1987
|
cst.tom_GR4 or cst.tom_HBV or cst.tom_SAC_SMA or cst.tom_NAM):
|
1988
1988
|
if(withDelay):
|
1989
1989
|
# y[:,0] = self.outFlow[:-1]
|
@@ -2052,7 +2052,7 @@ class SubBasin:
|
|
2052
2052
|
# y_titles.append("Baseflow")
|
2053
2053
|
# y_titles.append("Total")
|
2054
2054
|
y_titles.append(_('Débits simulés'))
|
2055
|
-
elif(self.model==cst.tom_UH or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or
|
2055
|
+
elif(self.model==cst.tom_UH or self.model==cst.tom_2layers_linIF or self.model==cst.tom_2layers_UH or
|
2056
2056
|
self.model==cst.tom_HBV or self.model==cst.tom_SAC_SMA or self.model==cst.tom_NAM):
|
2057
2057
|
if(ylabel==[]):
|
2058
2058
|
y_titles.append(_('Débits simulés'))
|
@@ -2410,7 +2410,7 @@ class SubBasin:
|
|
2410
2410
|
myOutFlow *= 3.6/self.surfaceDrainedHydro
|
2411
2411
|
|
2412
2412
|
return myOutFlow
|
2413
|
-
|
2413
|
+
|
2414
2414
|
|
2415
2415
|
def get_outFlow_at_time(self, time:datetime.datetime, typeOutFlow:str="Net", unit:str='m3/s', whichOutFlow="", lag:float=0.0):
|
2416
2416
|
if time.tzname() != "UTC":
|
@@ -2492,7 +2492,7 @@ class SubBasin:
|
|
2492
2492
|
myParams.append(float(wolf_If.get_param("Horton parameters","F0")))
|
2493
2493
|
myParams.append(float(wolf_If.get_param("Horton parameters","Fc")))
|
2494
2494
|
myParams.append(float(wolf_If.get_param("Horton parameters","k")))
|
2495
|
-
|
2495
|
+
|
2496
2496
|
|
2497
2497
|
uMax = float(wolf_If.get_param("Distributed production model parameters","Umax"))
|
2498
2498
|
p = self.myRain[:]
|
@@ -2788,7 +2788,7 @@ class SubBasin:
|
|
2788
2788
|
timeDelays = self.intletsObj[element].get_timeDelays(timeDelays)
|
2789
2789
|
|
2790
2790
|
return timeDelays
|
2791
|
-
|
2791
|
+
|
2792
2792
|
|
2793
2793
|
def get_timeDelays_inlets(self):
|
2794
2794
|
|
@@ -3236,7 +3236,7 @@ class SubBasin:
|
|
3236
3236
|
def collect_x_from_production(self) -> dict[str,np.array]:
|
3237
3237
|
"""
|
3238
3238
|
This procedure is collecting all the time series fractions of each outflow of the hydrological production models written in Fortran
|
3239
|
-
|
3239
|
+
|
3240
3240
|
Returns:
|
3241
3241
|
dict[str, np.array]: A dictionary containing the fractions of each outflow.
|
3242
3242
|
"""
|
@@ -3248,13 +3248,13 @@ class SubBasin:
|
|
3248
3248
|
all_x = self.collect_x_GR4()
|
3249
3249
|
elif self.model == cst.tom_2layers_linIF:
|
3250
3250
|
all_x = self.collect_x_2layers()
|
3251
|
-
|
3251
|
+
|
3252
3252
|
return all_x
|
3253
|
-
|
3253
|
+
|
3254
3254
|
def collect_fractions(self) -> dict[str,np.array]:
|
3255
3255
|
"""
|
3256
3256
|
This procedure is collecting all the fractions of each outflow of the hydrological production models.
|
3257
|
-
|
3257
|
+
|
3258
3258
|
Returns:
|
3259
3259
|
dict[str, np.array]: A dictionary containing the fractions of each outflow.
|
3260
3260
|
"""
|
@@ -3266,14 +3266,14 @@ class SubBasin:
|
|
3266
3266
|
all_f = self._collect_fractions_GR4(all_x)
|
3267
3267
|
elif self.model == cst.tom_2layers_linIF:
|
3268
3268
|
all_f = self._collect_fractions_2layers(all_x)
|
3269
|
-
|
3269
|
+
|
3270
3270
|
return all_f
|
3271
|
-
|
3272
|
-
|
3271
|
+
|
3272
|
+
|
3273
3273
|
def collect_all_internal_variables(self) -> dict[str,np.array]:
|
3274
3274
|
"""
|
3275
3275
|
This procedure is collecting all internal variables of the hydrological production models.
|
3276
|
-
|
3276
|
+
|
3277
3277
|
Returns:
|
3278
3278
|
dict[str, np.array]: A dictionary containing the fractions of each outflow.
|
3279
3279
|
"""
|
@@ -3285,10 +3285,10 @@ class SubBasin:
|
|
3285
3285
|
all_iv = self.collect_iv_GR4()
|
3286
3286
|
elif self.model == cst.tom_2layers_linIF:
|
3287
3287
|
all_iv = self.collect_iv_2layers()
|
3288
|
-
|
3288
|
+
|
3289
3289
|
return all_iv
|
3290
|
-
|
3291
|
-
|
3290
|
+
|
3291
|
+
|
3292
3292
|
def activate_all_internal_variables(self):
|
3293
3293
|
"""
|
3294
3294
|
This procedure is activating all internal variables of all the hydrological modules.
|
@@ -3300,7 +3300,7 @@ class SubBasin:
|
|
3300
3300
|
# elif self.model == cst.tom_2layers_linIF:
|
3301
3301
|
# self.activate_all_iv_2layers()
|
3302
3302
|
cur_dir = os.path.join(self.fileNameRead, "Subbasin_"+str(self.iDSorted))
|
3303
|
-
|
3303
|
+
|
3304
3304
|
mc.MODELS_VAR[self.model].activate_all(directory=cur_dir, prefix_file='simul', type_of_var=iv.FINAL_OUT_VAR)
|
3305
3305
|
mc.MODELS_VAR[self.model].activate_all(directory=cur_dir, prefix_file='simul', type_of_var=iv.IV_VAR)
|
3306
3306
|
|
@@ -3308,7 +3308,7 @@ class SubBasin:
|
|
3308
3308
|
def collect_x_VHM(self) -> dict[str,np.array]:
|
3309
3309
|
"""
|
3310
3310
|
This procedure is collecting all the fractions of each outflow of the VHM model.
|
3311
|
-
|
3311
|
+
|
3312
3312
|
Returns:
|
3313
3313
|
- all_x: A dictionary containing the fractions of each outflow of the VHM model.
|
3314
3314
|
"""
|
@@ -3316,17 +3316,17 @@ class SubBasin:
|
|
3316
3316
|
files_per_keys = [["xbf", "xif", "xof", "xu"],[]]
|
3317
3317
|
group = "Internal variables to save"
|
3318
3318
|
param = "simul_soil"
|
3319
|
-
|
3320
|
-
all_x = self.collect_internal_variables(list_keys, files_per_keys,
|
3319
|
+
|
3320
|
+
all_x = self.collect_internal_variables(list_keys, files_per_keys,
|
3321
3321
|
group_name=group, param_name=param)
|
3322
3322
|
|
3323
3323
|
return all_x
|
3324
|
-
|
3324
|
+
|
3325
3325
|
|
3326
3326
|
def _collect_fractions_VHM(self, all_x:dict[str,np.array]) -> dict[str,np.array]:
|
3327
3327
|
"""
|
3328
3328
|
This procedure is collecting all the fractions of each outflow of the VHM model.
|
3329
|
-
|
3329
|
+
|
3330
3330
|
Returns:
|
3331
3331
|
- all_f: A dictionary containing the fractions of each outflow of the VHM model.
|
3332
3332
|
"""
|
@@ -3334,21 +3334,21 @@ class SubBasin:
|
|
3334
3334
|
|
3335
3335
|
if all_x=={}:
|
3336
3336
|
return all_f
|
3337
|
-
|
3337
|
+
|
3338
3338
|
condition = self.myRain > 0.0
|
3339
3339
|
|
3340
3340
|
all_f["% qof"] = np.where(condition, all_x["xof"] * 100.0, np.nan)
|
3341
3341
|
all_f["% qif"] = np.where(condition, all_x["xif"] * 100.0, np.nan)
|
3342
3342
|
all_f["% qbf"] = np.where(condition, all_x["xbf"] * 100.0, np.nan)
|
3343
3343
|
all_f["% loss"] = np.where(condition, all_x["xu"] * 100.0, np.nan)
|
3344
|
-
|
3344
|
+
|
3345
3345
|
return all_f
|
3346
|
-
|
3347
|
-
|
3346
|
+
|
3347
|
+
|
3348
3348
|
def collect_iv_VHM(self) -> dict[str,np.array]:
|
3349
3349
|
"""
|
3350
3350
|
This procedure is collecting all internal variables of the VHM model in each module.
|
3351
|
-
|
3351
|
+
|
3352
3352
|
Returns:
|
3353
3353
|
- all_iv: A dictionary containing all internal variables of the VHM model.
|
3354
3354
|
"""
|
@@ -3356,12 +3356,12 @@ class SubBasin:
|
|
3356
3356
|
files_per_keys = [[],["U"]]
|
3357
3357
|
group = "Internal variables to save"
|
3358
3358
|
param = "simul_soil"
|
3359
|
-
|
3360
|
-
all_iv = self.collect_internal_variables(list_keys, files_per_keys,
|
3359
|
+
|
3360
|
+
all_iv = self.collect_internal_variables(list_keys, files_per_keys,
|
3361
3361
|
group_name=group, param_name=param)
|
3362
3362
|
|
3363
3363
|
return all_iv
|
3364
|
-
|
3364
|
+
|
3365
3365
|
|
3366
3366
|
def activate_all_iv_VHM(self):
|
3367
3367
|
"""
|
@@ -3370,57 +3370,57 @@ class SubBasin:
|
|
3370
3370
|
list_keys = ["x", "U"]
|
3371
3371
|
group = "Internal variables to save"
|
3372
3372
|
param = "simul_soil"
|
3373
|
-
|
3373
|
+
|
3374
3374
|
self.activate_internal_variables(list_keys, group_name=group, param_name=param)
|
3375
|
-
|
3375
|
+
|
3376
3376
|
|
3377
3377
|
def collect_x_GR4(self) -> dict[str,np.array]:
|
3378
3378
|
"""
|
3379
3379
|
This procedure is collecting the fractions of each outflow of the GR4 model.
|
3380
|
-
|
3380
|
+
|
3381
3381
|
Returns:
|
3382
3382
|
dict[str, np.array]: A dictionary containing all fractions of each outflow of the GR4 model.
|
3383
3383
|
"""
|
3384
3384
|
all_x = {}
|
3385
|
-
|
3385
|
+
|
3386
3386
|
return all_x
|
3387
|
-
|
3388
|
-
|
3387
|
+
|
3388
|
+
|
3389
3389
|
def _collect_fractions_GR4(self, all_x:dict[str,np.array]) -> dict[str,np.array]:
|
3390
3390
|
"""
|
3391
3391
|
This procedure is collecting all the fractions of each outflow of the GR4 model.
|
3392
|
-
|
3392
|
+
|
3393
3393
|
Returns:
|
3394
3394
|
- all_f: A dictionary containing the fractions of each outflow of the GR4 model.
|
3395
3395
|
"""
|
3396
3396
|
all_f = {}
|
3397
|
-
|
3397
|
+
|
3398
3398
|
return all_f
|
3399
|
-
|
3399
|
+
|
3400
3400
|
|
3401
3401
|
def collect_iv_GR4(self) -> dict[str,np.array]:
|
3402
3402
|
"""
|
3403
3403
|
This procedure is collecting all internal variables of the GR4 model in each module.
|
3404
|
-
|
3404
|
+
|
3405
3405
|
Returns:
|
3406
3406
|
- all_iv: A dictionary containing all internal variables of the GR4 model.
|
3407
3407
|
"""
|
3408
3408
|
all_iv = {}
|
3409
|
-
|
3409
|
+
|
3410
3410
|
return all_iv
|
3411
|
-
|
3411
|
+
|
3412
3412
|
|
3413
3413
|
def activate_all_iv_GR4(self):
|
3414
3414
|
"""
|
3415
3415
|
This procedure is activating all internal variables of the GR4 model in each module.
|
3416
3416
|
"""
|
3417
3417
|
return
|
3418
|
-
|
3418
|
+
|
3419
3419
|
|
3420
3420
|
def collect_x_2layers(self) -> dict[str,np.array]:
|
3421
3421
|
"""
|
3422
3422
|
This procedure is collecting the fractions of each outflow of the 2 layers model.
|
3423
|
-
|
3423
|
+
|
3424
3424
|
Returns:
|
3425
3425
|
A dictionary containing the collected fractions of each outflow variables.
|
3426
3426
|
"""
|
@@ -3428,17 +3428,17 @@ class SubBasin:
|
|
3428
3428
|
files_per_keys = [["xif"], [], ["xp"]]
|
3429
3429
|
group = "Internal variables to save"
|
3430
3430
|
param = "simul_soil"
|
3431
|
-
|
3432
|
-
all_x = self.collect_internal_variables(list_keys, files_per_keys,
|
3431
|
+
|
3432
|
+
all_x = self.collect_internal_variables(list_keys, files_per_keys,
|
3433
3433
|
group_name=group, param_name=param)
|
3434
3434
|
|
3435
3435
|
return all_x
|
3436
|
-
|
3436
|
+
|
3437
3437
|
|
3438
3438
|
def _collect_fractions_2layers(self, all_x:dict[str,np.array]) -> dict[str,np.array]:
|
3439
3439
|
"""
|
3440
3440
|
This procedure is collecting all the fractions of each outflow of the 2 layers model.
|
3441
|
-
|
3441
|
+
|
3442
3442
|
Returns:
|
3443
3443
|
- all_f: A dictionary containing the fractions of each outflow of the 2 layers model.
|
3444
3444
|
"""
|
@@ -3446,22 +3446,22 @@ class SubBasin:
|
|
3446
3446
|
|
3447
3447
|
if all_x=={}:
|
3448
3448
|
return all_f
|
3449
|
-
|
3449
|
+
|
3450
3450
|
condition = self.myRain > 0.0
|
3451
|
-
|
3451
|
+
|
3452
3452
|
f_if = np.where(condition, all_x["xp"] * all_x["xif"], np.nan)
|
3453
|
-
|
3453
|
+
|
3454
3454
|
all_f["% qof"] = (all_x["xp"] - f_if) * 100.0
|
3455
3455
|
all_f["% qif"] = f_if * 100.0
|
3456
3456
|
all_f["% loss"] = np.where(condition, (1.0 - all_x["xp"]) * 100.0, np.nan)
|
3457
|
-
|
3457
|
+
|
3458
3458
|
return all_f
|
3459
|
-
|
3459
|
+
|
3460
3460
|
|
3461
3461
|
def collect_iv_2layers(self) -> dict[str,np.array]:
|
3462
3462
|
"""
|
3463
3463
|
This procedure is collecting all internal variables of the 2 layers model in each module.
|
3464
|
-
|
3464
|
+
|
3465
3465
|
Returns:
|
3466
3466
|
- all_iv: A dictionary containing the fractions all internal variables of the 2 layers model.
|
3467
3467
|
"""
|
@@ -3469,12 +3469,12 @@ class SubBasin:
|
|
3469
3469
|
files_per_keys = [[], ["U"], ["S"]]
|
3470
3470
|
group = "Internal variables to save"
|
3471
3471
|
param = "simul_soil"
|
3472
|
-
|
3473
|
-
all_iv = self.collect_internal_variables(list_keys, files_per_keys,
|
3472
|
+
|
3473
|
+
all_iv = self.collect_internal_variables(list_keys, files_per_keys,
|
3474
3474
|
group_name=group, param_name=param)
|
3475
|
-
|
3475
|
+
|
3476
3476
|
return all_iv
|
3477
|
-
|
3477
|
+
|
3478
3478
|
|
3479
3479
|
def activate_all_iv_2layers(self):
|
3480
3480
|
"""
|
@@ -3483,11 +3483,11 @@ class SubBasin:
|
|
3483
3483
|
list_keys = ["x", "U", "Reservoir"]
|
3484
3484
|
group = "Internal variables to save"
|
3485
3485
|
param = "simul_soil"
|
3486
|
-
|
3486
|
+
|
3487
3487
|
self.activate_internal_variables(list_keys, group_name=group, param_name=param)
|
3488
3488
|
|
3489
|
-
|
3490
|
-
def collect_internal_variables(self, list_keys:list[str], files_per_keys:list[list[str]],
|
3489
|
+
|
3490
|
+
def collect_internal_variables(self, list_keys:list[str], files_per_keys:list[list[str]],
|
3491
3491
|
group_name:str="Internal variables to save", param_name:str="simul_soil"
|
3492
3492
|
)-> dict[str,np.array]:
|
3493
3493
|
"""
|
@@ -3524,9 +3524,9 @@ class SubBasin:
|
|
3524
3524
|
all_iv[curVar] = cur_iv
|
3525
3525
|
else:
|
3526
3526
|
logging.warning("Please activate the interval variable : " + curKey + "to have access the following fraction of outlets : ")
|
3527
|
-
|
3527
|
+
|
3528
3528
|
return all_iv
|
3529
|
-
|
3529
|
+
|
3530
3530
|
|
3531
3531
|
def activate_internal_variables(self, list_keys:list[str], group_name:str="Internal variables to save", param_name:str="simul_soil"):
|
3532
3532
|
"""
|
@@ -3544,13 +3544,13 @@ class SubBasin:
|
|
3544
3544
|
|
3545
3545
|
for curKey in list_keys:
|
3546
3546
|
wolf_soil.change_param(group_name, curKey, 1)
|
3547
|
-
|
3547
|
+
|
3548
3548
|
wolf_soil.SavetoFile(None)
|
3549
3549
|
wolf_soil.Reload(None)
|
3550
3550
|
|
3551
3551
|
return
|
3552
|
-
|
3553
|
-
def get_summary_fractions(self, summary:str="mean", all_f:dict={},
|
3552
|
+
|
3553
|
+
def get_summary_fractions(self, summary:str="mean", all_f:dict={},
|
3554
3554
|
interval:list[tuple[datetime.datetime, datetime.datetime]]=None) -> dict[str, np.array]:
|
3555
3555
|
"""
|
3556
3556
|
This procedure is returning a summary of the fractions of the current module.
|
@@ -3569,7 +3569,7 @@ class SubBasin:
|
|
3569
3569
|
return self._operation_on_ts(all_f, operation=summary, interval=interval)
|
3570
3570
|
|
3571
3571
|
|
3572
|
-
def get_volume_fractions(self, all_f:dict={},
|
3572
|
+
def get_volume_fractions(self, all_f:dict={},
|
3573
3573
|
interval:list[tuple[datetime.datetime, datetime.datetime]]=None) -> dict[str, np.array]:
|
3574
3574
|
"""
|
3575
3575
|
This procedure is returning a summary of the fractions of the current module.
|
@@ -3584,9 +3584,9 @@ class SubBasin:
|
|
3584
3584
|
|
3585
3585
|
if all_f == {}:
|
3586
3586
|
all_f = self.collect_fractions()
|
3587
|
-
|
3587
|
+
|
3588
3588
|
all_v = {key: val/100.0*self.myRain for key, val in all_f.items()}
|
3589
|
-
|
3589
|
+
|
3590
3590
|
if interval is not None:
|
3591
3591
|
interv = np.zeros(len(self.time), dtype=bool)
|
3592
3592
|
for el in interval:
|
@@ -3595,11 +3595,11 @@ class SubBasin:
|
|
3595
3595
|
interv += (self.time>=date_i) & (self.time<=date_f)
|
3596
3596
|
else:
|
3597
3597
|
interv = np.ones(len(self.time), dtype=bool)
|
3598
|
-
|
3598
|
+
|
3599
3599
|
tot_rain = np.nansum(self.myRain[interv])*self.deltaT/3600
|
3600
3600
|
|
3601
3601
|
return {key+" volume": (np.nansum(all_v[key][interv])*self.deltaT/3600)/tot_rain*100 for key in all_v}
|
3602
|
-
|
3602
|
+
|
3603
3603
|
|
3604
3604
|
def check_presence_of_iv(self):
|
3605
3605
|
"""
|
@@ -3608,7 +3608,7 @@ class SubBasin:
|
|
3608
3608
|
# TODO
|
3609
3609
|
|
3610
3610
|
return
|
3611
|
-
|
3611
|
+
|
3612
3612
|
|
3613
3613
|
def get_all_Qtest(self, nb_atttempts=-1, typeOutFlow:str="Net", unit:str='m3/s', whichOutFlow="", lag:float=0.0) -> np.array:
|
3614
3614
|
"""
|
@@ -3620,11 +3620,11 @@ class SubBasin:
|
|
3620
3620
|
Returns:
|
3621
3621
|
- np.array: The Qtest hydrograph of the current module.
|
3622
3622
|
"""
|
3623
|
-
|
3623
|
+
|
3624
3624
|
# FIXME Take into account all the possible types of hydrographs and units
|
3625
3625
|
file_debug_info = "simul_GR4_out_debuginfo.txt"
|
3626
3626
|
prefix = "simul_GR4_out"
|
3627
|
-
|
3627
|
+
|
3628
3628
|
working_dir = os.path.join(self.fileNameRead, 'Subbasin_' + str(self.iDSorted) + '/')
|
3629
3629
|
|
3630
3630
|
q_test = []
|
@@ -3639,13 +3639,13 @@ class SubBasin:
|
|
3639
3639
|
nb_atttempts = nb_max
|
3640
3640
|
|
3641
3641
|
all_files = [os.path.join(working_dir,"".join([prefix,str(i+1)+".dat"])) for i in range(nb_atttempts)]
|
3642
|
-
areOk = [(rd.check_path(file)[0])>=0
|
3642
|
+
areOk = [(rd.check_path(file)[0])>=0
|
3643
3643
|
for file in all_files]
|
3644
3644
|
max_index = next((i for i, x in enumerate(areOk) if x == False), len(areOk))
|
3645
|
-
q_test = [rd.read_hydro_file(working_dir, file_name)[1]*self.surfaceDrained/3.6
|
3645
|
+
q_test = [rd.read_hydro_file(working_dir, file_name)[1]*self.surfaceDrained/3.6
|
3646
3646
|
for file_name in all_files[:max_index]]
|
3647
3647
|
|
3648
|
-
|
3648
|
+
|
3649
3649
|
# for i in range(nb_atttempts):
|
3650
3650
|
# file_name = "".join([prefix,str(i+1)+".dat"])
|
3651
3651
|
# isOk, full_name = rd.check_path(os.path.join(working_dir, file_name))
|
@@ -3653,10 +3653,10 @@ class SubBasin:
|
|
3653
3653
|
# break
|
3654
3654
|
# t, cur_q = rd.read_hydro_file(working_dir, file_name)
|
3655
3655
|
# cur_q = cur_q*self.surfaceDrained/3.6
|
3656
|
-
# q_test.append(cur_q)
|
3656
|
+
# q_test.append(cur_q)
|
3657
3657
|
|
3658
3658
|
return q_test
|
3659
|
-
|
3659
|
+
|
3660
3660
|
|
3661
3661
|
def plot_all_fractions(self, all_fractions:dict[str:np.array]={},figure=None, to_show:bool=False, writeDir:str="", range_data:list[datetime.datetime]=[]) -> None:
|
3662
3662
|
|
@@ -3664,7 +3664,7 @@ class SubBasin:
|
|
3664
3664
|
writeFile = os.path.join(self.fileNameWrite, "PostProcess", "_".join(["Q_fractions", self.name]))
|
3665
3665
|
else:
|
3666
3666
|
writeFile = os.path.join(writeDir, "_".join(["Q_fractions", self.name]))
|
3667
|
-
|
3667
|
+
|
3668
3668
|
if all_fractions == {}:
|
3669
3669
|
all_fractions = self.collect_fractions()
|
3670
3670
|
if all_fractions == {}:
|
@@ -3702,7 +3702,7 @@ class SubBasin:
|
|
3702
3702
|
unit='mm/h'
|
3703
3703
|
|
3704
3704
|
return self.get_outFlow(unit=unit)
|
3705
|
-
|
3705
|
+
|
3706
3706
|
|
3707
3707
|
def get_flow_fractions(self, all_f:dict={}, summary:str=None,
|
3708
3708
|
interval:list[tuple[datetime.datetime, datetime.datetime]]=None) -> dict[str, np.ndarray|float]:
|
@@ -3724,12 +3724,12 @@ class SubBasin:
|
|
3724
3724
|
all_f = mc.MODELS_VAR[self.model].get_all_iv_timeseries(directory=cur_dir,
|
3725
3725
|
prefix_file='simul', type_of_var=iv.DEFAULT_VAR)
|
3726
3726
|
all_f.update(all_qin)
|
3727
|
-
|
3727
|
+
|
3728
3728
|
q_simul = self.get_outFlow(unit='mm/h')
|
3729
3729
|
all_r = {"%"+key: val/q_simul * 100.0 for key, val in all_f.items()}
|
3730
3730
|
|
3731
3731
|
return self._operation_on_ts(all_r, summary=summary, interval=interval)
|
3732
|
-
|
3732
|
+
|
3733
3733
|
|
3734
3734
|
def get_iv(self, all_iv:dict={}, max_params:dict={}, summary:str=None,
|
3735
3735
|
interval:list[tuple[datetime.datetime, datetime.datetime]]=None) -> dict[str, np.array]:
|
@@ -3752,7 +3752,7 @@ class SubBasin:
|
|
3752
3752
|
out_dict = {key: all_iv[key]/cur_max for key, cur_max in max_params.items()}
|
3753
3753
|
else:
|
3754
3754
|
out_dict = all_iv
|
3755
|
-
|
3755
|
+
|
3756
3756
|
return self._operation_on_ts(out_dict, summary=summary, interval=interval)
|
3757
3757
|
|
3758
3758
|
|
@@ -3776,7 +3776,7 @@ class SubBasin:
|
|
3776
3776
|
return {}
|
3777
3777
|
|
3778
3778
|
return {"% "+key: val[eval_i] for key, val in all_iv.items()}
|
3779
|
-
|
3779
|
+
|
3780
3780
|
|
3781
3781
|
def import_from_pandas_Series(self, data:pd.Series, which="outFlow"):
|
3782
3782
|
time = data.index.values.astype(np.int64) // 10 ** 9
|
@@ -3796,7 +3796,7 @@ class SubBasin:
|
|
3796
3796
|
logging.error("Try the following : 'ouflow', 'outFlowRaw', 'myHydro', 'myRain', 'cumul_rain'")
|
3797
3797
|
|
3798
3798
|
return
|
3799
|
-
|
3799
|
+
|
3800
3800
|
def export_to_pandas_Series(self, which="outFlow"):
|
3801
3801
|
idx = pd.to_datetime(self.time, unit='s', utc=True)
|
3802
3802
|
|
@@ -3814,11 +3814,11 @@ class SubBasin:
|
|
3814
3814
|
logging.error("Not a recognised 'which' argument!")
|
3815
3815
|
logging.error("Try the following : 'ouflow', 'outFlowRaw', 'myHydro', 'myRain', 'cumul_rain'")
|
3816
3816
|
return None
|
3817
|
-
|
3817
|
+
|
3818
3818
|
tserie = pd.Series(data, index=idx, copy=True, name=" ".join([self.name,which]))
|
3819
3819
|
|
3820
3820
|
return tserie
|
3821
|
-
|
3821
|
+
|
3822
3822
|
|
3823
3823
|
def _operation_on_ts(self, ts:dict[str, np.ndarray], summary:str=None, interval:list[tuple[datetime.datetime, datetime.datetime]]=None):
|
3824
3824
|
if interval is not None:
|