wolfhece 2.1.39__py3-none-any.whl → 2.1.40__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/PyPalette.py CHANGED
@@ -514,10 +514,25 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
514
514
 
515
515
  def defaultgray(self):
516
516
  """Palette grise par défaut dans WOLF"""
517
+
517
518
  self.nb = 2
518
519
  self.values = np.asarray([0., 1.], dtype=np.float64)
519
520
  self.colors = np.asarray([[0, 0, 0, 255], [255, 255, 255, 255]], dtype=np.int32)
520
521
 
522
+ # self.nb = 11
523
+ # self.values = np.asarray([0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.], dtype=np.float64)
524
+ # self.colors = np.asarray([[0, 0, 0, 255],
525
+ # [22, 22, 22, 255],
526
+ # [44, 44, 44, 255],
527
+ # [66, 66, 66, 255],
528
+ # [88, 88, 88, 255],
529
+ # [110, 110, 110, 255],
530
+ # [132, 132, 132, 255],
531
+ # [154, 154, 154, 255],
532
+ # [176, 176, 176, 255],
533
+ # [198, 198, 198, 255],
534
+ # [255, 255, 255, 255]], dtype=np.int32)
535
+
521
536
  self.fill_segmentdata()
522
537
 
523
538
  def fill_segmentdata(self):
wolfhece/apps/version.py CHANGED
@@ -5,7 +5,7 @@ class WolfVersion():
5
5
 
6
6
  self.major = 2
7
7
  self.minor = 1
8
- self.patch = 39
8
+ self.patch = 40
9
9
 
10
10
  def __str__(self):
11
11
 
wolfhece/pyviews.py CHANGED
@@ -11,18 +11,25 @@ copying or distribution of this file, via any medium, is strictly prohibited.
11
11
  import logging
12
12
 
13
13
  from .drawing_obj import Element_To_Draw
14
- from .wolf_array import WolfArray,WolfArrayMB, VERSION_RGB
14
+ from .wolf_array import WolfArray, WolfArrayMB, VERSION_RGB, wolfpalette
15
15
  from .PyParams import Wolf_Param, key_Param, Type_Param
16
16
 
17
+
17
18
  class WolfViews(Element_To_Draw):
19
+ """ Class to permit complex views, combination of
20
+ different objects which can be plotted.
21
+
22
+ Inherits from Element_To_Draw."""
18
23
 
19
24
  def __init__(self, idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False) -> None:
25
+ """ Constructor of the class WolfViews."""
26
+
20
27
  super().__init__(idx, plotted, mapviewer, need_for_wx)
21
28
 
22
29
  self.view = []
23
30
  self.pals = []
24
31
 
25
- def read_from_file(self,fn):
32
+ def read_from_file(self, fn):
26
33
  myproject = Wolf_Param(None, filename=fn, toShow=False)
27
34
 
28
35
  mykeys = ['cross_sections', 'vector', 'array']
@@ -57,7 +64,6 @@ class WolfViews(Element_To_Draw):
57
64
  # else:
58
65
  # wx.LogMessage(_('Bad parameter in project file - array : ')+ curname[key_Param.VALUE])
59
66
 
60
-
61
67
  # if 'wolf2d' in myproject.myparams.keys():
62
68
  # for curid, curname in zip(myproject.myparams['wolf2d'].keys(), myproject.myparams['wolf2d'].values()):
63
69
  # if exists(curname[key_Param.VALUE]):
@@ -157,58 +163,110 @@ class WolfViews(Element_To_Draw):
157
163
  # del wait
158
164
 
159
165
  def change_gui(self, newmapviewer):
166
+ """ Change the mapviewer of the view and all its elements."""
167
+
160
168
  self.mapviewer = newmapviewer
161
169
 
162
170
  for cur in self.view:
163
- if isinstance(cur,WolfArray) or isinstance(cur,WolfArrayMB):
171
+ if isinstance(cur, WolfArray) or isinstance(cur, WolfArrayMB):
164
172
  cur.change_gui(newmapviewer)
165
173
  else:
166
174
  cur.mapviewer = newmapviewer
167
175
 
168
- def add_elemt(self,added_elemt,pal=None):
176
+ def add_elemt(self, added_elemt, pal=None):
177
+ """ Add an element to the view.
178
+
179
+ :param added_elemt: Element to add.
180
+ :param pal: Palette to use for the element.
181
+ """
182
+
183
+ assert isinstance(added_elemt, Element_To_Draw), 'The element to add must be a subclass of Element_To_Draw'
184
+
169
185
  self.view.append(added_elemt)
170
186
  self.pals.append(pal)
171
187
 
172
- def add_elemts(self,added_elemts:list,pals=None):
188
+ def add_elemts(self, added_elemts: list, pals=None):
189
+ """ Add a list of elements to the view.
190
+
191
+ :param added_elemts: List of elements to add.
192
+ :param pals: List of palettes to use for the elements.
193
+ """
194
+
195
+ for cur in added_elemts:
196
+ assert isinstance(cur, Element_To_Draw), 'The element to add must be a subclass of Element_To_Draw'
197
+
173
198
  self.view += added_elemts
174
199
 
175
200
  if pals is None:
176
201
  self.pals += [None]*len(added_elemts)
177
202
  else:
203
+ if len(pals) != len(added_elemts):
204
+ logging.warning('The number of palettes must be the same as the number of elements.')
205
+
206
+ if len(pals) < len(added_elemts):
207
+ logging.warning('The missing palettes will be set to None.')
208
+ pals += [None]*(len(added_elemts)-len(pals))
209
+ else:
210
+ logging.warning('The extra palettes will be ignored.')
211
+ pals = pals[:len(added_elemts)]
212
+
178
213
  self.pals += pals
179
214
 
180
215
  def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
216
+ """ Plot the view. """
181
217
 
182
218
  if self.plotted:
183
219
 
184
220
  for cur, pal in zip(self.view, self.pals):
221
+ # iterate over the elements and their palettes
222
+ pal: wolfpalette
223
+
185
224
  oldplotted = cur.plotted
186
- cur.plotted=True
225
+ cur.plotted = True
187
226
 
188
- if isinstance(cur,WolfArray):
189
- if VERSION_RGB ==1:
227
+ if isinstance(cur, WolfArray):
228
+ #
229
+ if VERSION_RGB == 1:
230
+ # Will be deprecated in future versions
190
231
  if cur.rgb is None:
191
232
  if pal is not None:
192
233
  cur.rgb = pal.get_rgba(cur.array)
193
234
  else:
194
235
  cur.mypal.defaultgray_minmax(cur.array)
195
236
  cur.rgb = cur.mypal.get_rgba(cur.array)
237
+ cur.plot(sx, sy, xmin, ymin, xmax, ymax)
196
238
  elif VERSION_RGB == 2:
197
239
  if pal is None:
198
- cur.mypal.defaultgray_minmax(cur.array)
240
+ # using the current palette
241
+ cur.plot(sx, sy, xmin, ymin, xmax, ymax)
242
+ else:
243
+ # using the palette passed as argument
244
+
245
+ # memorize the current palette
246
+ oldpal = cur.mypal
247
+ # change the palette
248
+ cur.mypal = pal
249
+ # plot the array
250
+ cur.plot(sx, sy, xmin, ymin, xmax, ymax)
251
+ # restore the palette
252
+ cur.mypal = oldpal
253
+
254
+ else:
255
+ cur.plot(sx, sy, xmin, ymin, xmax, ymax)
199
256
 
200
- cur.plot(sx,sy,xmin,ymin,xmax,ymax)
201
257
  cur.plotted = oldplotted
202
258
 
203
259
  def find_minmax(self):
260
+ """ Find the spatial bounds of the view."""
261
+
204
262
  xmin = 1.e30
205
263
  ymin = 1.e30
206
264
  xmax = -1.e30
207
265
  ymax = -1.e30
208
266
 
209
267
  for cur in self.view:
210
- if isinstance(cur,WolfArray) or isinstance(cur,WolfArrayMB):
211
- x,y = cur.get_bounds()
268
+ if isinstance(cur, WolfArray) or isinstance(cur, WolfArrayMB):
269
+ x, y = cur.get_bounds()
212
270
  xmin = min(x[0], xmin)
213
271
  xmax = max(x[1], xmax)
214
272
  ymin = min(y[0], ymin)
@@ -4045,8 +4045,11 @@ class Wolfresults_2D(Element_To_Draw):
4045
4045
  self.palgray.defaultgray()
4046
4046
  self.palblue.defaultblue()
4047
4047
 
4048
- self.palgray.values[0],self.palgray.values[-1] = self.get_min_max(views_2D.TOPOGRAPHY)
4049
- self.palblue.values[0],self.palblue.values[-1] = self.get_min_max(views_2D.WATERDEPTH)
4048
+ locmin, locmax = self.get_min_max(views_2D.TOPOGRAPHY)
4049
+ self.palgray.distribute_values(locmin, locmax)
4050
+
4051
+ locmin, locmax = self.get_min_max(views_2D.WATERDEPTH)
4052
+ self.palblue.distribute_values(locmin, locmax)
4050
4053
 
4051
4054
  if self.mypal.automatic:
4052
4055
  # self.mypal.default16()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.39
3
+ Version: 2.1.40
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  License: Copyright (c) 2024 University of Liege. All rights reserved.
6
6
  Project-URL: Homepage, https://uee.uliege.be/hece
@@ -10,7 +10,7 @@ wolfhece/PyDraw.py,sha256=MQO149Cp8QtxWceXpKWLsDbE6JBrVbqEWoAOXWfHl2w,390751
10
10
  wolfhece/PyGui.py,sha256=_1LKelusQ-FS0AtgpwFiXKMZ2glky7K1WINTI93H0k0,103438
11
11
  wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
12
12
  wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
13
- wolfhece/PyPalette.py,sha256=uxibQSz5u1q8bgZv-VId6o_SI5TTfLHPs9DpJomVwSA,27179
13
+ wolfhece/PyPalette.py,sha256=5TvXF5wWDxP4e70zO9B0UMgVP9c0oAzerM28aoJ1CTg,27982
14
14
  wolfhece/PyParams.py,sha256=wwgmP-_7wiiPLTcyX8a5jR6FyC1D2c4oBPc1VWQqtSA,97383
15
15
  wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
16
16
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
@@ -42,7 +42,7 @@ wolfhece/pydike.py,sha256=hPBQsmSTW4QAp1wcOzb-TL3L7eet2WT1sJx2q-WNQ-Q,2241
42
42
  wolfhece/pylogging.py,sha256=4TI8hgBB65z-zpvU5Rfa2jkPXPhJaqXjHVPwbcdzTNc,4528
43
43
  wolfhece/pypolygons_scen.py,sha256=x-tnYLNq3MPV51NbaU14trgRj8qyUyOrMdF1zDsUX3I,37444
44
44
  wolfhece/pyshields.py,sha256=7k-qe2EJgr9fJE62jyPmlWQwRj8T0DK4iuMU844ZhYs,23281
45
- wolfhece/pyviews.py,sha256=jSTXCsmzw5OIZusj3Ynfd2o2XvRq7TaDnbt-dyNlbi0,10198
45
+ wolfhece/pyviews.py,sha256=AUtJY5V43XVH9juIKUSsozKbpkXHCEkWxn0GWuvAo_0,12562
46
46
  wolfhece/pywalous.py,sha256=yRaWJjKckXef1d9D5devP0yFHC9uc6kRV4G5x9PNq9k,18972
47
47
  wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
48
48
  wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
@@ -53,7 +53,7 @@ wolfhece/wolf_texture.py,sha256=EqZI6qCR6ouT3wEtnG_NkVLdvUhfY65JVTj5b6o4lXI,1657
53
53
  wolfhece/wolf_tiles.py,sha256=2Ho2I20rHRY81KXxjgLOYISdF4OkJ2d6omeY4shDoGI,10386
54
54
  wolfhece/wolf_vrt.py,sha256=89XoDhCJMHiwPQUuOduxtTRKuIa8RDxgNqX65S4xp9M,10569
55
55
  wolfhece/wolf_zi_db.py,sha256=baE0niMCzybWGSvPJc5FNxo9ZxsGfU4p-FmfiavFHAs,12967
56
- wolfhece/wolfresults_2D.py,sha256=MlvE2OoSwk1P_CeTwotV1QDBJYeHhSCjUprG3c42tRc,165714
56
+ wolfhece/wolfresults_2D.py,sha256=REuQy3fFiEUXt9lNZk0gOg7FbcDEjzAfFNa5H3JqOzg,165764
57
57
  wolfhece/xyz_file.py,sha256=Se4nCPwYAYLSA5i0zsbnZUKoAMAD0mK1FJea5WSZUkk,5755
58
58
  wolfhece/acceptability/Parallels.py,sha256=h4tu3SpC_hR5Hqa68aruxhtAyhs8u666YuZ40_fR5zg,3979
59
59
  wolfhece/acceptability/__init__.py,sha256=hfgoPKLDpX7drN1Vpvux-_5Lfyc_7feT2C2zQr5v-Os,258
@@ -71,7 +71,7 @@ wolfhece/apps/check_install.py,sha256=icFpkjfwNGDX-0NZVa-ijrCrqmGHEKDiFphjN8uTyh
71
71
  wolfhece/apps/curvedigitizer.py,sha256=_hRR2PWow7PU7rTHIbc6ykZ08tCXcK9uy7RFrb4EKkE,5196
72
72
  wolfhece/apps/isocurrent.py,sha256=MuwTodHxdc6PrqNpphR2ntYf1NLL2n9klTPndGrOHDQ,4109
73
73
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
74
- wolfhece/apps/version.py,sha256=9TV-RYEEy9X0HeZ9xYxf6PRts-on5mB43zJZtbq4_bY,388
74
+ wolfhece/apps/version.py,sha256=9XDKRloyrzZNK6z5DhCF-kSsL5NjAunRSHtKAYMCOGo,388
75
75
  wolfhece/apps/wolf.py,sha256=mM6Tyi4DlKQILmO49cDUCip9fYVy-hLXkY3YhZgIeUQ,591
76
76
  wolfhece/apps/wolf2D.py,sha256=yPQGee7fsegoQ8GfWKrWEjX1Az_ApL-UWlBiqPvaIyY,565
77
77
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -249,8 +249,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
249
249
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
250
250
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
251
251
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
252
- wolfhece-2.1.39.dist-info/METADATA,sha256=83wPlCtt2A7BPb-3QuxZrLSWn3AGA5uppBHC79HuiBU,2463
253
- wolfhece-2.1.39.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
254
- wolfhece-2.1.39.dist-info/entry_points.txt,sha256=yggeO1Fa80pi2BrOd9k5dTkiFlefGPwG6HztZhY0-qw,366
255
- wolfhece-2.1.39.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
256
- wolfhece-2.1.39.dist-info/RECORD,,
252
+ wolfhece-2.1.40.dist-info/METADATA,sha256=6rjW5iWLs6aXBGRGKa5nQ04PDAos4TOPGh8e0et5qhI,2463
253
+ wolfhece-2.1.40.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
254
+ wolfhece-2.1.40.dist-info/entry_points.txt,sha256=yggeO1Fa80pi2BrOd9k5dTkiFlefGPwG6HztZhY0-qw,366
255
+ wolfhece-2.1.40.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
256
+ wolfhece-2.1.40.dist-info/RECORD,,