wolfhece 2.1.128__py3-none-any.whl → 2.2.1__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/PyDraw.py +109 -46
- wolfhece/PyGui.py +3 -0
- wolfhece/PyGuiHydrology.py +24 -24
- wolfhece/PyPalette.py +27 -11
- wolfhece/PyParams.py +5 -1
- wolfhece/PyVertexvectors.py +52 -7
- wolfhece/Results2DGPU.py +17 -0
- wolfhece/acceptability/acceptability_gui.py +29 -18
- wolfhece/acceptability/func.py +23 -21
- wolfhece/apps/version.py +2 -2
- wolfhece/eikonal.py +1 -1
- wolfhece/hydrology/Catchment.py +113 -12
- wolfhece/hydrology/Comparison.py +54 -52
- wolfhece/hydrology/Optimisation.py +309 -178
- wolfhece/hydrology/PostProcessHydrology.py +6 -3
- wolfhece/hydrology/RetentionBasin.py +21 -14
- wolfhece/hydrology/SubBasin.py +128 -12
- wolfhece/hydrology/constant.py +3 -0
- wolfhece/hydrology/cst_exchanges.py +364 -38
- wolfhece/hydrology/plot_hydrology.py +34 -18
- wolfhece/hydrology/read.py +16 -6
- wolfhece/lagrangian/particle_system_ui.py +1 -1
- wolfhece/lagrangian/particles.py +1 -1
- wolfhece/lazviewer/processing/estimate_normals/estimate_normals.cp310-win_amd64.pyd +0 -0
- wolfhece/lazviewer/vfuncsdir/vfuncs.cp310-win_amd64.pyd +0 -0
- wolfhece/lazviewer/viewer/viewer.exe +0 -0
- wolfhece/lazviewer/viewer/viewer_np1_23_5.exe +0 -0
- wolfhece/libs/WolfDll.dll +0 -0
- wolfhece/libs/Wolf_tools.dll +0 -0
- wolfhece/libs/get_infos.cp310-win_amd64.pyd +0 -0
- wolfhece/libs/verify_wolf.cp310-win_amd64.pyd +0 -0
- wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
- wolfhece/radar/wolfradar.py +75 -22
- wolfhece/shapes/__init__.py +0 -0
- wolfhece/shapes/circle.py +335 -0
- wolfhece/tools2d_dll.py +359 -0
- wolfhece/wolf_array.py +3 -2
- wolfhece/wolfresults_2D.py +162 -33
- {wolfhece-2.1.128.dist-info → wolfhece-2.2.1.dist-info}/METADATA +15 -9
- {wolfhece-2.1.128.dist-info → wolfhece-2.2.1.dist-info}/RECORD +43 -39
- wolfhece/libs/wolfpy.cp310-win_amd64.pyd +0 -0
- {wolfhece-2.1.128.dist-info → wolfhece-2.2.1.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.128.dist-info → wolfhece-2.2.1.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.128.dist-info → wolfhece-2.2.1.dist-info}/top_level.txt +0 -0
wolfhece/hydrology/Comparison.py
CHANGED
@@ -12,8 +12,6 @@ import sys # module to stop the program when an err
|
|
12
12
|
import os
|
13
13
|
import matplotlib.pyplot as plt
|
14
14
|
import numpy as np
|
15
|
-
from numpy.__config__ import show
|
16
|
-
from numpy.core.arrayprint import set_string_function
|
17
15
|
from wx.core import DD_CHANGE_DIR
|
18
16
|
|
19
17
|
from ..PyTranslate import _
|
@@ -419,10 +417,10 @@ class Comparison:
|
|
419
417
|
tzPlot = plotDict["General Parameters"]["Time Zone Plot"]
|
420
418
|
tzDelta = datetime.timedelta(hours=tzPlot)
|
421
419
|
|
422
|
-
if(envelop and not("Ref Name" in plotDict["General Parameters"])):
|
423
|
-
|
424
|
-
else:
|
425
|
-
|
420
|
+
# if(envelop and not("Ref Name" in plotDict["General Parameters"])):
|
421
|
+
# refName = "Catchment 1"
|
422
|
+
# else:
|
423
|
+
# refName = plotDict["General Parameters"]["Ref Name"]
|
426
424
|
|
427
425
|
if(not("Add Table" in plotDict["General Parameters"])):
|
428
426
|
addTable = False
|
@@ -524,7 +522,7 @@ class Comparison:
|
|
524
522
|
yLabels = []
|
525
523
|
if(not("Catchment traits" in plotDict["General Parameters"])):
|
526
524
|
myTraits = []
|
527
|
-
rain =
|
525
|
+
rain = None
|
528
526
|
z = []
|
529
527
|
nbAddRain=0
|
530
528
|
y_labelAddRain = []
|
@@ -587,7 +585,7 @@ class Comparison:
|
|
587
585
|
# print("ERROR: the simulation time is not long enough for this subbasin to be taken into account")
|
588
586
|
# sys.exit()
|
589
587
|
|
590
|
-
cur_module:RetentionBasin = curCatch.retentionBasinDict["J18"]
|
588
|
+
cur_module:RetentionBasin = curCatch.retentionBasinDict["J18"]
|
591
589
|
tmpHydro = cur_module.get_direct_insideRB_inlets(unit='m3/s')
|
592
590
|
|
593
591
|
y1.append(tmpHydro[:])
|
@@ -604,7 +602,7 @@ class Comparison:
|
|
604
602
|
# else:
|
605
603
|
# print("ERROR: the simulation time is not long enough for this subbasin to be taken into account")
|
606
604
|
# sys.exit()
|
607
|
-
cur_module:RetentionBasin = curCatch.retentionBasinDict["J18"]
|
605
|
+
cur_module:RetentionBasin = curCatch.retentionBasinDict["J18"]
|
608
606
|
tmpHydro = cur_module.get_direct_insideRB_inlets(unit='m3/s')
|
609
607
|
|
610
608
|
y1.append(tmpHydro[:])
|
@@ -721,7 +719,7 @@ class Comparison:
|
|
721
719
|
myTraits.append('-')
|
722
720
|
|
723
721
|
if(sameRain and displayRain):
|
724
|
-
if(rain
|
722
|
+
if(rain is None):
|
725
723
|
rain = curCatch.subBasinDict[id].rain/curCatch.subBasinDict[id].surfaceDrainedHydro*3.6
|
726
724
|
elif(displayRain):
|
727
725
|
upperPlot = True
|
@@ -748,7 +746,7 @@ class Comparison:
|
|
748
746
|
myTraits.append('-')
|
749
747
|
|
750
748
|
if(sameRain and displayRain):
|
751
|
-
if(rain
|
749
|
+
if(rain is None):
|
752
750
|
rain = curCatch.subBasinDict[id].rain/curCatch.subBasinDict[id].surfaceDrainedHydro*3.6
|
753
751
|
elif(displayRain):
|
754
752
|
upperPlot = True
|
@@ -801,7 +799,7 @@ class Comparison:
|
|
801
799
|
if("Measures" in plotDict[basinNames[id]]):
|
802
800
|
Measures = plotDict[basinNames[id]]["Measures"]
|
803
801
|
myMeasure = Measures.myHydro
|
804
|
-
yLabels.append(_("
|
802
|
+
yLabels.append(_("Measurement"))
|
805
803
|
catchColorsAddData.append('k')
|
806
804
|
myTraits.append('-')
|
807
805
|
if(Measures.surfaceDrainedHydro>0.0):
|
@@ -904,6 +902,11 @@ class Comparison:
|
|
904
902
|
else:
|
905
903
|
dt = plotDict["General Parameters"]["Dt"]
|
906
904
|
|
905
|
+
if(not("Add Table" in plotDict["General Parameters"])):
|
906
|
+
addTable = False
|
907
|
+
else:
|
908
|
+
addTable = plotDict["General Parameters"]["Add Table"]
|
909
|
+
|
907
910
|
# if(envelop and not("Ref Name" in plotDict["General Parameters"])):
|
908
911
|
# refName = "Catchment 1"
|
909
912
|
|
@@ -1029,7 +1032,7 @@ class Comparison:
|
|
1029
1032
|
if("Measures" in plotDict[RBNames[id]]):
|
1030
1033
|
Measures = plotDict[RBNames[id]]["Measures"]
|
1031
1034
|
myMeasure = Measures.myHydro
|
1032
|
-
yLabels.append(_("
|
1035
|
+
yLabels.append(_("Measurement"))
|
1033
1036
|
catchColorsAddData.append('k')
|
1034
1037
|
myTraits.append('--')
|
1035
1038
|
else:
|
@@ -1052,15 +1055,17 @@ class Comparison:
|
|
1052
1055
|
|
1053
1056
|
|
1054
1057
|
# Plot Rains
|
1055
|
-
yTitles = "
|
1056
|
-
writeFileDef = writeFile
|
1058
|
+
yTitles = _("Water level [m]")
|
1059
|
+
writeFileDef = os.path.join(writeFile, "H_" + graph_title.replace(".",""))
|
1057
1060
|
if(Measures is not None):
|
1058
1061
|
ph.plot_hydro(nbCatchment+nbAddData, y1,x_title=x_title, y_titles=yTitles, beginDate=beginDateRB+beginDateAddData,endDate=endDateRB+endDateAddData,dt=dt+dtAddData,graph_title=graph_title, \
|
1059
1062
|
y_labels=yLabels,rangeData=xRange,y_data_range=yRange,myColors=catchColors+catchColorsAddData,typeOfTraits=myTraits,writeFile=writeFileDef,\
|
1060
|
-
measures=myMeasure,beginDateMeasure=Measures.dateBegin+tzDelta, endDateMeasure=Measures.dateEnd+tzDelta,dtMeasure=Measures.deltaT,deltaMajorTicks=86400/2.0,deltaMinorTicks=3600
|
1063
|
+
measures=myMeasure,beginDateMeasure=Measures.dateBegin+tzDelta, endDateMeasure=Measures.dateEnd+tzDelta,dtMeasure=Measures.deltaT,deltaMajorTicks=86400/2.0,deltaMinorTicks=3600,
|
1064
|
+
addTable=addTable)
|
1061
1065
|
else:
|
1062
1066
|
ph.plot_hydro(nbCatchment+nbAddData, y1,x_title=x_title, y_titles=yTitles, beginDate=beginDateRB+beginDateAddData,endDate=endDateRB+endDateAddData,dt=dt+dtAddData,graph_title=graph_title, \
|
1063
|
-
y_labels=yLabels,rangeData=xRange,y_data_range=yRange,myColors=catchColors+catchColorsAddData,typeOfTraits=myTraits,writeFile=writeFileDef,deltaMajorTicks=86400/2.0,deltaMinorTicks=3600
|
1067
|
+
y_labels=yLabels,rangeData=xRange,y_data_range=yRange,myColors=catchColors+catchColorsAddData,typeOfTraits=myTraits,writeFile=writeFileDef,deltaMajorTicks=86400/2.0,deltaMinorTicks=3600,
|
1068
|
+
addTable=addTable)
|
1064
1069
|
|
1065
1070
|
if(show):
|
1066
1071
|
plt.show()
|
@@ -1175,7 +1180,7 @@ class Comparison:
|
|
1175
1180
|
yLabels = []
|
1176
1181
|
if(not("Catchment traits" in plotDict["General Parameters"])):
|
1177
1182
|
myTraits = []
|
1178
|
-
rain =
|
1183
|
+
rain = None
|
1179
1184
|
z = []
|
1180
1185
|
nbAddRain=0
|
1181
1186
|
y_labelAddRain = []
|
@@ -1308,7 +1313,7 @@ class Comparison:
|
|
1308
1313
|
if("Measures" in plotDict[RBNames[id]]):
|
1309
1314
|
Measures = plotDict[RBNames[id]]["Measures"]
|
1310
1315
|
myMeasure = Measures.myHydro
|
1311
|
-
yLabels.append(_("
|
1316
|
+
yLabels.append(_("Measurement"))
|
1312
1317
|
catchColorsAddData.append('k')
|
1313
1318
|
myTraits.append('-')
|
1314
1319
|
if(Measures.surfaceDrainedHydro>0.0):
|
@@ -1387,7 +1392,7 @@ class Comparison:
|
|
1387
1392
|
|
1388
1393
|
|
1389
1394
|
|
1390
|
-
def plot_all_diff_cumulRain_with_lagtime(self, interval, selection_by_iD=[], writeDir=""):
|
1395
|
+
def plot_all_diff_cumulRain_with_lagtime(self, interval=0, selection_by_iD=[], writeDir=""):
|
1391
1396
|
|
1392
1397
|
for idCatch in self.myCatchments:
|
1393
1398
|
curCatch:Catchment = self.myCatchments[idCatch]['Object']
|
@@ -1405,13 +1410,13 @@ class Comparison:
|
|
1405
1410
|
# graph_title = curCatch.name + " :"
|
1406
1411
|
# cur_t, curVol = curCatch.get_all_cumulRain(selection_by_iD)
|
1407
1412
|
|
1408
|
-
# for
|
1413
|
+
# for
|
1409
1414
|
# plt.figure()
|
1410
1415
|
# plt.title(graph_title)
|
1411
1416
|
# for i in range(len(curVol)):
|
1412
1417
|
# plt.plot(cur_t, curVol[i])
|
1413
1418
|
# plt.savefig(os.path.join(writeDir, graph_title))
|
1414
|
-
|
1419
|
+
|
1415
1420
|
# if show : plt.show()
|
1416
1421
|
|
1417
1422
|
|
@@ -1529,10 +1534,7 @@ class Comparison:
|
|
1529
1534
|
self.plotDict[stationKey]["Add Data"]["Dt"] = []
|
1530
1535
|
|
1531
1536
|
for element in myAddDataObj:
|
1532
|
-
|
1533
|
-
self.plotDict[stationKey]["Add Data"]["Data"].append(element.myHydro[:])
|
1534
|
-
else:
|
1535
|
-
self.plotDict[stationKey]["Add Data"]["Data"].append(element.myHydro[:]*element.surfaceDrained/3.6)
|
1537
|
+
self.plotDict[stationKey]["Add Data"]["Data"].append(element.get_myHydro(unit=addDataUnits))
|
1536
1538
|
self.plotDict[stationKey]["Add Data"]["Date Begin"].append(element.dateBegin)
|
1537
1539
|
self.plotDict[stationKey]["Add Data"]["Date End"].append(element.dateEnd)
|
1538
1540
|
self.plotDict[stationKey]["Add Data"]["Dt"].append(element.deltaT)
|
@@ -1578,34 +1580,34 @@ class Comparison:
|
|
1578
1580
|
del self.plotDict[stationKey]["Add Data"]
|
1579
1581
|
|
1580
1582
|
|
1581
|
-
|
1582
|
-
def plot_Nash_and_peak(self, stationKey:list[str, int], measures:list[SubBasin], intervals:list=[]):
|
1583
|
+
|
1584
|
+
def plot_Nash_and_peak(self, stationKey:list[str, int], measures:list[SubBasin], intervals:list=[], toShow:bool=True):
|
1583
1585
|
assert len(stationKey) == len(measures)
|
1584
1586
|
|
1585
|
-
all_ns = {stationKey[i]: [ self.myCatchments[el]["Object"].get_sub_Nash(measures[i], stationKey[i], intervals)
|
1586
|
-
for el in self.myCatchments ]
|
1587
|
+
all_ns = {stationKey[i]: [ self.myCatchments[el]["Object"].get_sub_Nash(measures[i], stationKey[i], intervals)
|
1588
|
+
for el in self.myCatchments ]
|
1587
1589
|
for i in range(len(stationKey))
|
1588
1590
|
}
|
1589
1591
|
print(all_ns)
|
1590
1592
|
|
1591
|
-
all_peaks = [ [ self.myCatchments[el]["Object"].get_sub_peak(stationKey[i], intervals)
|
1592
|
-
for el in self.myCatchments ]
|
1593
|
-
for i in range(len(stationKey))
|
1593
|
+
all_peaks = [ [ self.myCatchments[el]["Object"].get_sub_peak(stationKey[i], intervals)
|
1594
|
+
for el in self.myCatchments ]
|
1595
|
+
for i in range(len(stationKey))
|
1594
1596
|
]
|
1595
|
-
|
1597
|
+
|
1596
1598
|
print(all_peaks)
|
1597
1599
|
|
1598
|
-
meas_peak = [ measures[i].get_peak(intervals)
|
1600
|
+
meas_peak = [ measures[i].get_peak(intervals)
|
1599
1601
|
for i in range(len(stationKey)) ]
|
1600
|
-
|
1602
|
+
|
1601
1603
|
# The following lines is take the peak difference between simulation and measurements -> Display 0.0 if the measurement is 0.0
|
1602
1604
|
isZero = np.array(meas_peak)==0
|
1603
1605
|
notZero = np.array(meas_peak)!=0
|
1604
|
-
peak_prop = {stationKey[i]: [ list( (np.array(el)-np.array(meas_peak[i]))/(np.array(meas_peak[i])+isZero[i]) *notZero[i] )
|
1605
|
-
for el in all_peaks[i] ]
|
1606
|
+
peak_prop = {stationKey[i]: [ list( (np.array(el)-np.array(meas_peak[i]))/(np.array(meas_peak[i])+isZero[i]) *notZero[i] )
|
1607
|
+
for el in all_peaks[i] ]
|
1606
1608
|
for i in range(len(stationKey))
|
1607
1609
|
}
|
1608
|
-
|
1610
|
+
|
1609
1611
|
print(meas_peak)
|
1610
1612
|
print(peak_prop)
|
1611
1613
|
|
@@ -1633,7 +1635,7 @@ class Comparison:
|
|
1633
1635
|
continue
|
1634
1636
|
else:
|
1635
1637
|
colors_Nash[key][i_model].append("g")
|
1636
|
-
|
1638
|
+
|
1637
1639
|
|
1638
1640
|
colors_peaks = {}
|
1639
1641
|
for key, value in peak_prop.items():
|
@@ -1656,15 +1658,15 @@ class Comparison:
|
|
1656
1658
|
all_names = ["\n - \n".join([cdate[0].strftime("%d/%m/%Y"), cdate[1].strftime("%d/%m/%Y")]) for cdate in intervals]
|
1657
1659
|
|
1658
1660
|
|
1659
|
-
## Plot
|
1661
|
+
## Plot
|
1660
1662
|
nb_stations = len(stationKey)
|
1661
1663
|
type_of_model = [self.myCatchments[el]["Title"] for el in self.myCatchments]
|
1662
1664
|
type_of_data = ["Nash", r"$ \frac{Q^{s}_{max}-Q^{m}_{max}}{Q^{m}_{max}} $ "]
|
1663
1665
|
type_of_data_names = ["Nash", "Exceedance"]
|
1664
1666
|
|
1665
|
-
ph.bar_Nash_n_other(all_data, all_colors, nb_x=len(intervals), nb_data=len(type_of_model), nb_lines=nb_stations,
|
1666
|
-
|
1667
|
-
|
1667
|
+
# ph.bar_Nash_n_other(all_data, all_colors, nb_x=len(intervals), nb_data=len(type_of_model), nb_lines=nb_stations,
|
1668
|
+
# y_titles=type_of_data, x_titles=all_names, nameModel=type_of_model, line_names=sorted_keys, toShow=False)
|
1669
|
+
|
1668
1670
|
# =========
|
1669
1671
|
# =========
|
1670
1672
|
# Plot tables - 2nd version with the table instead of bars
|
@@ -1676,12 +1678,12 @@ class Comparison:
|
|
1676
1678
|
all_peaks = {cur_catch["Title"]: np.array([cur_catch["Object"].get_sub_peak(stationKey[i], intervals) for i in range(len(stationKey))])
|
1677
1679
|
for cur_catch in self.myCatchments.values()
|
1678
1680
|
}
|
1679
|
-
|
1681
|
+
|
1680
1682
|
print(all_peaks)
|
1681
1683
|
|
1682
|
-
meas_peak = np.array([ measures[i].get_peak(intervals)
|
1684
|
+
meas_peak = np.array([ measures[i].get_peak(intervals)
|
1683
1685
|
for i in range(len(stationKey)) ])
|
1684
|
-
|
1686
|
+
|
1685
1687
|
# The following lines is take the peak difference between simulation and measurements -> Display 0.0 if the measurement is 0.0
|
1686
1688
|
isZero = (meas_peak==0)
|
1687
1689
|
notZero = (meas_peak!=0)
|
@@ -1692,13 +1694,13 @@ class Comparison:
|
|
1692
1694
|
|
1693
1695
|
# Concatenate all data
|
1694
1696
|
all_data = [all_ns, peak_prop]
|
1695
|
-
|
1697
|
+
|
1696
1698
|
for data, name_of_data in zip(all_data, type_of_data_names):
|
1697
1699
|
for cur_model, cur_data in data.items():
|
1698
1700
|
file_name = os.path.join(self.workingDir, name_of_data+"_"+cur_model)+".png"
|
1699
1701
|
# cur_title = cur_model + ": " + name_of_data
|
1700
|
-
ph.table_Nash_n_other(cur_data, name_of_data,
|
1701
|
-
row_names=sorted_keys, column_names=all_names,
|
1702
|
+
ph.table_Nash_n_other(cur_data, name_of_data,
|
1703
|
+
row_names=sorted_keys, column_names=all_names,
|
1702
1704
|
writeFile=file_name, toShow=False)
|
1703
|
-
|
1704
|
-
|
1705
|
+
if toShow:
|
1706
|
+
plt.show()
|