wolfhece 2.1.99__py3-none-any.whl → 2.1.101__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.
Files changed (35) hide show
  1. wolfhece/PyDraw.py +220 -29
  2. wolfhece/PyGui.py +1039 -53
  3. wolfhece/PyVertexvectors.py +2 -2
  4. wolfhece/Results2DGPU.py +37 -13
  5. wolfhece/acceptability/Parallels.py +2 -2
  6. wolfhece/acceptability/_add_path.py +23 -0
  7. wolfhece/acceptability/acceptability.py +594 -563
  8. wolfhece/acceptability/acceptability_gui.py +564 -331
  9. wolfhece/acceptability/cli.py +307 -120
  10. wolfhece/acceptability/func.py +1754 -1597
  11. wolfhece/apps/version.py +1 -1
  12. wolfhece/bernoulli/losses.py +76 -23
  13. wolfhece/bernoulli/losses_jax.py +143 -0
  14. wolfhece/bernoulli/pipe.py +7 -2
  15. wolfhece/gpuview.py +4 -1
  16. wolfhece/libs/__init__.py +11 -10
  17. wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
  18. wolfhece/math_parser/__init__.py +4 -4
  19. wolfhece/math_parser/calculator.py +51 -9
  20. wolfhece/mesh2d/bc_manager.py +25 -2
  21. wolfhece/mesh2d/gpu_2d.py +644 -0
  22. wolfhece/mesh2d/simple_2d.py +2817 -0
  23. wolfhece/mesh2d/wolf2dprev.py +5 -2
  24. wolfhece/pidcontroller.py +131 -0
  25. wolfhece/pywalous.py +7 -7
  26. wolfhece/scenario/config_manager.py +98 -21
  27. wolfhece/wolf_array.py +391 -176
  28. wolfhece/wolf_vrt.py +108 -7
  29. wolfhece/wolfresults_2D.py +113 -6
  30. wolfhece/xyz_file.py +91 -51
  31. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/METADATA +3 -1
  32. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/RECORD +35 -30
  33. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/WHEEL +1 -1
  34. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/entry_points.txt +0 -0
  35. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/top_level.txt +0 -0
@@ -11,56 +11,300 @@ copying or distribution of this file, via any medium, is strictly prohibited.
11
11
  """
12
12
  The command-line interface for the acceptability
13
13
  """
14
+
14
15
  import argparse
15
- from .acceptability import Base_data_creation, Vulnerability, Acceptability, Accept_Manager
16
+ from wolfhece.acceptability.acceptability import Base_data_creation, Vulnerability, Acceptability, Accept_Manager
16
17
 
17
18
  def main():
19
+ """
20
+ This function sets up the command line argument parser, defines the
21
+ available subcommands for the model operations (allowing efficient "-h"),
22
+ to help the user.
23
+
24
+ Subcommands:
25
+ - check: Perform checks on the model's data.
26
+ - base_data_creation: Create base data for the model.
27
+ - vulnerability: Assess vulnerability within the model.
28
+ - acceptability: Evaluate the acceptability of the model's output.
29
+
30
+ Usage:
31
+ python cli.py <subcommand> [options]
18
32
 
33
+ Options:
34
+ -h, --help: Show this help message and exit.
35
+ """
36
+
37
+
38
+ print("\n=================Command Line Interface for Acceptability routine=================\n")
19
39
  parser = argparse.ArgumentParser(
20
- description="A tool to obtain vulnerability and acceptability for regions in Walloon Region and particularly in Vesdre valley.")
40
+ description="A tool to obtain vulnerability and acceptability for regions in Walloon Region and particularly in Vesdre valley."
41
+ )
21
42
 
22
- parser.add_argument("function",
23
- nargs="?",
24
- choices=['base_data_creation', 'vulnerability', 'acceptability', 'check'],
25
- default='acceptability',
26
- )
27
- args:argparse.Namespace
28
- args, sub_args = parser.parse_known_args()
43
+ subparsers = parser.add_subparsers(dest='function', required=True)
29
44
 
30
- if args.function == "check":
45
+ """
46
+ Informations for the subcommand "check"
47
+
48
+ Options:
49
+ --dir (str, optional): Path to the main directory containing all folders, setting the location for inputs and outputs. Default is 'Data'.
50
+ --GDB (str, optional): Name of the main GDB file, such as GT_Resilence_dataRisques202010.gdb. Default is 'GT_Resilence_dataRisques202010.gdb'.
51
+ --CaPa (str, optional): Name of the Cadaster geopackage, e.g., 'Cadastre_Walloon.gpkg'. Default is 'Cadastre_Walloon.gpkg'.
52
+ --PICC (str, optional): Name of the PICC GDB file, e.g., 'PICC_vDIFF.gdb'. Default is 'PICC_vDIFF.gdb'.
53
+ --CE (str, optional): Name of the river extent file from IGN, such as 'CE_IGN_top10v.shp'. Default is 'CE_IGN_TOP10V/CE_IGN_TOP10V.shp'.
54
+ --scenario (str, optional): Scenario name. Default is 'Scenario1'.
55
+ --study_area (str, optional): Area of interest, such as 'Theux', 'Chaudfontaine', 'Eupen', etc. Default is 'Bassin_Vesdre'.
56
+
57
+ Usage example:
58
+ python cli.py check --dir C:\example --GDB GT_Resilence_dataRisques202010.gdb --scenario Scenario_example
59
+ """
60
+
61
+ subparser_check = subparsers.add_parser('check', help='Check the status and process data.')
62
+ subparser_check.add_argument("--dir",
63
+ type=str,
64
+ nargs='?',
65
+ default='Data',
66
+ help="Add path to the main directory with all folders. This sets the path of all outputs and inputs.")
67
+
68
+ subparser_check.add_argument("--GDB",
69
+ type=str,
70
+ nargs='?',
71
+ default='GT_Resilence_dataRisques202010.gdb',
72
+ help="Add the name of the main gdb like GT_Resilence_dataRisques202010.gdb.")
73
+
74
+ subparser_check.add_argument("--CaPa",
75
+ type=str,
76
+ nargs='?',
77
+ default='Cadastre_Walloon.gpkg',
78
+ help="Add the name of the Cadaster geopackage, like Cadastre_Walloon.gpkg.")
79
+
80
+ subparser_check.add_argument("--PICC",
81
+ type=str,
82
+ nargs='?',
83
+ default='PICC_vDIFF.gdb',
84
+ help="Add the name of the PICC gdb, like PICC_vDIFF.gdb.")
85
+
86
+ subparser_check.add_argument("--CE",
87
+ type=str,
88
+ nargs='?',
89
+ default='CE_IGN_TOP10V/CE_IGN_TOP10V.shp',
90
+ help="Add the name of the river extent from IGN, like CE_IGN_top10v.shp.")
91
+
92
+ subparser_check.add_argument("--scenario",
93
+ type=str,
94
+ nargs='?',
95
+ default='Scenario1',
96
+ help="Scenario name.")
97
+
98
+ subparser_check.add_argument("--study_area",
99
+ type=str,
100
+ nargs='?',
101
+ default='Bassin_Vesdre',
102
+ help="Add the area of interest, like Theux, Chaufontaine, Eupen, etc.")
31
103
 
32
- parser.add_argument("dir",
33
- type=str,
34
- help="Add path to the main directory with all folders. This sets the path of all outputs and inputs",
35
- default='Data')
36
- parser.add_argument("GDB",
37
- type=str,
38
- help="Add the name of the main gdb like GT_Resilence_dataRisques202010.gdb",
39
- default='GT_Resilence_dataRisques202010.gdb')
40
- parser.add_argument("CaPa",
41
- type=str,
42
- help="Add the name of the Cadaster geopackage, like Cadastre_Walloon.gpkg",
43
- default='Cadastre_Walloon.gpkg')
44
- parser.add_argument("PICC",
45
- type=str,
46
- help="Add the name of the PICC gdb, like PICC_vDIFF.gdb",
47
- default='PICC_vDIFF.gdb')
48
- parser.add_argument("CE",
49
- type=str,
50
- help="Add the name of the river extent from IGN, like CE_IGN_top10v.shp",
51
- default='CE_IGN_TOP10V/CE_IGN_TOP10V.shp')
52
-
53
- parser.add_argument("scenario",
54
- type=str,
55
- help="scenario name",
56
- default='Scenario1')
57
- parser.add_argument("study_area",
58
- type=str,
59
- help="Add the area of interest, like Theux, Chaufontaine, Eupen, etc.",
60
- default='Bassin_Vesdre')
61
-
62
- args = parser.parse_args()
104
+ """
105
+ Informations for the subcommand "base_data_creation"
106
+
107
+ Options:
108
+ --dir (str, optional): Path to the main directory containing all folders, setting the location for inputs and outputs. Default is 'Data'.
109
+ --GDB (str, optional): Name of the main GDB file. Default is 'GT_Resilence_dataRisques202010.gdb'.
110
+ --study_area (str, optional): Name of the study area shapefile, such as 'Bassin_Vesdre.shp'. Default is 'Bassin_Vesdre.shp'.
111
+ --CaPa (str, optional): Name of the Cadaster geopackage, e.g., 'Cadastre_Walloon.gpkg'. Default is 'Cadastre_Walloon.gpkg'.
112
+ --PICC (str, optional): Name of the PICC GDB file, e.g., 'PICC_vDIFF.gdb'. Default is 'PICC_vDIFF.gdb'.
113
+ --CE (str, optional): Name of the river extent file from IGN, e.g., 'CE_IGN_TOP10V/CE_IGN_TOP10V.shp'. Default is 'CE_IGN_TOP10V/CE_IGN_TOP10V.shp'.
114
+ --resolution (float, optional): Resolution of the water depth files in meters. Default is 1.0.
115
+ --number_procs (int, optional): Number of processors to use. Default is 1.
116
+ --steps (int, optional, multiple): Step(s) to perform, specified as a space-separated list, e.g., '--steps 5 6 7'. Default is [1,2,3,4,5,6,7].
117
+ --Vuln_csv (str, optional): Path to the .csv file for the weights. Default is 'Vulnerability.csv'.
118
+ """
119
+ subparser_base = subparsers.add_parser('base_data_creation', help='Create the base data needed for the vulnerability and acceptability rasters.')
120
+
121
+ subparser_base.add_argument("--dir",
122
+ type=str,
123
+ nargs='?',
124
+ default='Data',
125
+ help="Add path to the main directory with all folders. This sets the path of all outputs and inputs. Defaults to Data.")
126
+
127
+ subparser_base.add_argument("--GDB",
128
+ type=str,
129
+ nargs='?',
130
+ default='GT_Resilence_dataRisques202010.gdb',
131
+ help="Add the name of the main gdb. Defaults to GT_Resilence_dataRisques202010.gdb.")
132
+
133
+ subparser_base.add_argument("--study_area",
134
+ type=str,
135
+ nargs='?',
136
+ default='Bassin_Vesdre.shp',
137
+ help="Add the name of the study area shapefile, Vesdre Valley like Bassin_SA.shp. Defaults to Bassin_Vesdre.shp.")
138
+
139
+ subparser_base.add_argument("--CaPa",
140
+ type=str,
141
+ nargs='?',
142
+ default='Cadastre_Walloon.gpkg',
143
+ help="Add the name of the Cadaster geopackage. Defaults to Cadastre_Walloon.gpkg.")
144
+
145
+ subparser_base.add_argument("--PICC",
146
+ type=str,
147
+ nargs='?',
148
+ default='PICC_vDIFF.gdb',
149
+ help="Add the name of the PICC gdb. Defaults to PICC_vDIFF.gdb.")
150
+
151
+ subparser_base.add_argument("--CE",
152
+ type=str,
153
+ nargs='?',
154
+ default='CE_IGN_TOP10V/CE_IGN_TOP10V.shp',
155
+ help="Add the name of the river extent from IGN. Defaults to CE_IGN_TOP10V/CE_IGN_TOP10V.shp.")
156
+
157
+ subparser_base.add_argument("--resolution",
158
+ type=float,
159
+ nargs='?',
160
+ default=1.0,
161
+ help="Add the resolution of water_depth files. Defaults to 1.0m.")
162
+
163
+ subparser_base.add_argument("--number_procs",
164
+ type=int,
165
+ nargs='?',
166
+ default=1,
167
+ help="Add the number of processors to use. Defaults to 1.")
168
+
169
+ subparser_base.add_argument("--steps",
170
+ type=int,
171
+ nargs='*',
172
+ default= [1,2,3,4,5,6,7],
173
+ help="Add the particular step(s) to perform, e.g '--steps 5 6 7'. Defaults to [1,2,3,4,5,6,7]")
174
+
175
+ subparser_base.add_argument("--Vuln_csv",
176
+ type=str,
177
+ nargs='?',
178
+ default='Vulnerability.csv',
179
+ help="Add the particular .csv file for the weights. Defaults to Vulnerability.csv")
180
+
181
+
63
182
 
183
+ """
184
+ Informations for the subcommand "vulnerability"
185
+
186
+ Options:
187
+ --dir (str, optional): Path to the main directory containing all folders, setting the location for inputs and outputs. Default is 'Data'.
188
+ --scenario (str, optional): Name of the scenario. Default is 'Scenario1'.
189
+ --study_area (str, optional): Area of interest, such as 'Theux', 'Chaudfontaine', 'Eupen', etc. Default is 'Bassin_Vesdre'.
190
+ --resolution (float, optional): Resolution for the vulnerability raster in meters. Default is 1.0.
191
+ --steps (int, optional, multiple): Step(s) to perform, specified as a space-separated list, e.g., '--steps 2 3 4'. Default is [1,10,11,2,3].
192
+ --Vuln_csv (str, optional): Path to the .csv file for vulnerability layers. Default is 'Vulnerability.csv'.
193
+ --Intermediate_csv (str, optional): Path to the .csv file for acceptability functions (scoring layers based on water depth). Default is 'Intermediate.csv'.
194
+
195
+ Usage example :
196
+ python cli.py vulnerability --scenario Scenario_example --study_area Bassin_Vesdre --dir C:\example --steps 1 10 11
197
+ """
198
+ subparser_vulnerability = subparsers.add_parser('vulnerability', help='Compute the total vulnerability raster.')
199
+
200
+ subparser_vulnerability.add_argument("--dir",
201
+ type=str,
202
+ nargs='?',
203
+ default='Data',
204
+ help="Add path to the main directory with all folders. This sets the path of all outputs and inputs.")
205
+
206
+ subparser_vulnerability.add_argument("--scenario",
207
+ type=str,
208
+ nargs='?',
209
+ default='Scenario1',
210
+ help="Scenario name.")
211
+
212
+ subparser_vulnerability.add_argument("--study_area",
213
+ type=str,
214
+ nargs='?',
215
+ default='Bassin_Vesdre',
216
+ help="Add the area of interest, like Theux, Chaufontaine, Eupen, etc.")
217
+
218
+ subparser_vulnerability.add_argument("--resolution",
219
+ type=float,
220
+ nargs='?',
221
+ default=1.0,
222
+ help="Add the resolution for the vulnerability raster. Defaults to 1.0.")
223
+
224
+ subparser_vulnerability.add_argument("--steps",
225
+ type=int,
226
+ nargs='*',
227
+ default=[1,10,11,2,3],
228
+ help="Add the particular step(s) to perform, e.g '2 3 4'. Defaults to [1,10,11,2,3]")
229
+
230
+ subparser_vulnerability.add_argument("--Vuln_csv",
231
+ type=str,
232
+ nargs='?',
233
+ default='Vulnerability.csv',
234
+ help="Add the .csv file for the vulenrability layers. Defaults to Vulnerability.csv.")
235
+
236
+ subparser_vulnerability.add_argument("--Intermediate_csv",
237
+ type=str,
238
+ nargs='?',
239
+ default='Intermediate.csv',
240
+ help="Add the .csv file for the acceptability functions (for each layers, acceptability scores in fct of the water depths). Defaults to Intermediate.csv.")
241
+
242
+ """
243
+ Informations for the subcommand "acceptability"
244
+
245
+ Options:
246
+ --dir (str, optional): Path to the main directory with all folders, setting the location for inputs and outputs. Default is 'Data'.
247
+ --study_area (str, optional): Name of the area of interest. Default is 'Bassin_Vesdre'.
248
+ --scenario (str, optional): Name of the scenario to use. Default is 'Scenario1'.
249
+ --coeff_auto (bool, optional): Indicates if weighting coefficients should be re-computed automatically. Default is True.
250
+ --Ponderation_csv (str, optional): Path to the .csv file from which weighting coefficients are read. Default is 'Ponderation.csv'.
251
+ --resample_size (int, optional): Resolution at which the final raster will be aggregated, in meters. Default is 100m.
252
+ --steps (int, optional, multiple): Specific step(s) to execute, given as a space-separated list, e.g., '--steps 2 3 4'. Default is [1,2,3,4,5].
253
+
254
+ Usage example :
255
+ python cli.py acceptability --scenario Scenario_example --study_area Bassin_Vesdre --dir C:\Example --steps 1 10 11
256
+ """
257
+ subparser_acceptability = subparsers.add_parser('acceptability', help='Compute the acceptability rasters.')
258
+
259
+ subparser_acceptability.add_argument("--dir",
260
+ type=str,
261
+ nargs='?',
262
+ default='Data',
263
+ help="Add path to the main directory with all folders. This sets the path of all outputs and inputs.")
264
+
265
+ subparser_acceptability.add_argument("--study_area",
266
+ type=str,
267
+ nargs='?',
268
+ default='Bassin_Vesdre',
269
+ help="Add the name of area. Defaults to Bassin_Vesdre.")
270
+
271
+ subparser_acceptability.add_argument("--scenario",
272
+ type=str,
273
+ nargs='?',
274
+ default='Scenario1',
275
+ help="Add the name of the scenario. Default to Scenario1.")
276
+
277
+
278
+ subparser_acceptability.add_argument("--coeff_auto",
279
+ type=bool,
280
+ nargs='?',
281
+ default=True,
282
+ help="Decide if the weighting coefficients are re-computed. Defaults to True.")
283
+
284
+ subparser_acceptability.add_argument("--Ponderation_csv",
285
+ type=str,
286
+ nargs='?',
287
+ default='Ponderation.csv',
288
+ help="Add the .csv file where the weighting coefficients are read. Defaults to Ponderation.csv.")
289
+
290
+ subparser_acceptability.add_argument("--resample_size",
291
+ type=int,
292
+ nargs='?',
293
+ default=100,
294
+ help="Add the resolution at which the final raster will be agglomerate. Defaults to 100m.")
295
+
296
+ subparser_acceptability.add_argument("--steps",
297
+ type=int,
298
+ nargs='*',
299
+ default=[1,2,3,4,5],
300
+ help="Add the particular step(s) to perform, e.g '2 3 4'. Defaults to [1,2,3,4,5]")
301
+
302
+ args = parser.parse_args()
303
+
304
+ """
305
+ Starting the computations themselves if the function is ordered.
306
+ """
307
+ if args.function == "check":
64
308
  manager = Accept_Manager(main_dir=args.dir,
65
309
  Study_area=args.study_area,
66
310
  scenario=args.scenario,
@@ -69,92 +313,35 @@ def main():
69
313
  PICC_Walloon=args.PICC,
70
314
  CE_IGN_top10v=args.CE)
71
315
 
72
-
73
316
  elif args.function == "base_data_creation":
74
-
75
- parser.add_argument("dir",
76
- type=str,
77
- help="Add path to the main directory with all folders. This sets the path of all outputs and inputs",
78
- default='Data')
79
- parser.add_argument("GDB",
80
- type=str,
81
- help="Add the name of the main gdb like GT_Resilence_dataRisques202010.gdb",
82
- default='GT_Resilence_dataRisques202010.gdb')
83
- parser.add_argument("study_area",
84
- type=str,
85
- help="Add the name of the study area shapefile, Vesdre Valley like Bassin_SA.shp",
86
- default='Bassin_Vesdre.shp')
87
- parser.add_argument("CaPa",
88
- type=str,
89
- help="Add the name of the Cadaster geopackage, like Cadastre_Walloon.gpkg",
90
- default='Cadastre_Walloon.gpkg')
91
- parser.add_argument("PICC",
92
- type=str,
93
- help="Add the name of the PICC gdb, like PICC_vDIFF.gdb",
94
- default='PICC_vDIFF.gdb')
95
- parser.add_argument("CE",
96
- type=str,
97
- help="Add the name of the river extent from IGN, like CE_IGN_top10v.shp",
98
- default='CE_IGN_TOP10V/CE_IGN_TOP10V.shp')
99
- parser.add_argument("resolution",
100
- type=float,
101
- help="Add the resolution of water_depth files. If water_depth files have resolution 1 meter, you can put it as 1",
102
- default=1.)
103
- parser.add_argument("number_procs",
104
- type=int,
105
- help="Add the number of processors to use",
106
- default=1)
107
- args = parser.parse_args()
108
-
109
317
  Base_data_creation(main_dir=args.dir,
110
- Original_gdb=args.GDB,
111
- Study_area=args.study_area,
112
- CaPa_Walloon=args.CaPa,
113
- PICC_Walloon=args.PICC,
114
- CE_IGN_top10v=args.CE,
115
- resolution=args.resolution,
116
- number_procs=args.number_procs)
117
-
318
+ Original_gdb=args.GDB,
319
+ Study_area=args.study_area,
320
+ CaPa_Walloon=args.CaPa,
321
+ PICC_Walloon=args.PICC,
322
+ CE_IGN_top10v=args.CE,
323
+ resolution=args.resolution,
324
+ number_procs=args.number_procs,
325
+ steps=args.steps,
326
+ Vuln_csv=args.Vuln_csv)
327
+
118
328
  elif args.function == "vulnerability":
119
-
120
- parser.add_argument("dir",
121
- type=str,
122
- help="Add path to the main directory with all folders.This sets the path of all outputs and inputs",
123
- default='Data')
124
- parser.add_argument("scenario",
125
- type=str,
126
- help="scenario name",
127
- default='Scenario1')
128
- parser.add_argument("study_area",
129
- type=str,
130
- help="Add the area of interest, like Theux, Chaufontaine, Eupen, etc.",
131
- default='Bassin_Vesdre')
132
- args = parser.parse_args()
133
-
134
329
  Vulnerability(main_dir=args.dir,
135
330
  scenario=args.scenario,
136
- Study_area=args.study_area)
331
+ Study_area=args.study_area,
332
+ resolution=args.resolution,
333
+ steps=args.steps,
334
+ Vuln_csv=args.Vuln_csv,
335
+ Intermediate_csv=args.Intermediate_csv)
137
336
 
138
337
  elif args.function == "acceptability":
139
-
140
- parser.add_argument("dir",
141
- type=str,
142
- help="Add path to the main directory with all folders.This sets the path of all outputs and inputs",
143
- default='Data')
144
- parser.add_argument("study_area",
145
- type=str,
146
- help="Add the name of area, like Theux, Chaudfontaine, Eupen, etc.",
147
- default='Bassin_Vesdre')
148
- parser.add_argument("scenario",
149
- type=str,
150
- help="Scenario number",
151
- default='Scenario1')
152
-
153
- args = parser.parse_args()
154
-
155
338
  Acceptability(main_dir=args.dir,
156
339
  scenario=args.scenario,
157
- Study_area=args.study_area)
158
-
340
+ Study_area=args.study_area,
341
+ coeff_auto=args.coeff_auto,
342
+ Ponderation_csv=args.Ponderation_csv,
343
+ resample_size=args.resample_size,
344
+ steps=args.steps)
345
+
159
346
  if __name__ == '__main__':
160
- main()
347
+ main()