wolfhece 2.2.25__py3-none-any.whl → 2.2.27__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/apps/version.py +1 -1
- wolfhece/report/tools.py +62 -20
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.27.dist-info}/METADATA +1 -1
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.27.dist-info}/RECORD +7 -7
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.27.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.27.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.27.dist-info}/top_level.txt +0 -0
wolfhece/apps/version.py
CHANGED
wolfhece/report/tools.py
CHANGED
@@ -128,6 +128,8 @@ def _sanitize_scenario_name(scenario_name: str | tuple[str,str]) -> str:
|
|
128
128
|
|
129
129
|
scenario_name = scenario_name[0].strip()
|
130
130
|
|
131
|
+
scenario_name = scenario_name.replace('\\', '_').replace('/', '_') # Replace slashes with underscores
|
132
|
+
|
131
133
|
return scenario_name
|
132
134
|
|
133
135
|
def list_directories(directory: Path) -> list[str]:
|
@@ -171,7 +173,7 @@ def create_a_wolf_viewer() -> WolfMapViewer:
|
|
171
173
|
raise ImportError("Could not create WolfMapViewer instance. Ensure that the MapManager is properly initialized.")
|
172
174
|
|
173
175
|
def find_scenario_directory(base_directory: Path | str, scenario_name: str) -> Path | None:
|
174
|
-
""" Find the directory of a specific scenario within the base directory.
|
176
|
+
""" Find the directory of a specific scenario within the base directory and subdirectories.
|
175
177
|
|
176
178
|
:param base_directory: The base directory where the scenarios are located.
|
177
179
|
:param scenario_name: The name of the scenario to find.
|
@@ -179,11 +181,20 @@ def find_scenario_directory(base_directory: Path | str, scenario_name: str) -> P
|
|
179
181
|
"""
|
180
182
|
base_path = Path(base_directory)
|
181
183
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
184
|
+
scen_path = base_path / scenario_name
|
185
|
+
# Check if the scenario_name is a direct subdirectory of the base directory
|
186
|
+
if scen_path.is_dir():
|
187
|
+
return scen_path
|
188
|
+
|
189
|
+
# # search if scenario_name is a directory in the base directory or its subdirectories
|
190
|
+
# for dirpath, dirnames, filenames in os.walk(base_path):
|
191
|
+
# if scenario_name in dirnames:
|
192
|
+
# return Path(dirpath) / scenario_name
|
186
193
|
|
194
|
+
# # Search in subdirectories of the base directory
|
195
|
+
# for subdir in base_path.iterdir():
|
196
|
+
# if subdir.is_dir() and subdir.name == scenario_name:
|
197
|
+
# return subdir
|
187
198
|
return None
|
188
199
|
|
189
200
|
def get_scenarios_directories(base_directory: Path | str, scenario_names:list[str]) -> dict:
|
@@ -194,7 +205,7 @@ def get_scenarios_directories(base_directory: Path | str, scenario_names:list[st
|
|
194
205
|
:return: A list of paths to the scenario directories.
|
195
206
|
"""
|
196
207
|
base_path = Path(base_directory)
|
197
|
-
ret = {scenario_name : find_scenario_directory(base_path, scenario_name) for scenario_name in scenario_names}
|
208
|
+
ret = {_sanitize_scenario_name(scenario_name) : find_scenario_directory(base_path, scenario_name) for scenario_name in scenario_names}
|
198
209
|
|
199
210
|
# check if None is in the list and logging it
|
200
211
|
for scenario_name, scenario_path in ret.items():
|
@@ -538,10 +549,14 @@ class Analysis_Scenarios():
|
|
538
549
|
self._cloud.append((s, z, label))
|
539
550
|
logging.info(f"Point added to cloud: ({s}, {z}, '{label}')")
|
540
551
|
|
541
|
-
def add_measures(self, measures:Zones | str | Path, zones:list[str] = None, style:dict = None) -> None:
|
552
|
+
def add_measures(self, measures:Zones | str | Path, zones:list[str] = None, style:dict = None, force_all_vectors:bool = False) -> None:
|
542
553
|
""" Add measures to the analysis.
|
543
554
|
|
544
555
|
:param measures: A Zones instance or a path to a vector file containing the measures.
|
556
|
+
:param zones: A list of zone names to include in the analysis. If None, all zones in the measures will be used.
|
557
|
+
:param style: A dictionary containing style properties for the measures.
|
558
|
+
Available properties: 'color', 'linestyle', 'linewidth', 'marker', 'markersize', 'alpha'.
|
559
|
+
:param force_all_vectors: If True, all vectors in the zones will be projected on the riverbed, even if they are not used.
|
545
560
|
"""
|
546
561
|
|
547
562
|
if isinstance(measures, Zones):
|
@@ -570,14 +585,15 @@ class Analysis_Scenarios():
|
|
570
585
|
logging.error(f"Zone '{zone}' not found in the measures.")
|
571
586
|
raise ValueError(f"Zone '{zone}' not found in the measures.")
|
572
587
|
|
573
|
-
self._measures_zones[key] = zones if zones is not None else cur_measure.myzones
|
588
|
+
self._measures_zones[key] = zones if zones is not None else [curz.myname for curz in cur_measure.myzones]
|
574
589
|
|
575
590
|
for zone_name in self._measures_zones[key]:
|
576
591
|
curz = cur_measure[zone_name]
|
577
592
|
for vec in curz.myvectors:
|
578
|
-
|
579
|
-
|
580
|
-
|
593
|
+
if vec.used or force_all_vectors:
|
594
|
+
# create a local key for the projected measures
|
595
|
+
lockey = (key, zone_name, vec.myname)
|
596
|
+
self._projected_measures[lockey] = [vec.projectontrace(self.reference_polygon.riverbed), style]
|
581
597
|
|
582
598
|
logging.info(f"Measures added to the analysis: {self._measures[key].idx}")
|
583
599
|
|
@@ -630,7 +646,7 @@ class Analysis_Scenarios():
|
|
630
646
|
if self.reference_polygon is not None:
|
631
647
|
# Compute the distance to the reference polygon
|
632
648
|
ls = self.reference_polygon.riverbed.linestring
|
633
|
-
self._landmarks_s_label = [(ls.project(Point((curvec.myvertices[0].x+curvec.myvertices[-1].x)/2., (curvec.myvertices[0].y+curvec.myvertices[-1].y)/2.)), None, curvec.myname) for curvec in self._landmarks.myzones[0].myvectors]
|
649
|
+
self._landmarks_s_label = [(ls.project(Point((curvec.myvertices[0].x+curvec.myvertices[-1].x)/2., (curvec.myvertices[0].y+curvec.myvertices[-1].y)/2.)), None, curvec.myname) for curvec in self._landmarks.myzones[0].myvectors if curvec.used]
|
634
650
|
|
635
651
|
logging.info(f"Landmarks added to the analysis: {self._landmarks.idx}")
|
636
652
|
|
@@ -799,30 +815,38 @@ class Analysis_Scenarios():
|
|
799
815
|
raise ValueError("At least two scenarios are required to compare waterlines.")
|
800
816
|
|
801
817
|
ref, sim = scenario[0]
|
818
|
+
|
819
|
+
if isinstance(ref, tuple):
|
820
|
+
full_name = ref[1]
|
802
821
|
ref = _sanitize_scenario_name(ref)
|
803
822
|
|
804
823
|
# plot topography / bed elevation for the reference scenario
|
805
824
|
s, z = self.get_polygon(ref).get_s_values(stored_values_unk.TOPOGRAPHY, which_group=ref, operator=operator, which_sim=sim)
|
806
825
|
fig, ax = plt.subplots(1, 1)
|
807
|
-
ax.plot(s, z, label=
|
826
|
+
ax.plot(s, z, label=f"{full_name} - {_('Bathymetry')}", color='black', linestyle='-', linewidth=2)
|
808
827
|
|
809
828
|
# plot water surface elevation for the reference scenario
|
810
829
|
s, z = self.get_polygon(ref).get_s_values(stored_values_unk.WATERLEVEL, which_group=ref, operator=operator, which_sim=sim)
|
811
|
-
ax.plot(s, z, label=f"{
|
830
|
+
ax.plot(s, z, label=f"{full_name} - {sim}", color='blue', linestyle='-', linewidth=2)
|
812
831
|
|
813
832
|
# plot topography / bed elevation for the simulation scenarios
|
814
833
|
for cur_scenario in scenario[1:]:
|
815
834
|
scen_name, sim_name = cur_scenario
|
835
|
+
|
836
|
+
if isinstance(scen_name, tuple):
|
837
|
+
full_name = scen_name[1]
|
816
838
|
scen_name = _sanitize_scenario_name(scen_name)
|
817
839
|
s, z = self.get_polygon(scen_name).get_s_values(stored_values_unk.TOPOGRAPHY, which_group=scen_name, operator=operator, which_sim=sim_name)
|
818
|
-
ax.plot(s, z, label=f"{
|
840
|
+
ax.plot(s, z, label=f"{full_name} - {_('Bathymetry')}", linestyle='--', linewidth=1.5)
|
819
841
|
|
820
842
|
# plot water surface elevation for the simulation scenarios
|
821
843
|
for cur_scenario in scenario[1:]:
|
822
844
|
scen_name, sim_name = cur_scenario
|
845
|
+
if isinstance(scen_name, tuple):
|
846
|
+
full_name = scen_name[1]
|
823
847
|
scen_name = _sanitize_scenario_name(scen_name)
|
824
848
|
s, z = self.get_polygon(scen_name).get_s_values(stored_values_unk.WATERLEVEL, which_group=scen_name, operator=operator, which_sim=sim_name)
|
825
|
-
ax.plot(s, z, label=f"{
|
849
|
+
ax.plot(s, z, label=f"{full_name} - {sim_name}", linestyle='--', linewidth=1.5)
|
826
850
|
|
827
851
|
filename = self.directories[Directory_Analysis.IMAGES] / f"{self.name}_{ref}_{str(xmin)}_{str(xmax)}_waterlines_comparison.png"
|
828
852
|
|
@@ -947,6 +971,8 @@ class Analysis_Scenarios():
|
|
947
971
|
|
948
972
|
if isinstance(scenario, (str, tuple)):
|
949
973
|
|
974
|
+
if isinstance(scenario, tuple):
|
975
|
+
full_name = scenario[1]
|
950
976
|
scenario = _sanitize_scenario_name(scenario)
|
951
977
|
|
952
978
|
fig,ax = plt.subplots(1,1)
|
@@ -955,7 +981,7 @@ class Analysis_Scenarios():
|
|
955
981
|
for sim in self.list_sims_in_polygons(scenario):
|
956
982
|
# plot Froude number for the reference scenario
|
957
983
|
s, z = self.get_polygon(scenario).get_s_values(stored_values_unk.FROUDE, which_group=scenario, operator=operator, which_sim=sim)
|
958
|
-
ax.plot(s, z, label=f"{
|
984
|
+
ax.plot(s, z, label=f"{sim}", linestyle='-', linewidth=1.5)
|
959
985
|
|
960
986
|
filename = self.directories[Directory_Analysis.IMAGES] / f"{self.name}_{scenario}_{str(xmin)}_{str(xmax)}_Froude.png"
|
961
987
|
|
@@ -969,18 +995,23 @@ class Analysis_Scenarios():
|
|
969
995
|
fig,ax = plt.subplots(1,1)
|
970
996
|
|
971
997
|
ref, sim = scenario[0]
|
998
|
+
|
999
|
+
if isinstance(ref, tuple):
|
1000
|
+
full_name = ref[1]
|
972
1001
|
ref = _sanitize_scenario_name(ref)
|
973
1002
|
|
974
1003
|
# plot water surface elevation for the reference scenario
|
975
1004
|
s, z = self.get_polygon(ref).get_s_values(stored_values_unk.FROUDE, which_group=ref, operator=operator, which_sim=sim)
|
976
|
-
ax.plot(s, z, label=f"{
|
1005
|
+
ax.plot(s, z, label=f"{full_name} - {sim}", color='blue', linestyle='-', linewidth=2)
|
977
1006
|
|
978
1007
|
# plot water surface elevation for the simulation scenarios
|
979
1008
|
for cur_scenario in scenario[1:]:
|
980
1009
|
scen_name, sim_name = cur_scenario
|
1010
|
+
if isinstance(scen_name, tuple):
|
1011
|
+
full_name = scen_name[1]
|
981
1012
|
scen_name = _sanitize_scenario_name(scen_name)
|
982
1013
|
s, z = self.get_polygon(scen_name).get_s_values(stored_values_unk.FROUDE, which_group=scen_name, operator=operator, which_sim=sim_name)
|
983
|
-
ax.plot(s, z, label=f"{
|
1014
|
+
ax.plot(s, z, label=f"{full_name} - {sim_name}", linestyle='--', linewidth=1.5)
|
984
1015
|
|
985
1016
|
filename = self.directories[Directory_Analysis.IMAGES] / f"{self.name}_{ref}_{str(xmin)}_{str(xmax)}_Froude_comparison.png"
|
986
1017
|
|
@@ -1178,8 +1209,13 @@ class Analysis_Scenarios():
|
|
1178
1209
|
if isinstance(key, tuple):
|
1179
1210
|
key = '_'.join(key)
|
1180
1211
|
|
1212
|
+
key = key.replace('\\', '_') # Replace backslashes with underscores for file naming
|
1213
|
+
|
1214
|
+
logging.info(f"Caching data for scenario '{key}' to disk.")
|
1181
1215
|
polygons[0].cache_data((self.directories[Directory_Analysis.CACHE] / (self.name + '_' + key)).with_suffix('.json'))
|
1182
1216
|
|
1217
|
+
logging.info("Data caching to disk completed.")
|
1218
|
+
|
1183
1219
|
def load_cached_data(self) -> None:
|
1184
1220
|
""" Load cached data from polygons if available.
|
1185
1221
|
|
@@ -1193,9 +1229,14 @@ class Analysis_Scenarios():
|
|
1193
1229
|
if isinstance(key, tuple):
|
1194
1230
|
key = '_'.join(key)
|
1195
1231
|
|
1232
|
+
key = key.replace('\\', '_') # Replace backslashes with underscores for file naming
|
1233
|
+
|
1196
1234
|
cache_file = (self.directories[Directory_Analysis.CACHE] / (self.name + '_' + key)).with_suffix('.json')
|
1235
|
+
logging.info(f"Loading cached data from {cache_file}")
|
1197
1236
|
polygons[0].load_data(cache_file)
|
1198
1237
|
|
1238
|
+
logging.info("Cached data loaded successfully.")
|
1239
|
+
|
1199
1240
|
def extract_data_from_polygons(self) -> dict:
|
1200
1241
|
""" Extract data from polygons used in the analysis.
|
1201
1242
|
|
@@ -1379,11 +1420,12 @@ class Analysis_Scenarios():
|
|
1379
1420
|
:param scenario: The name of the scenario to get polygons information for. If None, returns information for all scenarios.
|
1380
1421
|
:return: A dictionary with the polygons information.
|
1381
1422
|
"""
|
1382
|
-
scenario = _sanitize_scenario_name(scenario)
|
1383
1423
|
|
1384
1424
|
if scenario is None:
|
1385
1425
|
# Return information for all scenarios
|
1386
1426
|
return {key: self.get_polygons_informations(key) for key in self._polygons.keys()}
|
1427
|
+
else:
|
1428
|
+
scenario = _sanitize_scenario_name(scenario)
|
1387
1429
|
|
1388
1430
|
if scenario not in self._polygons:
|
1389
1431
|
logging.error(f"Scenario '{scenario}' not found in the analysis.")
|
@@ -88,7 +88,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
88
88
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
89
89
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
90
90
|
wolfhece/apps/splashscreen.py,sha256=EdGDN9NhudIiP7c3gVqj7dp4MWFB8ySizM_tpMnsgpE,3091
|
91
|
-
wolfhece/apps/version.py,sha256=
|
91
|
+
wolfhece/apps/version.py,sha256=p-KAUzXKL4OgZzyJi_QLtP77sITe_SMcFQwa7KciYFU,388
|
92
92
|
wolfhece/apps/wolf.py,sha256=mRnjYsUu4KIsRuamdQWAINFMuwN4eJgMo9erG-hkZ70,729
|
93
93
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
94
94
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -268,7 +268,7 @@ wolfhece/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
268
268
|
wolfhece/report/pdf.py,sha256=zrSSY1JPk59FxK9pFWQfhVKIQAoc_wjeTrXO3tSiEHo,1959
|
269
269
|
wolfhece/report/reporting.py,sha256=JUEXovx_S4jpYkJEBU0AC-1Qw2OkkWyV3VAp6iOfSHc,19494
|
270
270
|
wolfhece/report/simplesimgpu.py,sha256=kx9IMCr9afPwv9B3G5ADQfaIuHXuqTkgSjg-5bXVuqo,60738
|
271
|
-
wolfhece/report/tools.py,sha256=
|
271
|
+
wolfhece/report/tools.py,sha256=hX57JKcdMgjg-jNDpCRGC82x7ZKpYaqSng7oR3rkDrs,91412
|
272
272
|
wolfhece/report/wolf_report.png,sha256=NoSV58LSwb-oxCcZScRiJno-kxDwRdm_bK-fiMsKJdA,592485
|
273
273
|
wolfhece/scenario/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
274
274
|
wolfhece/scenario/check_scenario.py,sha256=d-LWa_FxmPxTSc_H1lDHwqLB6TCqj1IUrRJhatfPMMA,5623
|
@@ -301,8 +301,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
301
301
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
302
302
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
303
303
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
304
|
-
wolfhece-2.2.
|
305
|
-
wolfhece-2.2.
|
306
|
-
wolfhece-2.2.
|
307
|
-
wolfhece-2.2.
|
308
|
-
wolfhece-2.2.
|
304
|
+
wolfhece-2.2.27.dist-info/METADATA,sha256=LyxRqMNvHVs9MaJn8wSaG5KQTVQ6Ixr_dJe237NPjbg,2729
|
305
|
+
wolfhece-2.2.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
306
|
+
wolfhece-2.2.27.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
|
307
|
+
wolfhece-2.2.27.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
308
|
+
wolfhece-2.2.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|