wolfhece 2.1.120__py3-none-any.whl → 2.1.121__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 +4 -3
- wolfhece/acceptability/acceptability.py +17 -13
- wolfhece/acceptability/acceptability_gui.py +517 -526
- wolfhece/acceptability/func.py +46 -58
- wolfhece/apps/version.py +1 -1
- wolfhece/wolfresults_2D.py +9 -6
- {wolfhece-2.1.120.dist-info → wolfhece-2.1.121.dist-info}/METADATA +1 -1
- {wolfhece-2.1.120.dist-info → wolfhece-2.1.121.dist-info}/RECORD +11 -11
- {wolfhece-2.1.120.dist-info → wolfhece-2.1.121.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.120.dist-info → wolfhece-2.1.121.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.120.dist-info → wolfhece-2.1.121.dist-info}/top_level.txt +0 -0
wolfhece/acceptability/func.py
CHANGED
@@ -152,7 +152,7 @@ class Accept_Manager():
|
|
152
152
|
|
153
153
|
def __init__(self,
|
154
154
|
main_dir:str = 'Data',
|
155
|
-
Study_area
|
155
|
+
Study_area = None,
|
156
156
|
scenario = None,
|
157
157
|
Original_gdb:str = 'GT_Resilence_dataRisques202010.gdb',
|
158
158
|
CaPa_Walloon:str = 'Cadastre_Walloon.gpkg',
|
@@ -171,9 +171,7 @@ class Accept_Manager():
|
|
171
171
|
# If it is a string, concatenate it with the current directory
|
172
172
|
if not self.main_dir.is_absolute():
|
173
173
|
self.main_dir = Path(os.getcwd()) / self.main_dir
|
174
|
-
|
175
|
-
self._study_area = str(Study_area)
|
176
|
-
|
174
|
+
self._study_area = Study_area
|
177
175
|
if Study_area is not None:
|
178
176
|
if not str(self._study_area).endswith('.shp'):
|
179
177
|
self._study_area += '.shp'
|
@@ -391,7 +389,7 @@ class Accept_Manager():
|
|
391
389
|
self._study_area = None
|
392
390
|
self._scenario = None
|
393
391
|
else:
|
394
|
-
if Study_area in self.get_list_studyareas(with_suffix=True):
|
392
|
+
if Study_area in self.get_list_studyareas(with_suffix=True) or Study_area+".shp" in self.get_list_studyareas(with_suffix=True):
|
395
393
|
self._study_area = Path(Study_area)
|
396
394
|
else:
|
397
395
|
logging.error("The study area does not exist in the study area directory")
|
@@ -474,18 +472,17 @@ class Accept_Manager():
|
|
474
472
|
sims = self.get_sims_files_for_scenario()
|
475
473
|
|
476
474
|
if len(sims)==0:
|
477
|
-
logging.info("No simulations found
|
475
|
+
logging.info("No simulations found at this stage")
|
478
476
|
return None
|
479
477
|
|
480
478
|
if "_h.tif" in sims[0].name:
|
481
479
|
for cursim in sims:
|
482
|
-
if cursim.stem.find("_T{}_".format(return_period)) != -1:
|
480
|
+
if cursim.stem.find("_T{}_".format(return_period)) != -1 or cursim.stem.find("_Q{}_".format(return_period)) != -1:
|
483
481
|
return cursim
|
484
482
|
else:
|
485
483
|
for cursim in sims:
|
486
|
-
if cursim.stem.find("T{}".format(return_period)) != -1:
|
484
|
+
if cursim.stem.find("T{}".format(return_period)) != -1 or cursim.stem.find("Q{}".format(return_period)) != -1:
|
487
485
|
return cursim
|
488
|
-
|
489
486
|
return None
|
490
487
|
|
491
488
|
def get_types_in_file(self, file:str) -> list[str]:
|
@@ -560,44 +557,36 @@ class Accept_Manager():
|
|
560
557
|
|
561
558
|
# List files in directory
|
562
559
|
sims = self.get_sims_files_for_scenario()
|
563
|
-
|
560
|
+
sims_modif = [
|
561
|
+
os.path.join(os.path.dirname(path), os.path.basename(path).replace("Q", "T"))
|
562
|
+
for path in sims
|
563
|
+
]
|
564
|
+
|
564
565
|
if len(sims)==0:
|
565
|
-
logging.info("No simulations found
|
566
|
+
logging.info("No simulations found at this stage.")
|
566
567
|
return []
|
567
568
|
|
568
|
-
#
|
569
|
-
#
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
idx_T = [cursim.name.find("_T") for cursim in sims]
|
576
|
-
idx_h = [cursim.name.find("_h.tif") for cursim in sims]
|
577
|
-
|
578
|
-
assert len(idx_T) == len(idx_h), "The number of T and h are not the same"
|
579
|
-
for curT, curh in zip(idx_T, idx_h):
|
580
|
-
assert curT != -1, "The T is not found"
|
581
|
-
assert curh != -1, "The h is not found"
|
582
|
-
assert curh > curT, "The h is before the T"
|
583
|
-
|
584
|
-
# Create the list of return periods -- only the numeric part
|
585
|
-
sims = [int(cursim.name[idx_T[i]+2:idx_h[i]]) for i, cursim in enumerate(sims)]
|
586
|
-
else:
|
587
|
-
# searching for the position of the return period in the name
|
588
|
-
idx_T = [cursim.name.find("T") for cursim in sims]
|
589
|
-
idx_h = [cursim.name.find(".tif") for cursim in sims]
|
590
|
-
|
591
|
-
assert len(idx_T) == len(idx_h), "The number of T and h are not the same"
|
592
|
-
for curT, curh in zip(idx_T, idx_h):
|
593
|
-
assert curT != -1, "The T is not found"
|
594
|
-
assert curh != -1, "The h is not found"
|
595
|
-
assert curh > curT, "The h is before the T"
|
596
|
-
|
597
|
-
# create the list of return periods -- only the numeric part
|
598
|
-
sims = [int(cursim.name[idx_T[i]+1:idx_h[i]]) for i, cursim in enumerate(sims)]
|
599
|
-
|
569
|
+
# - Return periods are named as T2.tif, T5.tif, T10.tif, ... or with Q instead of T
|
570
|
+
# searching for the position of the return period in the name
|
571
|
+
idx_T = [Path(cursim).name.find("T") for cursim in sims_modif]
|
572
|
+
idx_h = [Path(cursim).name.find(".tif") for cursim in sims_modif]
|
573
|
+
|
574
|
+
# create the list of return periods -- only the numeric part
|
575
|
+
sims = [int(Path(cursim).name[idx_T[i]+1:idx_h[i]]) for i, cursim in enumerate(sims_modif)]
|
600
576
|
return sorted(sims)
|
577
|
+
|
578
|
+
def get_modifiedrasters(self):
|
579
|
+
folder = Path(self.IN_CH_SA_SC)
|
580
|
+
vuln_tiff_files = [str(file.name) for file in folder.rglob("*.tiff") if file.name.startswith('vuln_')]
|
581
|
+
vuln_tif_files = [str(file.name)for file in folder.rglob("*.tif") if file.name.startswith('vuln_')]
|
582
|
+
vuln_files = vuln_tiff_files + vuln_tif_files
|
583
|
+
|
584
|
+
folder = Path(self.IN_CH_SA_SC)
|
585
|
+
mnt_tiff_files = [str(file.name) for file in folder.rglob("*.tiff") if file.name.startswith('MNTmodifs_')]
|
586
|
+
mnt_tif_files = [str(file.name) for file in folder.rglob("*.tif") if file.name.startswith('MNTmodifs_')]
|
587
|
+
mnt_files = mnt_tiff_files + mnt_tif_files
|
588
|
+
|
589
|
+
return vuln_files + mnt_files
|
601
590
|
|
602
591
|
def get_ponderations(self) -> pd.DataFrame:
|
603
592
|
""" Get the ponderation data from available simulations """
|
@@ -605,11 +594,11 @@ class Accept_Manager():
|
|
605
594
|
rt = self.get_return_periods()
|
606
595
|
|
607
596
|
if len(rt)==0:
|
608
|
-
logging.info("No simulations found")
|
597
|
+
logging.info("No simulations found at this stage.")
|
609
598
|
return None
|
610
599
|
|
611
600
|
if len(rt)<2:
|
612
|
-
logging.info("There is only one simulation!")
|
601
|
+
logging.info("There is only one simulation! Weigthing coefficient is unique and set to 1.")
|
613
602
|
return pd.DataFrame(1, columns=["Ponderation"], index=rt)
|
614
603
|
|
615
604
|
else :
|
@@ -979,7 +968,7 @@ class Accept_Manager():
|
|
979
968
|
|
980
969
|
def select_name_tif(self, path_baseline: Path, folder_path: Path, name) -> list[Path]:
|
981
970
|
"""
|
982
|
-
Collects and appends all .tiff files starting with '
|
971
|
+
Collects and appends all .tiff files starting with 'name' from folder_path into a list.
|
983
972
|
"""
|
984
973
|
files = []
|
985
974
|
#first element must be vulnerability_baseline
|
@@ -991,23 +980,21 @@ class Accept_Manager():
|
|
991
980
|
files.append(tree[-1].as_posix())
|
992
981
|
return files
|
993
982
|
|
994
|
-
def check_nodata(self, name):
|
983
|
+
def check_nodata(self, name, path_baseline):
|
995
984
|
""" Check nodata in a path """
|
996
|
-
|
997
|
-
list_tif = Accept_Manager.select_name_tif(self, self.OUT_VULN, self.IN_CH_SA_SC, name)
|
985
|
+
list_tif = Accept_Manager.select_name_tif(self, path_baseline, self.IN_CH_SA_SC, name)
|
998
986
|
for cur_lst in list_tif:
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
logging.warning(_('nodata changed in favor of 99999. value for file {} !'.format(cur_lst)))
|
987
|
+
curarray:WolfArray = WolfArray(cur_lst)
|
988
|
+
if curarray.nullvalue != 99999.:
|
989
|
+
curarray.nullvalue = 99999.
|
990
|
+
curarray.set_nullvalue_in_mask()
|
991
|
+
curarray.write_all()
|
992
|
+
logging.warning(_('nodata changed in favor of 99999. value for file {} !'.format(cur_lst)))
|
1006
993
|
|
1007
994
|
def create_vrtIfExists(self, fn_baseline, fn_scenario, fn_vrt, name):
|
1008
995
|
""" Create a vrt file from a path """
|
1009
996
|
logging.info(_('Checking nodata values...'))
|
1010
|
-
self.check_nodata(name)
|
997
|
+
self.check_nodata(name, fn_baseline)
|
1011
998
|
list_tif = Accept_Manager.select_name_tif(self, fn_baseline, fn_scenario, name)
|
1012
999
|
#création du fichier vrt - assembly/agglomération
|
1013
1000
|
if len(list_tif)>1:
|
@@ -1536,7 +1523,8 @@ def match_vulnerability2sim(inRas:Path, outRas:Path, MODREC:Path):
|
|
1536
1523
|
def update_accept(accept, model_h, ij, bounds, loc_accept):
|
1537
1524
|
for idx in range(len(bounds)):
|
1538
1525
|
for i,j in ij:
|
1539
|
-
|
1526
|
+
#lit dans wd vs Ti où on est et associe son score d'accept
|
1527
|
+
if bounds[idx,0] < model_h[i,j] <= bounds[idx,1]:
|
1540
1528
|
accept[i,j] = loc_accept[idx]
|
1541
1529
|
|
1542
1530
|
def compute_acceptability(manager:Accept_Manager,
|
wolfhece/apps/version.py
CHANGED
wolfhece/wolfresults_2D.py
CHANGED
@@ -4350,7 +4350,7 @@ class Wolfresults_2D(Element_To_Draw):
|
|
4350
4350
|
filename: str | Path,
|
4351
4351
|
for_steps:tuple[int] | list[int] = (0,-1,1),
|
4352
4352
|
erase_if_exists:bool = True,
|
4353
|
-
|
4353
|
+
all_values:bool = GL_FRAGMENT_INTERPOLATION_OFFSET_BITS):
|
4354
4354
|
""" Export some results at one or multiple coordinates defined by a vector or a list of coordinates
|
4355
4355
|
or a polygon as CSV file
|
4356
4356
|
"""
|
@@ -4363,6 +4363,9 @@ class Wolfresults_2D(Element_To_Draw):
|
|
4363
4363
|
if erase_if_exists and filename.exists():
|
4364
4364
|
filename.unlink()
|
4365
4365
|
|
4366
|
+
if erase_if_exists and filename.with_stem(filename.stem + '_stats').exists():
|
4367
|
+
filename.with_stem(filename.stem + '_stats').unlink()
|
4368
|
+
|
4366
4369
|
(times, steps), vals = self.get_values_xyorpoly_series(xy, which, for_steps)
|
4367
4370
|
|
4368
4371
|
mean= []
|
@@ -4393,16 +4396,16 @@ class Wolfresults_2D(Element_To_Draw):
|
|
4393
4396
|
for i in range(len(times)):
|
4394
4397
|
f.write(f'{times[i]}\t{steps[i]}\t{mean[i]}\t{median[i]}\t{min[i]}\t{max[i]}\n')
|
4395
4398
|
|
4396
|
-
if
|
4399
|
+
if all_values:
|
4397
4400
|
|
4398
4401
|
with open(filename, 'a') as f:
|
4399
4402
|
if isinstance(xy, list):
|
4400
|
-
f.write(_('Selected nodes'))
|
4401
|
-
f.write('X [m]\tY [m]')
|
4403
|
+
f.write(_('Selected nodes\n'))
|
4404
|
+
f.write('X [m]\tY [m]\n')
|
4402
4405
|
for cur in xy:
|
4403
|
-
f.write(f'{cur[0]}\t{cur[1]}')
|
4406
|
+
f.write(f'{cur[0]}\t{cur[1]}\n')
|
4404
4407
|
|
4405
|
-
f.write('\n')
|
4408
|
+
f.write('\n\n')
|
4406
4409
|
|
4407
4410
|
f.write(f'Time [s]\tStep [-]\t{which.value[0]}\n')
|
4408
4411
|
|
@@ -7,7 +7,7 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
|
|
7
7
|
wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
|
8
8
|
wolfhece/PyConfig.py,sha256=gyl1MesSJZaVpC1XtvD78PpnE1VD3hGM3HPQXTJ3eJg,12963
|
9
9
|
wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
|
10
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
+
wolfhece/PyDraw.py,sha256=6gFr4O-lGKCdv_bPtphkQf4uw7TcLbtUte6heSng4aI,565492
|
11
11
|
wolfhece/PyGui.py,sha256=RlrLoCBdbiMnR4FSUD1yuy8fs--hxUl_zPu7zuduCLE,144706
|
12
12
|
wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
|
13
13
|
wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
|
@@ -58,15 +58,15 @@ wolfhece/wolf_texture.py,sha256=ecoXXmmcLuyG1oPqU2dB_k03qMTCLTVQoSq1xi1EalU,1735
|
|
58
58
|
wolfhece/wolf_tiles.py,sha256=v-HohqaWuMYdn75XLnA22dlloAG90iwnIqrgnB0ASQ4,10488
|
59
59
|
wolfhece/wolf_vrt.py,sha256=wbxXVN7TL9zgdyF79S-4e3pje6wJEAgBEfF_Y8kkzxs,14271
|
60
60
|
wolfhece/wolf_zi_db.py,sha256=baE0niMCzybWGSvPJc5FNxo9ZxsGfU4p-FmfiavFHAs,12967
|
61
|
-
wolfhece/wolfresults_2D.py,sha256=
|
61
|
+
wolfhece/wolfresults_2D.py,sha256=wf_FAT9Ozr8yaMzkNmxe238gJy5pzegZKnib47wjbnM,203343
|
62
62
|
wolfhece/xyz_file.py,sha256=1pzLFmmdHca4yBVR9Jitic6N82rY28mRytGC1zMbY28,6615
|
63
63
|
wolfhece/acceptability/Parallels.py,sha256=njrJFH_tTdQUg2px-QqQR6VdhImP1TEujLhpM3JEKNo,4001
|
64
64
|
wolfhece/acceptability/__init__.py,sha256=hfgoPKLDpX7drN1Vpvux-_5Lfyc_7feT2C2zQr5v-Os,258
|
65
65
|
wolfhece/acceptability/_add_path.py,sha256=nudniS-lsgHwXXq5o626XRDzIeYj76GoGKYt6lcu2Nc,616
|
66
|
-
wolfhece/acceptability/acceptability.py,sha256=
|
67
|
-
wolfhece/acceptability/acceptability_gui.py,sha256=
|
66
|
+
wolfhece/acceptability/acceptability.py,sha256=dLsYVwPiYH33M7y2vVzlLVd9q8dLgDIeTuJ8f20L4ig,28006
|
67
|
+
wolfhece/acceptability/acceptability_gui.py,sha256=AhIMnVlMPtqycbfeiDonJkjdlFOnvrBzBxXZobSIRJs,75633
|
68
68
|
wolfhece/acceptability/cli.py,sha256=ul_GmDnSgKSgA7z5ZIzeA_MlS2uqo-Xi48bqmWUS-Qk,19141
|
69
|
-
wolfhece/acceptability/func.py,sha256=
|
69
|
+
wolfhece/acceptability/func.py,sha256=e-E73GFUAeqUy8j5HaA7GHnx12_gABCj0erWAtOqUfA,68241
|
70
70
|
wolfhece/apps/ManageParams.py,sha256=9okXHGHKEayA9iKTnv8jsVYCP2up5kr6hDaKO_fMCaQ,748
|
71
71
|
wolfhece/apps/Optimisation_hydro.py,sha256=ySIaVsFNEx4PaHFLlT2QW9BiwChVcTNd2TBnW1aICsI,810
|
72
72
|
wolfhece/apps/WolfPython.png,sha256=K3dcbeZUiJCFNwOAAlGMaRGLJ56yM8WD2I_0bk0xT1g,104622
|
@@ -80,7 +80,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
80
80
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
81
81
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
82
82
|
wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
|
83
|
-
wolfhece/apps/version.py,sha256=
|
83
|
+
wolfhece/apps/version.py,sha256=SejEJTdabn7XYNj2nJzbbaHqn21N_ZJvJU5tvR3AV-U,389
|
84
84
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
85
85
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
86
86
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -295,8 +295,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
295
295
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
296
296
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
297
297
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
298
|
-
wolfhece-2.1.
|
299
|
-
wolfhece-2.1.
|
300
|
-
wolfhece-2.1.
|
301
|
-
wolfhece-2.1.
|
302
|
-
wolfhece-2.1.
|
298
|
+
wolfhece-2.1.121.dist-info/METADATA,sha256=2a93ri9fFZhGlUD2zDQ9Qo88Fy5awAfSpAFUjBudGZ8,2587
|
299
|
+
wolfhece-2.1.121.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
300
|
+
wolfhece-2.1.121.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
301
|
+
wolfhece-2.1.121.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
302
|
+
wolfhece-2.1.121.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|