wolfhece 2.2.25__py3-none-any.whl → 2.2.26__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 +44 -17
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.26.dist-info}/METADATA +1 -1
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.26.dist-info}/RECORD +7 -7
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.26.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.26.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.25.dist-info → wolfhece-2.2.26.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
|
|
@@ -804,11 +820,11 @@ class Analysis_Scenarios():
|
|
804
820
|
# plot topography / bed elevation for the reference scenario
|
805
821
|
s, z = self.get_polygon(ref).get_s_values(stored_values_unk.TOPOGRAPHY, which_group=ref, operator=operator, which_sim=sim)
|
806
822
|
fig, ax = plt.subplots(1, 1)
|
807
|
-
ax.plot(s, z, label=ref, color='black', linestyle='-', linewidth=2)
|
823
|
+
ax.plot(s, z, label=f"{ref} - {_('Bathymetry')}", color='black', linestyle='-', linewidth=2)
|
808
824
|
|
809
825
|
# plot water surface elevation for the reference scenario
|
810
826
|
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"{ref} - {
|
827
|
+
ax.plot(s, z, label=f"{ref} - {sim}", color='blue', linestyle='-', linewidth=2)
|
812
828
|
|
813
829
|
# plot topography / bed elevation for the simulation scenarios
|
814
830
|
for cur_scenario in scenario[1:]:
|
@@ -955,7 +971,7 @@ class Analysis_Scenarios():
|
|
955
971
|
for sim in self.list_sims_in_polygons(scenario):
|
956
972
|
# plot Froude number for the reference scenario
|
957
973
|
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"{scenario} - {
|
974
|
+
ax.plot(s, z, label=f"{scenario} - {sim}", linestyle='-', linewidth=1.5)
|
959
975
|
|
960
976
|
filename = self.directories[Directory_Analysis.IMAGES] / f"{self.name}_{scenario}_{str(xmin)}_{str(xmax)}_Froude.png"
|
961
977
|
|
@@ -973,7 +989,7 @@ class Analysis_Scenarios():
|
|
973
989
|
|
974
990
|
# plot water surface elevation for the reference scenario
|
975
991
|
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"{ref} - {
|
992
|
+
ax.plot(s, z, label=f"{ref} - {sim}", color='blue', linestyle='-', linewidth=2)
|
977
993
|
|
978
994
|
# plot water surface elevation for the simulation scenarios
|
979
995
|
for cur_scenario in scenario[1:]:
|
@@ -1178,8 +1194,13 @@ class Analysis_Scenarios():
|
|
1178
1194
|
if isinstance(key, tuple):
|
1179
1195
|
key = '_'.join(key)
|
1180
1196
|
|
1197
|
+
key = key.replace('\\', '_') # Replace backslashes with underscores for file naming
|
1198
|
+
|
1199
|
+
logging.info(f"Caching data for scenario '{key}' to disk.")
|
1181
1200
|
polygons[0].cache_data((self.directories[Directory_Analysis.CACHE] / (self.name + '_' + key)).with_suffix('.json'))
|
1182
1201
|
|
1202
|
+
logging.info("Data caching to disk completed.")
|
1203
|
+
|
1183
1204
|
def load_cached_data(self) -> None:
|
1184
1205
|
""" Load cached data from polygons if available.
|
1185
1206
|
|
@@ -1193,9 +1214,14 @@ class Analysis_Scenarios():
|
|
1193
1214
|
if isinstance(key, tuple):
|
1194
1215
|
key = '_'.join(key)
|
1195
1216
|
|
1217
|
+
key = key.replace('\\', '_') # Replace backslashes with underscores for file naming
|
1218
|
+
|
1196
1219
|
cache_file = (self.directories[Directory_Analysis.CACHE] / (self.name + '_' + key)).with_suffix('.json')
|
1220
|
+
logging.info(f"Loading cached data from {cache_file}")
|
1197
1221
|
polygons[0].load_data(cache_file)
|
1198
1222
|
|
1223
|
+
logging.info("Cached data loaded successfully.")
|
1224
|
+
|
1199
1225
|
def extract_data_from_polygons(self) -> dict:
|
1200
1226
|
""" Extract data from polygons used in the analysis.
|
1201
1227
|
|
@@ -1379,11 +1405,12 @@ class Analysis_Scenarios():
|
|
1379
1405
|
:param scenario: The name of the scenario to get polygons information for. If None, returns information for all scenarios.
|
1380
1406
|
:return: A dictionary with the polygons information.
|
1381
1407
|
"""
|
1382
|
-
scenario = _sanitize_scenario_name(scenario)
|
1383
1408
|
|
1384
1409
|
if scenario is None:
|
1385
1410
|
# Return information for all scenarios
|
1386
1411
|
return {key: self.get_polygons_informations(key) for key in self._polygons.keys()}
|
1412
|
+
else:
|
1413
|
+
scenario = _sanitize_scenario_name(scenario)
|
1387
1414
|
|
1388
1415
|
if scenario not in self._polygons:
|
1389
1416
|
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=ywl1rGt9d5UlGmLPuCEKV0NQSzDV2Zum80Gbo1pTZqs,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=8veLJr-vWmO56Y73c1fowCOum9IAiWYygC7gEZEBeFk,90875
|
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.26.dist-info/METADATA,sha256=F6COfsHmlgTZoUOckJarKwQJFDwXPD7t0Q6bK66pMgg,2729
|
305
|
+
wolfhece-2.2.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
306
|
+
wolfhece-2.2.26.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
|
307
|
+
wolfhece-2.2.26.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
308
|
+
wolfhece-2.2.26.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|