wolfhece 2.2.34__py3-none-any.whl → 2.2.36__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/wolf_zi_db.py CHANGED
@@ -91,6 +91,16 @@ class ColNames_Enquetes(Enum):
91
91
  ORIENTATION = 'Orientation'
92
92
  DATE = 'Date'
93
93
 
94
+ class ColNames_Profils(Enum):
95
+ """ Enum for the column names in the database """
96
+
97
+ KEY = 'Clé primaire'
98
+ X = 'XLambert'
99
+ Y = 'YLambert'
100
+ PHOTO = 'FichierImage'
101
+ RIVER = 'Rivière'
102
+ DATE = 'DateModif'
103
+
94
104
  def _test_bounds(x:float, y:float, bounds:list[list[float, float], list[float, float]]) -> bool:
95
105
  """ Test if the coordinates are inside the bounds
96
106
 
@@ -472,6 +482,16 @@ class Ouvrages(PictureCollection):
472
482
  def check_plot(self):
473
483
  """ Activate the plot if the object is initialized """
474
484
 
485
+ if self.initialized:
486
+ # Ask if the user wants to reload the database
487
+ if self.wx_exists:
488
+ dlg = wx.MessageDialog(None, _("Do you want to reload the database?"), _("Reload Database"),
489
+ wx.YES_NO | wx.ICON_QUESTION)
490
+ ret = dlg.ShowModal()
491
+ if ret == wx.ID_YES:
492
+ self.initialized = False
493
+ dlg.Destroy()
494
+
475
495
  if not self.initialized:
476
496
 
477
497
  # try to get the filename from the parent mapviewer
@@ -487,6 +507,8 @@ class Ouvrages(PictureCollection):
487
507
  self.read_db(self.filename, sel_rivers=self.rivers, sheet_name='Photos', bounds=bounds)
488
508
  elif 'features' in self.idx.lower() or 'particularit' in self.idx.lower():
489
509
  self.read_db(self.filename, sel_rivers=self.rivers, sheet_name='Particularités', bounds=bounds)
510
+ elif 'cross' in self.idx.lower() or 'section' in self.idx.lower():
511
+ self.read_db(self.filename, sel_rivers=self.rivers, sheet_name='Sections transversales scannées', bounds=bounds)
490
512
 
491
513
  if self.initialized:
492
514
  super().check_plot()
@@ -932,4 +954,137 @@ class Enquetes(Ouvrages):
932
954
  pic.myprop.legendlength = 100
933
955
 
934
956
 
957
+ self.find_minmax(True)
958
+
959
+ class Profils(Ouvrages):
960
+ """ Class to handle the "Profils en travers" -- Pictures of the corss-sections in the ZI. """
961
+
962
+ def __init__(self, parent=None, idx = '', plotted = True, mapviewer=None, rivers = None):
963
+ super().__init__(parent = parent, idx = idx, plotted = plotted, mapviewer = mapviewer, rivers = rivers)
964
+
965
+ self._columns = ColNames_Profils
966
+
967
+ def read_db(self, filename:str | Path,
968
+ sel_rivers: list[str] = None,
969
+ sheet_name: str = 'Sections transversales scannées',
970
+ bounds: list[list[float, float], list[float, float]] = None):
971
+ """ Read the database (Excel file) and create the zones and the vectors.
972
+
973
+ The user will be prompted to select the rivers to display.
974
+
975
+ :param filename: The path to the Excel file containing the database
976
+ :type filename: str | Path
977
+ :param sel_rivers: The list of rivers to display, if None, the user will be prompted to select the rivers
978
+ :type sel_rivers: list[str] | None
979
+ :param sheet_name: The name of the sheet in the Excel file to read
980
+ :type sheet_name: str
981
+ :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
982
+ :type bounds: list[list[float, float], list[float, float]] |
983
+ """
984
+
985
+ self.filename = Path(filename)
986
+
987
+ if not self.filename.exists() or filename == '':
988
+
989
+ if self.wx_exists:
990
+
991
+ dlg= wx.FileDialog(None, _("Choose a file"), defaultDir= "", wildcard="Excel (*.xlsx)|*.xlsx", style = wx.FD_OPEN)
992
+ ret = dlg.ShowModal()
993
+ if ret == wx.ID_OK:
994
+ self.filename = Path(dlg.GetPath())
995
+ dlg.Destroy()
996
+ else:
997
+ logging.error('No file selected')
998
+ dlg.Destroy()
999
+ return
1000
+
1001
+ else:
1002
+ logging.error('No file selected or the file does not exist.')
1003
+ return
1004
+
1005
+ try:
1006
+ logging.info(f'Reading database from {self.filename}')
1007
+ self.db = pd.read_excel(self.filename, sheet_name=sheet_name)
1008
+ logging.info(f'Database read successfully from {self.filename}')
1009
+ except ValueError as e:
1010
+ logging.error(f"Error reading the Excel file: {e}")
1011
+ return
1012
+
1013
+ rivers = list(self.db[ColNames_Profils.RIVER.value].unique())
1014
+ rivers.sort()
1015
+
1016
+ self.rivers = []
1017
+
1018
+ if sel_rivers is None and self.wx_exists:
1019
+
1020
+ with wx.MessageDialog(None, _("Choose the rivers to display"), _("Rivers"), wx.YES_NO | wx.ICON_QUESTION) as dlg:
1021
+
1022
+ if dlg.ShowModal() == wx.ID_YES:
1023
+
1024
+ with wx.MultiChoiceDialog(None, _("Choose the rivers to display"), _("Rivers"), rivers) as dlg_river:
1025
+ ret = dlg_river.ShowModal()
1026
+
1027
+ if ret == wx.ID_OK:
1028
+ for curidx in dlg_river.GetSelections():
1029
+ self.rivers.append(rivers[curidx])
1030
+ else:
1031
+ self.rivers = rivers
1032
+
1033
+ elif sel_rivers is not None:
1034
+
1035
+ for curruver in sel_rivers:
1036
+ if curruver in rivers:
1037
+ self.rivers.append(curruver)
1038
+ else:
1039
+ logging.error(f'River {curruver} not found in the database -- Ignoring !')
1040
+
1041
+ self._filter_db(bounds)
1042
+
1043
+ self.initialized = True
1044
+
1045
+ def _filter_db(self, bounds: list[list[float, float], list[float, float]] = None):
1046
+ """ Filter the database based on the selected rivers and bounds.
1047
+
1048
+ :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
1049
+ :type bounds: list[list[float, float], list[float, float]] |
1050
+ """
1051
+
1052
+ if len(self.rivers) == 0:
1053
+ locdb = self.db
1054
+ else:
1055
+ locdb = self.db[self.db[ColNames_Profils.RIVER.value].isin(self.rivers)]
1056
+
1057
+ for id, curline in tqdm(locdb.iterrows()):
1058
+ river = curline[ColNames_Profils.RIVER.value]
1059
+
1060
+ fullpath = curline[ColNames_Profils.PHOTO.value]
1061
+
1062
+ fullpath = fullpath.replace(r'\\192.168.2.185\Intranet\Data\Données et Photos de crues\Données Profils',
1063
+ str(self.filename.parent) + r'\Profils')
1064
+ fullpath = Path(fullpath)
1065
+
1066
+ if not fullpath.exists():
1067
+ logging.debug(f'File {fullpath} does not exist')
1068
+ continue
1069
+
1070
+ x = curline[ColNames_Profils.X.value]
1071
+ y = curline[ColNames_Profils.Y.value]
1072
+
1073
+ if bounds is not None and not _test_bounds(x, y, bounds):
1074
+ logging.info(f'Coordinates are out of bounds -- Skipping line {id}')
1075
+ continue
1076
+
1077
+ keyzone = river.strip()
1078
+
1079
+ picture = fullpath
1080
+ self.add_picture(picture, x=x, y=y, name=picture.stem, keyzone=keyzone)
1081
+
1082
+ pic = self[(keyzone, picture.stem)]
1083
+ pic.myprop.legendtext = _sanitize_legendtext(curline[ColNames_Profils.DATE.value])
1084
+ pic.myprop.legendx = pic.centroid.x
1085
+ pic.myprop.legendy = pic.centroid.y
1086
+ pic.myprop.legendpriority = Font_Priority.WIDTH
1087
+ pic.myprop.legendlength = 100
1088
+
1089
+
935
1090
  self.find_minmax(True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wolfhece
3
- Version: 2.2.34
3
+ Version: 2.2.36
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  Project-URL: Homepage, https://uee.uliege.be/hece
6
6
  Project-URL: Issues, https://uee.uliege.be/hece
@@ -7,9 +7,9 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
7
  wolfhece/Model1D.py,sha256=snEmu8Uj2YGcp1ybPnly-4A389XRnuOujGduqInNcgw,477001
8
8
  wolfhece/PandasGrid.py,sha256=YIleVkUkoP2MjtQBZ9Xgwk61zbgMj4Pmjj-clVTfPRs,2353
9
9
  wolfhece/PyConfig.py,sha256=13DDWjJdohYHwn1uRVHB0s8Jcwq_b9pwcwbAr8NlZyc,19667
10
- wolfhece/PyCrosssections.py,sha256=iSmuQ1753bWxRLgOkrRLPd3tiMwGRCvfKD2Mim26_8c,114836
11
- wolfhece/PyDraw.py,sha256=TVLcgtHbUnzk3-1WyTsRaW1y1M6FESIOXmjwPcwUwUg,687236
12
- wolfhece/PyGui.py,sha256=fTUlGmUXU17IuZXW41stCWUjhpIRrqg4pXVVBXP8qb8,148120
10
+ wolfhece/PyCrosssections.py,sha256=2m372NSriH41AcIk723y2i44mwUXodbIMIzqkuVMjUY,127365
11
+ wolfhece/PyDraw.py,sha256=yE3Cdhnr74yLnZBRN6vBu0xk3KXfg8Z5SA1P3jzORpM,688239
12
+ wolfhece/PyGui.py,sha256=mcLuHT_pGjW1ltJ-kjNFstVXyeBoZRCvM3vHWv5srB8,148594
13
13
  wolfhece/PyGuiHydrology.py,sha256=sKafpOopBg50L5llZCI_fZtbebVTDtxvoRI6-osUwhg,14745
14
14
  wolfhece/PyHydrographs.py,sha256=1P5XAURNqCvtSsMQXhOn1ihjTpr725sRsZdlCEhhk6M,3730
15
15
  wolfhece/PyPalette.py,sha256=SiRngKml2EXsq1jwQvqh5pBZiV1yS0CY7QrRJGSZD1s,36281
@@ -17,16 +17,16 @@ wolfhece/PyParams.py,sha256=BgTAwxxq831rYEq_KLcFBX_upjiSUpVtfoQnCxCNWUI,100443
17
17
  wolfhece/PyPictures.py,sha256=5X2HBkZG1gTaMKMu6UoU-cOY8SRkFyPScJ8bhdoNY7g,18930
18
18
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
19
19
  wolfhece/PyVertex.py,sha256=a56oY1NB45QnwARg96Tbnq-z-mhZKFkYOkFOO1lNtlk,51056
20
- wolfhece/PyVertexvectors.py,sha256=1rkngPLIsqzQAtAffuV90hWYSo2HfTUmZLy6-xXYrY8,359258
20
+ wolfhece/PyVertexvectors.py,sha256=-ksHufJpbCQwMW73fjs3LE0kfvc3K_TfjbFOUaTEL70,370360
21
21
  wolfhece/PyWMS.py,sha256=XcSlav5icct2UwV7K2r7vpxa5rKZWiHkp732lI94HFI,31534
22
22
  wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
23
23
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
24
24
  wolfhece/RatingCurve_xml.py,sha256=cUjReVMHFKtakA2wVey5zz6lCgHlSr72y7ZfswZDvTM,33891
25
25
  wolfhece/ReadDataDCENN.py,sha256=vm-I4YMryvRldjXTvRYEUCxZsjb_tM7U9yj6OaPyD0k,1538
26
26
  wolfhece/Results2DGPU.py,sha256=ljMEKHGMbmIAZE6UmMmYDMFqFAwjzxxVUmZdHHb6aME,32106
27
- wolfhece/__init__.py,sha256=EnpZ2yDEXueP7GAKV0uA2vAwMiZFyBjDAFcL5Y7LzbM,1850
27
+ wolfhece/__init__.py,sha256=bh5zzt90fGJcc97d0DiuZsV9VxwBEy9HUBfexHmQDJk,1978
28
28
  wolfhece/_add_path.py,sha256=mAyu85CQHk0KgUI6ZizweeQiw1Gdyea9OEjGLC6lLA4,916
29
- wolfhece/analyze_poly.py,sha256=2uNdnRy828jR-aFNg9fx-8aHqXuRAg-hNQpvQ3g2qL8,60837
29
+ wolfhece/analyze_poly.py,sha256=LewmoMSCAr_5zTeqKR0C1eWwjWh7zPjsSdsDyAV-yuk,60874
30
30
  wolfhece/analyze_vect.py,sha256=3lkMwaQ4KRddBVRvlP9PcM66wZwwC0eCmypP91AW-os,6015
31
31
  wolfhece/cli.py,sha256=h1tSMHALiftktreyugKcjbASXfpJUm9UYMeVxR-MtG4,6424
32
32
  wolfhece/color_constants.py,sha256=Snc5RX11Ydi756EkBp_83C7DiAQ_Z1aHD9jFIBsosAU,37121
@@ -51,7 +51,7 @@ wolfhece/pidcontroller.py,sha256=PHYenOdzfyPK2pXAhyRolCxMSMRd2AFza0eVMafpPHk,520
51
51
  wolfhece/pyGui1D.py,sha256=9g7OS3YiKsqy--6y0cBD7x2gaqTTYFXWkxImpgnTA20,121937
52
52
  wolfhece/pybridges.py,sha256=bFAqjL4ColeJtwvyCPGQ8VllWoq1RbVWXxFrdfrvqm8,65954
53
53
  wolfhece/pydike.py,sha256=dRb6qGkqoTXjf107KcajcIk1F_FuMPaOZLSwixT3dgA,11196
54
- wolfhece/pydownloader.py,sha256=sf8E_R_VgKG7TQJpW0Di3Obyp4d8WhIdfNBGRjsa738,10351
54
+ wolfhece/pydownloader.py,sha256=5XzkmakblUmYr025NNZ8Ss7yeWCeNbrRJj1-YoAO10M,10376
55
55
  wolfhece/pylogging.py,sha256=4TI8hgBB65z-zpvU5Rfa2jkPXPhJaqXjHVPwbcdzTNc,4528
56
56
  wolfhece/pypolygons_scen.py,sha256=NWaNeK0RSUeOkgukeogK9FLmQiDjGZ9yhqs9208fojM,46237
57
57
  wolfhece/pyshields.py,sha256=KMtUO5kD0lisKnJD1NsDz-qaY5DpFcmS4O3WkXtUSmo,27898
@@ -61,12 +61,12 @@ wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
61
61
  wolfhece/textpillow.py,sha256=7hgfsLYAaE_rNKD-g8xsON8sdWvoV8vbqnGGxIayShE,14137
62
62
  wolfhece/tools2d_dll.py,sha256=TfvvmyZUqEZIH0uHwUCJf0bdmCks_AiidDt23Unsp5w,13550
63
63
  wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
64
- wolfhece/wolf_array.py,sha256=_di7NkNjiaKAO5FLqUgxr8XFoAdnOC5B-oLMpf_g270,526959
64
+ wolfhece/wolf_array.py,sha256=8f1cVLe5kTAlFfsWbpNXJXS04FXK0kVxT-YCbvkD2Ow,572989
65
65
  wolfhece/wolf_hist.py,sha256=fTEb60Q4TEwobdZsRU4CFXAId1eOKdWAqF8lnF1xEWc,3590
66
66
  wolfhece/wolf_texture.py,sha256=Pt1j_lX74p70Fj3y3qYxYMuN8gghVd8_ih1vFhTIdkA,23884
67
67
  wolfhece/wolf_tiles.py,sha256=v-HohqaWuMYdn75XLnA22dlloAG90iwnIqrgnB0ASQ4,10488
68
68
  wolfhece/wolf_vrt.py,sha256=wbxXVN7TL9zgdyF79S-4e3pje6wJEAgBEfF_Y8kkzxs,14271
69
- wolfhece/wolf_zi_db.py,sha256=gK6kJCOlBNYSfxp_DTZ2bz08sglOGTKI3TtF5PD6YJI,36023
69
+ wolfhece/wolf_zi_db.py,sha256=kz1TofsPfuBQqwYEM32wZl4b-jqgAygorZSm2JnGJ_k,42450
70
70
  wolfhece/wolfresults_2D.py,sha256=0c3akPDFETE0Uq0JiZ0FZEx6Rxiy9JB5s9P6sDei0E0,245735
71
71
  wolfhece/xyz_file.py,sha256=1pzLFmmdHca4yBVR9Jitic6N82rY28mRytGC1zMbY28,6615
72
72
  wolfhece/acceptability/Parallels.py,sha256=2wVkfJYor4yl7VYiAZiGGTFwtAab2z66ZfRtBliVweE,4088
@@ -89,7 +89,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
89
89
  wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
90
90
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
91
91
  wolfhece/apps/splashscreen.py,sha256=EdGDN9NhudIiP7c3gVqj7dp4MWFB8ySizM_tpMnsgpE,3091
92
- wolfhece/apps/version.py,sha256=lkNimxgbA61nLFsEXYXIm7u-sNgE6Tu5jG4zGrfxLL4,388
92
+ wolfhece/apps/version.py,sha256=VBzF5NhnicGf2DpF1l5niAxswGFUsu6LAzTRFunDAvg,388
93
93
  wolfhece/apps/wolf.py,sha256=mRnjYsUu4KIsRuamdQWAINFMuwN4eJgMo9erG-hkZ70,729
94
94
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
95
95
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -308,8 +308,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=u4C7CXe_bUyGKx7c_Bi0x9
308
308
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
309
309
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
310
310
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
311
- wolfhece-2.2.34.dist-info/METADATA,sha256=dwSE06Hid1yIO9zqFqMbncDkRO7j6o2uimenQkGngvo,2729
312
- wolfhece-2.2.34.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
313
- wolfhece-2.2.34.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
314
- wolfhece-2.2.34.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
315
- wolfhece-2.2.34.dist-info/RECORD,,
311
+ wolfhece-2.2.36.dist-info/METADATA,sha256=PcT7osVZ0AdB24tdvLvyBzA0_88Zmx2WyHyY3FhFs0c,2729
312
+ wolfhece-2.2.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
313
+ wolfhece-2.2.36.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
314
+ wolfhece-2.2.36.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
315
+ wolfhece-2.2.36.dist-info/RECORD,,