wolfhece 2.0.44__py3-none-any.whl → 2.0.46__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/GraphProfile.py +26 -13
- wolfhece/Model1D.py +1562 -319
- wolfhece/PyCrosssections.py +9 -8
- wolfhece/PyDraw.py +17 -10
- wolfhece/PyVertexvectors.py +39 -27
- wolfhece/apps/version.py +1 -1
- wolfhece/drawing_obj.py +10 -0
- wolfhece/hydrology/Catchment.py +329 -5
- wolfhece/hydrology/Comparison.py +34 -25
- wolfhece/hydrology/Optimisation.py +1049 -117
- wolfhece/hydrology/RetentionBasin.py +200 -45
- wolfhece/hydrology/SubBasin.py +614 -31
- wolfhece/hydrology/constant.py +2 -2
- wolfhece/hydrology/cst_exchanges.py +35 -0
- wolfhece/hydrology/plot_hydrology.py +17 -19
- wolfhece/hydrology/read.py +63 -4
- wolfhece/libs/WolfDll.dll +0 -0
- wolfhece/libs/WolfDll_debug.dll +0 -0
- wolfhece/pyGui1D.py +114 -42
- wolfhece/scenario/check_scenario.py +1 -1
- wolfhece/scenario/config_manager.py +46 -1
- {wolfhece-2.0.44.dist-info → wolfhece-2.0.46.dist-info}/METADATA +1 -1
- {wolfhece-2.0.44.dist-info → wolfhece-2.0.46.dist-info}/RECORD +26 -26
- {wolfhece-2.0.44.dist-info → wolfhece-2.0.46.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.44.dist-info → wolfhece-2.0.46.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.44.dist-info → wolfhece-2.0.46.dist-info}/top_level.txt +0 -0
wolfhece/hydrology/constant.py
CHANGED
@@ -35,10 +35,10 @@ DEFAULT_LANDUSE[6] = _("plan d'eau")
|
|
35
35
|
|
36
36
|
|
37
37
|
##
|
38
|
-
DATE_FORMAT_HYDRO = '%Y
|
38
|
+
DATE_FORMAT_HYDRO = '%Y%m%d-%H%M%S'
|
39
39
|
|
40
40
|
|
41
41
|
## Version of the code
|
42
|
-
VERSION_WOLFHYDRO_2023_0 = "2023.
|
42
|
+
VERSION_WOLFHYDRO_2023_0 = "2023.0" # First version to include the versioning
|
43
43
|
VERSION_WOLFHYDRO_2023_1 = "2023.1" # First version to include the versioning
|
44
44
|
VERSION_WOLFHYDRO = "2023.1"
|
@@ -49,63 +49,75 @@ VHM = {}
|
|
49
49
|
VHM["Nb"] = 12
|
50
50
|
VHM["Parameters"] = {}
|
51
51
|
VHM["Parameters"][exchange_parameters_VHM_aif1] = {}
|
52
|
+
VHM["Parameters"][exchange_parameters_VHM_aif1]["Name"] = "Coeff aif1"
|
52
53
|
VHM["Parameters"][exchange_parameters_VHM_aif1]["File"] = "simul_soil.param"
|
53
54
|
VHM["Parameters"][exchange_parameters_VHM_aif1]["Group"] = "Flow fraction parameters"
|
54
55
|
VHM["Parameters"][exchange_parameters_VHM_aif1]["Key"] = "Coeff aif1"
|
55
56
|
VHM["Parameters"][exchange_parameters_VHM_aif1]["Unit"] = "[-]"
|
56
57
|
VHM["Parameters"][exchange_parameters_VHM_aif2] = {}
|
58
|
+
VHM["Parameters"][exchange_parameters_VHM_aif2]["Name"] = "Coeff aif2"
|
57
59
|
VHM["Parameters"][exchange_parameters_VHM_aif2]["File"] = "simul_soil.param"
|
58
60
|
VHM["Parameters"][exchange_parameters_VHM_aif2]["Group"] = "Flow fraction parameters"
|
59
61
|
VHM["Parameters"][exchange_parameters_VHM_aif2]["Key"] = "Coeff aif2"
|
60
62
|
VHM["Parameters"][exchange_parameters_VHM_aif2]["Unit"] = "[-]"
|
61
63
|
VHM["Parameters"][exchange_parameters_VHM_aof1] = {}
|
64
|
+
VHM["Parameters"][exchange_parameters_VHM_aof1]["Name"] = "Coeff aof1"
|
62
65
|
VHM["Parameters"][exchange_parameters_VHM_aof1]["File"] = "simul_soil.param"
|
63
66
|
VHM["Parameters"][exchange_parameters_VHM_aof1]["Group"] = "Flow fraction parameters"
|
64
67
|
VHM["Parameters"][exchange_parameters_VHM_aof1]["Key"] = "Coeff aof1"
|
65
68
|
VHM["Parameters"][exchange_parameters_VHM_aof1]["Unit"] = "[-]"
|
66
69
|
VHM["Parameters"][exchange_parameters_VHM_aof2] = {}
|
70
|
+
VHM["Parameters"][exchange_parameters_VHM_aof2]["Name"] = "Coeff aof2"
|
67
71
|
VHM["Parameters"][exchange_parameters_VHM_aof2]["File"] = "simul_soil.param"
|
68
72
|
VHM["Parameters"][exchange_parameters_VHM_aof2]["Group"] = "Flow fraction parameters"
|
69
73
|
VHM["Parameters"][exchange_parameters_VHM_aof2]["Key"] = "Coeff aof2"
|
70
74
|
VHM["Parameters"][exchange_parameters_VHM_aof2]["Unit"] = "[-]"
|
71
75
|
VHM["Parameters"][exchange_parameters_VHM_au1] = {}
|
76
|
+
VHM["Parameters"][exchange_parameters_VHM_au1]["Name"] = "Coeff au1"
|
72
77
|
VHM["Parameters"][exchange_parameters_VHM_au1]["File"] = "simul_soil.param"
|
73
78
|
VHM["Parameters"][exchange_parameters_VHM_au1]["Group"] = "Flow fraction parameters"
|
74
79
|
VHM["Parameters"][exchange_parameters_VHM_au1]["Key"] = "Coeff au1"
|
75
80
|
VHM["Parameters"][exchange_parameters_VHM_au1]["Unit"] = "[-]"
|
76
81
|
VHM["Parameters"][exchange_parameters_VHM_au2] = {}
|
82
|
+
VHM["Parameters"][exchange_parameters_VHM_au2]["Name"] = "Coeff au2"
|
77
83
|
VHM["Parameters"][exchange_parameters_VHM_au2]["File"] = "simul_soil.param"
|
78
84
|
VHM["Parameters"][exchange_parameters_VHM_au2]["Group"] = "Flow fraction parameters"
|
79
85
|
VHM["Parameters"][exchange_parameters_VHM_au2]["Key"] = "Coeff au2"
|
80
86
|
VHM["Parameters"][exchange_parameters_VHM_au2]["Unit"] = "[-]"
|
81
87
|
VHM["Parameters"][exchange_parameters_VHM_au3] = {}
|
88
|
+
VHM["Parameters"][exchange_parameters_VHM_au3]["Name"] = "Coeff au3"
|
82
89
|
VHM["Parameters"][exchange_parameters_VHM_au3]["File"] = "simul_soil.param"
|
83
90
|
VHM["Parameters"][exchange_parameters_VHM_au3]["Group"] = "Flow fraction parameters"
|
84
91
|
VHM["Parameters"][exchange_parameters_VHM_au3]["Key"] = "Coeff au3"
|
85
92
|
VHM["Parameters"][exchange_parameters_VHM_au3]["Unit"] = "[-]"
|
86
93
|
VHM["Parameters"][exchange_parameters_VHM_Umax] = {}
|
94
|
+
VHM["Parameters"][exchange_parameters_VHM_Umax]["Name"] = "Umax"
|
87
95
|
VHM["Parameters"][exchange_parameters_VHM_Umax]["File"] = "simul_soil.param"
|
88
96
|
VHM["Parameters"][exchange_parameters_VHM_Umax]["Group"] = "Soil characteristics"
|
89
97
|
VHM["Parameters"][exchange_parameters_VHM_Umax]["Key"] = "Umax"
|
90
98
|
VHM["Parameters"][exchange_parameters_VHM_Umax]["Unit"] = "[mm]"
|
91
99
|
VHM["Parameters"][exchange_parameters_VHM_Uevap] = {}
|
100
|
+
VHM["Parameters"][exchange_parameters_VHM_Uevap]["Name"] = "Uevap"
|
92
101
|
VHM["Parameters"][exchange_parameters_VHM_Uevap]["File"] = "simul_soil.param"
|
93
102
|
VHM["Parameters"][exchange_parameters_VHM_Uevap]["Group"] = "Soil characteristics"
|
94
103
|
VHM["Parameters"][exchange_parameters_VHM_Uevap]["Key"] = "Uevap"
|
95
104
|
VHM["Parameters"][exchange_parameters_VHM_Uevap]["Unit"] = "[mm]"
|
96
105
|
VHM["Parameters"][exchange_parameters_VHM_kof] = {}
|
106
|
+
VHM["Parameters"][exchange_parameters_VHM_kof]["Name"] = "kof"
|
97
107
|
VHM["Parameters"][exchange_parameters_VHM_kof]["File"] = "simul_of.param"
|
98
108
|
VHM["Parameters"][exchange_parameters_VHM_kof]["Group"] = "Time Parameters"
|
99
109
|
VHM["Parameters"][exchange_parameters_VHM_kof]["Key"] = "Lagtime"
|
100
110
|
VHM["Parameters"][exchange_parameters_VHM_kof]["Unit"] = "[sec]"
|
101
111
|
VHM["Parameters"][exchange_parameters_VHM_kof]["Convertion Factor"] = 1/3600.0 # [sec] -> [h]
|
102
112
|
VHM["Parameters"][exchange_parameters_VHM_kif] = {}
|
113
|
+
VHM["Parameters"][exchange_parameters_VHM_kif]["Name"] = "kif"
|
103
114
|
VHM["Parameters"][exchange_parameters_VHM_kif]["File"] = "simul_if.param"
|
104
115
|
VHM["Parameters"][exchange_parameters_VHM_kif]["Group"] = "Time Parameters"
|
105
116
|
VHM["Parameters"][exchange_parameters_VHM_kif]["Key"] = "Lagtime"
|
106
117
|
VHM["Parameters"][exchange_parameters_VHM_kif]["Unit"] = "[sec]"
|
107
118
|
VHM["Parameters"][exchange_parameters_VHM_kif]["Convertion Factor"] = 1/3600.0 # [sec] -> [h]
|
108
119
|
VHM["Parameters"][exchange_parameters_VHM_kbf] = {}
|
120
|
+
VHM["Parameters"][exchange_parameters_VHM_kbf]["Name"] = "kbf"
|
109
121
|
VHM["Parameters"][exchange_parameters_VHM_kbf]["File"] = "simul_bf.param"
|
110
122
|
VHM["Parameters"][exchange_parameters_VHM_kbf]["Group"] = "Time Parameters"
|
111
123
|
VHM["Parameters"][exchange_parameters_VHM_kbf]["Key"] = "Lagtime"
|
@@ -115,21 +127,25 @@ GR4 = {}
|
|
115
127
|
GR4["Parameters"] = {}
|
116
128
|
GR4["Nb"] = 4
|
117
129
|
GR4["Parameters"][exchange_parameters_GR4_x1] = {}
|
130
|
+
GR4["Parameters"][exchange_parameters_GR4_x1]["Name"] = "X1"
|
118
131
|
GR4["Parameters"][exchange_parameters_GR4_x1]["File"] = "simul_GR4.param"
|
119
132
|
GR4["Parameters"][exchange_parameters_GR4_x1]["Group"] = "GR4 Parameters"
|
120
133
|
GR4["Parameters"][exchange_parameters_GR4_x1]["Key"] = "X1"
|
121
134
|
GR4["Parameters"][exchange_parameters_GR4_x1]["Unit"] = "[mm]"
|
122
135
|
GR4["Parameters"][exchange_parameters_GR4_x2] = {}
|
136
|
+
GR4["Parameters"][exchange_parameters_GR4_x2]["Name"] = "X2"
|
123
137
|
GR4["Parameters"][exchange_parameters_GR4_x2]["File"] = "simul_GR4.param"
|
124
138
|
GR4["Parameters"][exchange_parameters_GR4_x2]["Group"] = "GR4 Parameters"
|
125
139
|
GR4["Parameters"][exchange_parameters_GR4_x2]["Key"] = "X2"
|
126
140
|
GR4["Parameters"][exchange_parameters_GR4_x2]["Unit"] = "[mm]"
|
127
141
|
GR4["Parameters"][exchange_parameters_GR4_x3] = {}
|
142
|
+
GR4["Parameters"][exchange_parameters_GR4_x3]["Name"] = "X3"
|
128
143
|
GR4["Parameters"][exchange_parameters_GR4_x3]["File"] = "simul_GR4.param"
|
129
144
|
GR4["Parameters"][exchange_parameters_GR4_x3]["Group"] = "GR4 Parameters"
|
130
145
|
GR4["Parameters"][exchange_parameters_GR4_x3]["Key"] = "X3"
|
131
146
|
GR4["Parameters"][exchange_parameters_GR4_x3]["Unit"] = "[mm]"
|
132
147
|
GR4["Parameters"][exchange_parameters_GR4_x4] = {}
|
148
|
+
GR4["Parameters"][exchange_parameters_GR4_x4]["Name"] = "X4"
|
133
149
|
GR4["Parameters"][exchange_parameters_GR4_x4]["File"] = "simul_GR4.param"
|
134
150
|
GR4["Parameters"][exchange_parameters_GR4_x4]["Group"] = "GR4 Parameters"
|
135
151
|
GR4["Parameters"][exchange_parameters_GR4_x4]["Key"] = "X4"
|
@@ -141,61 +157,80 @@ UHDIST_LINBF = {}
|
|
141
157
|
UHDIST_LINBF["Nb"] = 13
|
142
158
|
UHDIST_LINBF["Parameters"] = {}
|
143
159
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_Umax] = {}
|
160
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_Umax]["Name"] = "Umax"
|
144
161
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_Umax]["File"] = "simul_soil.param"
|
145
162
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_Umax]["Group"] = "Distributed production model parameters"
|
146
163
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_Umax]["Key"] = "Umax"
|
147
164
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_Umax]["Unit"] = "[mm]"
|
148
165
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN] = {}
|
166
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN]["Name"] = "Time span soil"
|
149
167
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN]["File"] = "simul_soil.param"
|
150
168
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN]["Group"] = "Distributed production model parameters"
|
151
169
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN]["Key"] = "Time span soil"
|
152
170
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN]["Unit"] = "[sec]"
|
153
171
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Soil_TSPAN]["Convertion Factor"] = 1/3600.0 # [sec] -> [h]
|
154
172
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_F0] = {}
|
173
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_F0]["Name"] = "Horton F0"
|
155
174
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_F0]["File"] = "simul_soil.param"
|
156
175
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_F0]["Group"] = "Horton parameters"
|
157
176
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_F0]["Key"] = "F0"
|
158
177
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_FC] = {}
|
178
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_FC]["Name"] = "Horton Fc"
|
159
179
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_FC]["File"] = "simul_soil.param"
|
160
180
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_FC]["Group"] = "Horton parameters"
|
161
181
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_FC]["Key"] = "Fc"
|
162
182
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_K] = {}
|
183
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_K]["Name"] = "Horton k"
|
163
184
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_K]["File"] = "simul_soil.param"
|
164
185
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_K]["Group"] = "Horton parameters"
|
165
186
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_Horton_K]["Key"] = "k"
|
166
187
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_Hs] = {}
|
188
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_Hs]["Name"] = "Storage reservoir Hs"
|
167
189
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_Hs]["File"] = "simul_soil.param"
|
168
190
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_Hs]["Group"] = "Storage reservoir parameters"
|
169
191
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_Hs]["Key"] = "hs"
|
170
192
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_Hs]["Unit"] = "[mm]"
|
171
193
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_TS] = {}
|
194
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_TS]["Name"] = "Storage reservoir Ts"
|
172
195
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_TS]["File"] = "simul_soil.param"
|
173
196
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_TS]["Group"] = "Storage reservoir parameters"
|
174
197
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_TS]["Key"] = "Ts"
|
175
198
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_RS_TS]["Unit"] = "[h]"
|
176
199
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif] = {}
|
200
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif]["Name"] = "kif"
|
177
201
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif]["File"] = "simul_if.param"
|
178
202
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif]["Group"] = "Time Parameters"
|
179
203
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif]["Key"] = "Lagtime"
|
180
204
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif]["Unit"] = "[sec]"
|
181
205
|
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_kif]["Convertion Factor"] = 1/3600.0 # [sec] -> [h]
|
206
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_qlif] = {}
|
207
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_qlif]["Name"] = "Qlif"
|
208
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_qlif]["File"] = "simul_if.param"
|
209
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_qlif]["Group"] = "Time Parameters"
|
210
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_qlif]["Key"] = "Specific flow rate"
|
211
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Dist_qlif]["Unit"] = "[m^2/s]"
|
182
212
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_riv] = {}
|
213
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_riv]["Name"] = "Froude min (river)"
|
183
214
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_riv]["File"] = "..\\Characteristic_maps\\Drainage_basin.param"
|
184
215
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_riv]["Group"] = "Froude parameters"
|
185
216
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_riv]["Key"] = "Froude min (river)"
|
186
217
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_riv] = {}
|
218
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_riv]["Name"] = "Froude max (river)"
|
187
219
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_riv]["File"] = "..\\Characteristic_maps\\Drainage_basin.param"
|
188
220
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_riv]["Group"] = "Froude parameters"
|
189
221
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_riv]["Key"] = "Froude max (river)"
|
190
222
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_bas] = {}
|
223
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_bas]["Name"] = "Froude min (basin)"
|
191
224
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_bas]["File"] = "..\\Characteristic_maps\\Drainage_basin.param"
|
192
225
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_bas]["Group"] = "Froude parameters"
|
193
226
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_min_bas]["Key"] = "Froude min (basin)"
|
194
227
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_bas] = {}
|
228
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_bas]["Name"] = "Froude max (basin)"
|
195
229
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_bas]["File"] = "..\\Characteristic_maps\\Drainage_basin.param"
|
196
230
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_bas]["Group"] = "Froude parameters"
|
197
231
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_max_bas]["Key"] = "Froude max (basin)"
|
198
232
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_discharge] = {}
|
233
|
+
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_discharge]["Name"] = "Froude discharge"
|
199
234
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_discharge]["File"] = "..\\Characteristic_maps\\Drainage_basin.param"
|
200
235
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_discharge]["Group"] = "Froude parameters"
|
201
236
|
UHDIST_LINBF["Parameters"][exchange_parameters_Froude_discharge]["Key"] = "Discharge"
|
@@ -106,7 +106,7 @@ def compare_plot(nbElements, writeDir, x, y, x_title, y_titles, graph_title='',
|
|
106
106
|
# elif y is a list : each element is located [here][]
|
107
107
|
# TO DO : Maybe change this rationale for y -> Too complicated
|
108
108
|
def plot_hydro(nbElements:int, y, rain=[], x_title="Dates", y_titles=_("Discharge [m³/s]"), time=None, beginDate:datetime.datetime=None, endDate:datetime.datetime=None, dt:float=None, \
|
109
|
-
graph_title:str=None, y_labels:str=None, rangeData:list = [], myColors:list=None, typeOfTraits:list=None, \
|
109
|
+
graph_title:str=None, y_labels:str=None, rangeData:list[datetime.datetime] = [], myColors:list=None, typeOfTraits:list=None, \
|
110
110
|
measures=[], beginDateMeasure=None, endDateMeasure=None, dtMeasure=None, surfaceMeasure=-1.0, addMeasfInTab:bool=False, \
|
111
111
|
upperPlot:bool=False, nbAddPlot:int=1, z=[], y_labelAddPlot=[], factor_RH:float=1.5, y_rain_range=[], y_data_range=[], figSize = [10.4,6.25],\
|
112
112
|
writeFile:str = '', deltaMajorTicks=-1, deltaMinorTicks=-1, \
|
@@ -132,18 +132,16 @@ def plot_hydro(nbElements:int, y, rain=[], x_title="Dates", y_titles=_("Discharg
|
|
132
132
|
sys.exit()
|
133
133
|
|
134
134
|
if(time is not None):
|
135
|
-
# Particular case if the user give the time in time stamps and the dates: it will check the validiy of the arguments
|
136
|
-
if(beginDate is not None and endDate is not None and dt is not None):
|
137
|
-
tmpBeginDate = beginDate
|
138
|
-
tmpEndDate = endDate
|
139
|
-
tmpDt = dt
|
140
135
|
beginDate = datetime.datetime.fromtimestamp(time[0], tz=datetime.timezone.utc)
|
141
136
|
endDate = datetime.datetime.fromtimestamp(time[-1], tz=datetime.timezone.utc)
|
142
137
|
dt = time[1]-time[0]
|
138
|
+
tmpBeginDate = beginDate
|
139
|
+
tmpEndDate = endDate
|
140
|
+
tmpDt = dt
|
143
141
|
time_delta = datetime.timedelta(seconds=dt)
|
144
142
|
# Check the regularity of the time steps
|
145
143
|
for i in range(1,len(time)):
|
146
|
-
if(time[i
|
144
|
+
if(time[i]-time[i-1] != dt):
|
147
145
|
print("ERROR: this procedure cannot take into account irregular time steps")
|
148
146
|
sys.exit()
|
149
147
|
break
|
@@ -284,8 +282,8 @@ def plot_hydro(nbElements:int, y, rain=[], x_title="Dates", y_titles=_("Discharg
|
|
284
282
|
# complete summary table
|
285
283
|
summaryTab.append([])
|
286
284
|
# summaryTab[0].append("%.3f"%(y1.max()))
|
287
|
-
summaryTab[0].append(str(int(round(
|
288
|
-
indexMax = np.
|
285
|
+
summaryTab[0].append(str(int(round(np.nanmax(y1)))))
|
286
|
+
indexMax = np.nanargmax(y1)
|
289
287
|
timeMax = num2date(xdatePlot[indexMax])
|
290
288
|
# summaryTab[0].append(timeMax.strftime("%m/%d/%Y, %H:%M:%S"))
|
291
289
|
summaryTab[0].append(timeMax.strftime("%m/%d/%Y, %H:%M"))
|
@@ -332,16 +330,16 @@ def plot_hydro(nbElements:int, y, rain=[], x_title="Dates", y_titles=_("Discharg
|
|
332
330
|
# complete summary table
|
333
331
|
summaryTab.append([])
|
334
332
|
# summaryTab[i].append("%.3f"%(y1.max()))
|
335
|
-
summaryTab[i].append(str(int(round((
|
336
|
-
indexMax = np.
|
333
|
+
summaryTab[i].append(str(int(round((np.nanmax(y1))))))
|
334
|
+
indexMax = np.nanargmax(y1)
|
337
335
|
timeMax = num2date(xdatePlot[indexMax])
|
338
336
|
# summaryTab[i].append(timeMax.strftime("%m/%d/%Y, %H:%M:%S"))
|
339
337
|
summaryTab[i].append(timeMax.strftime("%m/%d/%Y, %H:%M"))
|
340
338
|
if(allSurfaces!=[]):
|
341
|
-
summaryTab[i].append(np.
|
339
|
+
summaryTab[i].append(np.nansum(y1)*dt_Plot)
|
342
340
|
|
343
|
-
if(
|
344
|
-
max_ =
|
341
|
+
if(np.nanmax(y1)>max_):
|
342
|
+
max_ = np.nanmax(y1)
|
345
343
|
if(myColors[i]==''):
|
346
344
|
if(len(xdatePlot)==len(y1)):
|
347
345
|
ax1.plot_date(xdatePlot,y1,typeOfTraits[i],label=title[i])
|
@@ -396,8 +394,8 @@ def plot_hydro(nbElements:int, y, rain=[], x_title="Dates", y_titles=_("Discharg
|
|
396
394
|
if(measures!=[]):
|
397
395
|
y1 = measures
|
398
396
|
x_date_measure = check_drange_bug(x_date_measure,y1)
|
399
|
-
if(
|
400
|
-
max_ =
|
397
|
+
if(np.nanmax(y1)>max_):
|
398
|
+
max_ = np.nanmax(y1)
|
401
399
|
if(myColors[nbElements]==''):
|
402
400
|
ax1.plot_date(x_date_measure,y1, typeOfTraits[-1],label=title[nbElements])
|
403
401
|
else:
|
@@ -406,13 +404,13 @@ def plot_hydro(nbElements:int, y, rain=[], x_title="Dates", y_titles=_("Discharg
|
|
406
404
|
if(addMeasfInTab):
|
407
405
|
summaryTab.append([])
|
408
406
|
i = len(summaryTab)-1
|
409
|
-
summaryTab[i].append(str(int(round((
|
410
|
-
indexMax = np.
|
407
|
+
summaryTab[i].append(str(int(round((np.nanmax(y1))))))
|
408
|
+
indexMax = np.nanargmax(y1)
|
411
409
|
timeMax = num2date(x_date_measure[indexMax])
|
412
410
|
# summaryTab[i].append(timeMax.strftime("%m/%d/%Y, %H:%M:%S"))
|
413
411
|
summaryTab[i].append(timeMax.strftime("%m/%d/%Y, %H:%M"))
|
414
412
|
if(allSurfaces!=[]):
|
415
|
-
summaryTab[i].append(np.
|
413
|
+
summaryTab[i].append(np.nansum(y1)*dtMeasure)
|
416
414
|
|
417
415
|
# Set the axis parameters
|
418
416
|
if(y_data_range==[]):
|
wolfhece/hydrology/read.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import numpy as np
|
2
2
|
import os
|
3
3
|
import logging
|
4
|
+
from datetime import datetime as date
|
5
|
+
from datetime import timezone
|
4
6
|
from struct import unpack, calcsize, unpack_from
|
5
7
|
|
6
8
|
|
@@ -145,7 +147,7 @@ def read_binary_file(path, fileName, format="", buffer_size=-1, init_offset=8):
|
|
145
147
|
if format == "":
|
146
148
|
# Classical format
|
147
149
|
format = "<bbhbbbd"
|
148
|
-
elif "<" in format:
|
150
|
+
elif "<" not in format:
|
149
151
|
logging.warning("Format should start with '<' if you are on Windows. If not, the file can be read wrongly!")
|
150
152
|
|
151
153
|
data_size = calcsize(format) # Size of one set of values
|
@@ -159,7 +161,7 @@ def read_binary_file(path, fileName, format="", buffer_size=-1, init_offset=8):
|
|
159
161
|
nbC = int.from_bytes(buffer[4:8], byteorder='little', signed=True)
|
160
162
|
# Check the compatibility between the format and the number of columns
|
161
163
|
nb_args = format.replace("<", "")
|
162
|
-
if nbC != nb_args:
|
164
|
+
if nbC != len(nb_args)-1:
|
163
165
|
logging.error("The number of column is not compatible with the number of element in format")
|
164
166
|
if buffer_size < 0:
|
165
167
|
buffer_size = nbL
|
@@ -218,14 +220,71 @@ def relative_2_absolute(fileName:str, prefix:str="", applyCWD:bool=True)-> tuple
|
|
218
220
|
if is_relative_path(fileName):
|
219
221
|
finalName = os.path.join(prefix, fileName)
|
220
222
|
else:
|
221
|
-
logging.warning("This path is not initially a relative path!")
|
222
|
-
|
223
|
+
# logging.warning("This path is not initially a relative path!")
|
223
224
|
info = 1
|
224
225
|
finalName = fileName
|
225
226
|
|
226
227
|
return info, finalName
|
227
228
|
|
228
229
|
|
230
|
+
def read_hydro_file(path:str, fileName:str, nbCol:int=6, nbCol_data:int=1) -> tuple[np.array, np.array]:
|
231
|
+
format_bin = "<bbhbbbd"
|
232
|
+
header_offset = 8
|
233
|
+
|
234
|
+
data = read_binary_file(path, fileName, format=format_bin, init_offset=header_offset)
|
235
|
+
data = np.array(data).astype("double")
|
236
|
+
time, value = parse_hydro_data(data)
|
237
|
+
|
238
|
+
return time, value
|
239
|
+
|
240
|
+
|
241
|
+
def parse_hydro_data(data:np.array)-> tuple[np.array, np.array]:
|
242
|
+
nbCol = 6
|
243
|
+
nbCol_data = 1
|
244
|
+
values = data[:, nbCol+nbCol_data-1]
|
245
|
+
|
246
|
+
# Create an array of datetime objects
|
247
|
+
date_objects = [
|
248
|
+
date(int(el[2]), int(el[1]), int(el[0]), int(el[3]), int(el[4]), int(el[5]), tzinfo=timezone.utc)
|
249
|
+
for el in data]
|
250
|
+
# Transform the datetime objects into timestamps
|
251
|
+
time = np.array([el.timestamp() for el in date_objects])
|
252
|
+
|
253
|
+
return time, values
|
254
|
+
|
255
|
+
|
256
|
+
def write_excel_from_dict(data:dict[str:dict[str:np.array]], path:str, fileName:str, time:np.array=None, summary:dict[str:np.array]={}):
|
257
|
+
import pandas as pd
|
258
|
+
|
259
|
+
writer = pd.ExcelWriter(os.path.join(path,fileName), engine = 'xlsxwriter')
|
260
|
+
|
261
|
+
for station,values in data.items():
|
262
|
+
# if the dictionary is empty, skip the station -> no creation of the sheet
|
263
|
+
if values == {}:
|
264
|
+
continue
|
265
|
+
|
266
|
+
excl_dict = {}
|
267
|
+
if time is not None:
|
268
|
+
excl_dict["Time [s]"] = time
|
269
|
+
excl_dict.update(values)
|
270
|
+
else:
|
271
|
+
excl_dict = values
|
272
|
+
curSheet = pd.DataFrame(excl_dict)
|
273
|
+
curSheet.to_excel(writer, sheet_name=station, index=False)
|
274
|
+
curSheet = writer.sheets[station]
|
275
|
+
curSheet.autofit()
|
276
|
+
|
277
|
+
# if the summary is empty, skip the summary -> no creation of the sheet
|
278
|
+
if summary != {}:
|
279
|
+
curSheet = pd.DataFrame(summary)
|
280
|
+
curSheet.to_excel(writer, sheet_name="Summary", index=False)
|
281
|
+
curSheet = writer.sheets["Summary"]
|
282
|
+
curSheet.autofit()
|
283
|
+
|
284
|
+
writer.close()
|
285
|
+
|
286
|
+
return
|
287
|
+
|
229
288
|
def check_path(fileName:str, prefix:str="", applyCWD:bool=True) -> tuple[bool, str] :
|
230
289
|
|
231
290
|
info, finalName = relative_2_absolute(fileName, prefix, applyCWD)
|
wolfhece/libs/WolfDll.dll
CHANGED
Binary file
|
wolfhece/libs/WolfDll_debug.dll
CHANGED
Binary file
|
wolfhece/pyGui1D.py
CHANGED
@@ -1919,6 +1919,18 @@ class GuiNotebook1D( wx.Frame):
|
|
1919
1919
|
def onclose(self, event: wx.Event):
|
1920
1920
|
self.close()
|
1921
1921
|
|
1922
|
+
def get_bathymetry(self):
|
1923
|
+
"""Return the bathymetry object
|
1924
|
+
from the notebook.
|
1925
|
+
|
1926
|
+
:return: bathymetry object
|
1927
|
+
:rtype: `WolfArray`
|
1928
|
+
"""
|
1929
|
+
try:
|
1930
|
+
return self.data[Constants.BATHYMETRY.value]
|
1931
|
+
except KeyError:
|
1932
|
+
return None
|
1933
|
+
|
1922
1934
|
# --- CREATION OF A SIMULATION ---
|
1923
1935
|
# ________________________________
|
1924
1936
|
|
@@ -1932,48 +1944,55 @@ class GuiNotebook1D( wx.Frame):
|
|
1932
1944
|
for whatever reasons.
|
1933
1945
|
"""
|
1934
1946
|
if self.test_required_data() == True:
|
1935
|
-
self.
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1947
|
+
if self.simulation_directory != '':
|
1948
|
+
logging.info(_("Creating the model... ... ...\
|
1949
|
+
\nPatience, you'll be notified whenever the model is ready."))
|
1950
|
+
# self.grid_parameters.saveme FIXME Param from GUI
|
1951
|
+
# FIXME Parallel value should not be mandatory in case only one vector exists.
|
1952
|
+
try:
|
1953
|
+
self.disable_button_save()
|
1954
|
+
# self.grid_parameters.Hide()
|
1955
|
+
simul = self.creator1D.write_simulation_files_from_crosssections(folder_path = self.simulation_directory,
|
1956
|
+
cross_sections = self.data[Constants.CROSS_SECTIONS.value],
|
1957
|
+
parallels = self.data[Constants.BED_AND_BANKS.value],
|
1958
|
+
banks= self.data[Constants.BED_AND_BANKS.value],
|
1959
|
+
boundary_conditions= self.get_boundary_conditions(),
|
1960
|
+
hydrographs=self.get_hydrographs(),
|
1961
|
+
roughness= self.get_frictions(),
|
1962
|
+
roughness_selection= self.get_agglomeration_mode(),
|
1963
|
+
roughness_option= self.get_roughness_option(),
|
1964
|
+
exe_file= self.get_folder_executable(),
|
1965
|
+
initial_depth= self.get_initial_water_depth(),
|
1966
|
+
topography= self.get_bathymetry(),
|
1967
|
+
initial_discharge= self.get_initial_discharge(),
|
1968
|
+
file_type_initial_cond= self.get_ic_file_format(),
|
1969
|
+
extrapolation_of_extremities= self.get_extrapolation_of_extremities(),
|
1970
|
+
wetdry= self.get_computation_mode(),
|
1971
|
+
steady= self.get_steadiness_mode(),
|
1972
|
+
writing_type_infiltration= self.get_infiltration_preprocess(),
|
1973
|
+
epsilon_infiltration= self.get_epsilon(),
|
1974
|
+
executable_type= self.get_executable(),
|
1975
|
+
run_simulation= 'no',
|
1976
|
+
simulation_name= self.simulation_name,
|
1977
|
+
new_directory= self.simulation_directory
|
1978
|
+
)
|
1979
|
+
logging.info(_("The model was successfully created."))
|
1980
|
+
self.grid_parameters.save_automatically_to_file()
|
1981
|
+
self.param_exists == False
|
1982
|
+
self.enable_button_parameters()
|
1983
|
+
self.grid_parameters.Destroy()
|
1984
|
+
if self.get_run_command() == 'yes':
|
1985
|
+
try:
|
1986
|
+
self.creator1D.run_bat_files(os.path.join(simul[0], f'{simul[1]}.bat'))
|
1987
|
+
except:
|
1988
|
+
try:
|
1989
|
+
batch_file = self.creator1D.find_file_from_extension(self.simulation_directory, '.bat')
|
1990
|
+
except:
|
1991
|
+
logging.info(f"The batch file was not found.\n The {self.simulation_name} was not run.")
|
1992
|
+
|
1993
|
+
except:
|
1994
|
+
self.enable_button_parameters()
|
1995
|
+
raise Exception(logging.info("The simulation not saved due to an error."))
|
1977
1996
|
# self.disable_button_save()
|
1978
1997
|
|
1979
1998
|
# --- DEPRECIATING METHODS ---
|
@@ -2060,6 +2079,59 @@ class GuiNotebook1D( wx.Frame):
|
|
2060
2079
|
new_directory= self.simulation_directory
|
2061
2080
|
)
|
2062
2081
|
|
2082
|
+
def __button_save_clicked(self, event: wx.Event):
|
2083
|
+
"""Gather all the inputs in the notebook
|
2084
|
+
and generate a 1D model (simulation).
|
2085
|
+
|
2086
|
+
:param event: wx.EVT_BUTTON
|
2087
|
+
:type event: wx.Event
|
2088
|
+
:raises Exception: In case, the model fails to create the simulation
|
2089
|
+
for whatever reasons.
|
2090
|
+
"""
|
2091
|
+
if self.test_required_data() == True:
|
2092
|
+
self.grid_parameters.save_automatically_to_file()
|
2093
|
+
|
2094
|
+
if self.simulation_directory != '':
|
2095
|
+
logging.info(_("Creating the model... ... ...\
|
2096
|
+
\nPatience, you'll be notified whenever the model is ready."))
|
2097
|
+
# self.grid_parameters.saveme FIXME Param from GUI
|
2098
|
+
# FIXME Parallel value should not be mandatory in case only one vector exists.
|
2099
|
+
try:
|
2100
|
+
self.disable_button_save()
|
2101
|
+
# self.grid_parameters.Hide()
|
2102
|
+
self.creator1D.write_simulation_files_from_crosssections(folder_path = self.simulation_directory,
|
2103
|
+
cross_sections = self.data[Constants.CROSS_SECTIONS.value],
|
2104
|
+
parallels = self.data[Constants.BED_AND_BANKS.value],
|
2105
|
+
banks= self.data[Constants.BED_AND_BANKS.value],
|
2106
|
+
boundary_conditions= self.get_boundary_conditions(),
|
2107
|
+
hydrographs=self.get_hydrographs(),
|
2108
|
+
roughness= self.get_frictions(),
|
2109
|
+
roughness_selection= self.get_agglomeration_mode(),
|
2110
|
+
roughness_option= self.get_roughness_option(),
|
2111
|
+
exe_file= self.get_folder_executable(),
|
2112
|
+
initial_depth= self.get_initial_water_depth(),
|
2113
|
+
topography= self.data[Constants.BATHYMETRY.value],
|
2114
|
+
initial_discharge= self.get_initial_discharge(),
|
2115
|
+
file_type_initial_cond= self.get_ic_file_format(),
|
2116
|
+
extrapolation_of_extremities= self.get_extrapolation_of_extremities(),
|
2117
|
+
wetdry= self.get_computation_mode(),
|
2118
|
+
steady= self.get_steadiness_mode(),
|
2119
|
+
writing_type_infiltration= self.get_infiltration_preprocess(),
|
2120
|
+
epsilon_infiltration= self.get_epsilon(),
|
2121
|
+
executable_type= self.get_executable(),
|
2122
|
+
run_simulation= self.get_run_command(),
|
2123
|
+
simulation_name= self.simulation_name,
|
2124
|
+
new_directory= self.simulation_directory
|
2125
|
+
)
|
2126
|
+
logging.info(_("The model was successfully created."))
|
2127
|
+
self.grid_parameters.Destroy()
|
2128
|
+
self.param_exists == False
|
2129
|
+
self.enable_button_parameters()
|
2130
|
+
|
2131
|
+
except:
|
2132
|
+
self.enable_button_parameters()
|
2133
|
+
raise Exception(logging.info("The simulation not saved due to an error."))
|
2134
|
+
|
2063
2135
|
def __add_bed_and_banks(self, event: pg.EVT_PG_DOUBLE_CLICK):
|
2064
2136
|
"""
|
2065
2137
|
Add or change the river and bank data.
|
@@ -48,7 +48,7 @@ def check_file_update(fichier_py:Path):
|
|
48
48
|
sys.path.pop(0)
|
49
49
|
except:
|
50
50
|
logging.error(f'Le fichier {fichier_py} ne peut pas être importé. Prière de vérifier que l\'encodage est bien en UTF-8 ou supprimer tous les commentaires avec des accents !')
|
51
|
-
logging.error(f'The file {fichier_py} can not be
|
51
|
+
logging.error(f'The file {fichier_py} can not be imported. Please check if the file is encoded in UTF-8 or remove any accentuated character!')
|
52
52
|
return False
|
53
53
|
|
54
54
|
# Récupérer la classe parente et la classe dérivée à partir du module
|