wolfhece 2.2.16__py3-none-any.whl → 2.2.18__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 +104 -14
- wolfhece/PyGui.py +6 -0
- wolfhece/PyParams.py +29 -0
- wolfhece/PyVertexvectors.py +191 -19
- wolfhece/Results2DGPU.py +9 -0
- wolfhece/analyze_poly.py +335 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/assets/mesh.py +128 -6
- wolfhece/hydrometry/kiwis_wolfgui.py +7 -8
- wolfhece/lazviewer/__init__.py +21 -12
- wolfhece/mesh2d/bc_manager.py +1 -1
- wolfhece/mesh2d/gpu_2d.py +46 -10
- wolfhece/mesh2d/wolf2dprev.py +12 -0
- wolfhece/os_check.py +16 -0
- wolfhece/pydike.py +245 -41
- wolfhece/tools2d_dll.py +6 -0
- wolfhece/wolf_array.py +427 -55
- wolfhece/wolf_texture.py +1 -0
- wolfhece/wolfresults_2D.py +578 -195
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.18.dist-info}/METADATA +1 -1
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.18.dist-info}/RECORD +24 -22
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.18.dist-info}/WHEEL +1 -1
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.18.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.16.dist-info → wolfhece-2.2.18.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -797,7 +797,12 @@ class DragdropFileTarget(wx.FileDropTarget):
|
|
797
797
|
id = id + '_1'
|
798
798
|
|
799
799
|
try:
|
800
|
-
|
800
|
+
h = header_wolf.read_header(name)
|
801
|
+
|
802
|
+
if h.nb_blocks>0:
|
803
|
+
newobj = WolfArrayMB(fname=name, mapviewer= self.window)
|
804
|
+
else:
|
805
|
+
newobj = WolfArray(fname=name, mapviewer= self.window)
|
801
806
|
self.window.add_object('array', newobj = newobj, id = id)
|
802
807
|
except:
|
803
808
|
logging.error(_('Error while loading array : ') + name)
|
@@ -2072,7 +2077,7 @@ class WolfMapViewer(wx.Frame):
|
|
2072
2077
|
self.popupmenu = wx.Menu()
|
2073
2078
|
self.popupmenu.Bind(wx.EVT_MENU, self.OnPopupItemSelected)
|
2074
2079
|
|
2075
|
-
for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Delete'), _('Up'), _('Down'), _('Check/Uncheck'), _('Properties')]:
|
2080
|
+
for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Delete'), _('Up'), _('Down'), _('Check/Uncheck'), _('Properties'), _('Reload')]:
|
2076
2081
|
item = self.popupmenu.Append(-1, text)
|
2077
2082
|
|
2078
2083
|
self.menubar = wx.MenuBar()
|
@@ -2290,9 +2295,9 @@ class WolfMapViewer(wx.Frame):
|
|
2290
2295
|
|
2291
2296
|
self.analyzeplot.AppendSeparator()
|
2292
2297
|
|
2293
|
-
self.analyzemenu.Append(wx.ID_ANY,_('Plot...'),self.analyzeplot)
|
2294
|
-
self.analyzemenu.Append(wx.ID_ANY,_('Export...'),self.analyzeexport)
|
2295
|
-
self.analyzemenu.Append(wx.ID_ANY,_('Inpaint...'),self.analyzeinpaint)
|
2298
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Plot...'), self.analyzeplot)
|
2299
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Export...'), self.analyzeexport)
|
2300
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Inpaint...'), self.analyzeinpaint)
|
2296
2301
|
|
2297
2302
|
|
2298
2303
|
self.analyzeinpaint.Append(wx.ID_ANY, _("Inpaint active array..."), _("Inpaint active array"))
|
@@ -2695,12 +2700,19 @@ class WolfMapViewer(wx.Frame):
|
|
2695
2700
|
self.trianglesmenu = wx.Menu()
|
2696
2701
|
self.menubar.Append(self.trianglesmenu, _('&Triangulations'))
|
2697
2702
|
|
2698
|
-
self._menuinteractptri = self.trianglesmenu.Append(wx.ID_ANY, _("Interpolate on active triangulation..."),
|
2703
|
+
self._menuinteractptri = self.trianglesmenu.Append(wx.ID_ANY, _("Interpolate on active triangulation..."),
|
2704
|
+
_('Interpolate active array on active triangulation'))
|
2705
|
+
|
2706
|
+
self._menuinteractptri_above = self.trianglesmenu.Append(wx.ID_ANY, _("Interpolate on active triangulation (keep only above)..."),
|
2707
|
+
_('Interpolate active array on active triangulation but keep only values above the array'))
|
2708
|
+
|
2709
|
+
self._menuinteractptri_below = self.trianglesmenu.Append(wx.ID_ANY, _("Interpolate on active triangulation (keep only below)..."),
|
2710
|
+
_('Interpolate active array on active triangulation but keep only values below the array'))
|
2711
|
+
|
2699
2712
|
self._menucomparetri = self.trianglesmenu.Append(wx.ID_ANY, _("Compare triangles to array..."), _("Comparison"))
|
2700
2713
|
self._menumovetri = self.trianglesmenu.Append(wx.ID_ANY, _("Move triangles..."), _("Move triangles"))
|
2701
2714
|
self._menurotatetri = self.trianglesmenu.Append(wx.ID_ANY, _("Rotate triangles..."), _("Rotate triangles"))
|
2702
2715
|
|
2703
|
-
|
2704
2716
|
def create_cloud_menu(self):
|
2705
2717
|
""" Menu for cloud points """
|
2706
2718
|
|
@@ -2887,7 +2899,7 @@ class WolfMapViewer(wx.Frame):
|
|
2887
2899
|
self.menuwolf2d.AppendSeparator()
|
2888
2900
|
|
2889
2901
|
self.menu2d_dangermap = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map"), _("Compute the danger map"))
|
2890
|
-
|
2902
|
+
self.menu2d_dangermap_mp = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map (multiprocess)"), _("Compute the danger map using multiprocessing -- Need to duplicate the model, the memory usage can be very high for large model"))
|
2891
2903
|
self.menu2d_dangermaph = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map - only h"), _("Compute the danger map - only waterdepth"))
|
2892
2904
|
|
2893
2905
|
self.menuwolf2d.AppendSeparator()
|
@@ -2996,6 +3008,29 @@ class WolfMapViewer(wx.Frame):
|
|
2996
3008
|
|
2997
3009
|
return [xmin, ymin, xmax, ymax]
|
2998
3010
|
|
3011
|
+
def get_bounds(self):
|
3012
|
+
"""
|
3013
|
+
Retourne les limites de la zone d'affichage, voir aussi get_canvas_bounds
|
3014
|
+
|
3015
|
+
:return: ([xmin, xmax], [ymin, ymax])
|
3016
|
+
"""
|
3017
|
+
xmin, ymin, xmax, ymax = self.get_canvas_bounds()
|
3018
|
+
return ([xmin, xmax], [ymin, ymax])
|
3019
|
+
|
3020
|
+
def get_bounds_as_polygon(self) -> vector:
|
3021
|
+
"""
|
3022
|
+
Retourne les limites de la zone d'affichage sous forme de polygone
|
3023
|
+
:return: vector
|
3024
|
+
"""
|
3025
|
+
xmin, ymin, xmax, ymax = self.get_canvas_bounds()
|
3026
|
+
poly = vector()
|
3027
|
+
poly.add_vertex(wolfvertex(xmin, ymin))
|
3028
|
+
poly.add_vertex(wolfvertex(xmax, ymin))
|
3029
|
+
poly.add_vertex(wolfvertex(xmax, ymax))
|
3030
|
+
poly.add_vertex(wolfvertex(xmin, ymax))
|
3031
|
+
poly.force_to_close()
|
3032
|
+
return poly
|
3033
|
+
|
2999
3034
|
def Onmenuwalous(self, event: wx.MenuEvent):
|
3000
3035
|
|
3001
3036
|
id = event.GetId()
|
@@ -3519,16 +3554,21 @@ class WolfMapViewer(wx.Frame):
|
|
3519
3554
|
every = dlg.GetValue()
|
3520
3555
|
|
3521
3556
|
if itemlabel == _("Danger map"):
|
3557
|
+
logging.info(_('Danger map -- Be patient !'))
|
3522
3558
|
pgbar = wx.ProgressDialog(_('Danger map'), _('Danger map'), maximum = end_step-1, parent=self, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
|
3523
3559
|
def _callback(id, msg):
|
3524
3560
|
pgbar.Update(id+1-start_step, msg)
|
3525
3561
|
|
3526
|
-
danger_maps = self.active_res2d.
|
3562
|
+
danger_maps = self.active_res2d.danger_map(start_step-1, end_step-1, every, _callback)
|
3527
3563
|
|
3528
3564
|
pgbar.Hide()
|
3529
3565
|
pgbar.Destroy()
|
3566
|
+
logging.info(_('Danger map done !'))
|
3530
3567
|
else:
|
3568
|
+
|
3569
|
+
logging.info(_('Multiprocess danger map -- Be patient !'))
|
3531
3570
|
danger_maps = self.active_res2d.danger_map_multiprocess(start_step-1, end_step-1, every)
|
3571
|
+
logging.info(_('Multiprocess danger map done !'))
|
3532
3572
|
|
3533
3573
|
with wx.DirDialog(None, _('Choose a directory to store results'), style=wx.DD_DEFAULT_STYLE) as dlg:
|
3534
3574
|
|
@@ -3537,9 +3577,24 @@ class WolfMapViewer(wx.Frame):
|
|
3537
3577
|
|
3538
3578
|
outdir = dlg.GetPath()
|
3539
3579
|
|
3540
|
-
names = ['danger_h
|
3580
|
+
names = ['danger_h', 'danger_u',
|
3581
|
+
'danger_q', 'danger_Z',
|
3582
|
+
'danger_head',
|
3583
|
+
'danger_toal', 'danger_tom']
|
3584
|
+
|
3541
3585
|
for name, danger_map in zip(names, danger_maps):
|
3542
|
-
|
3586
|
+
|
3587
|
+
if isinstance(danger_map, WolfArrayMB):
|
3588
|
+
name = name + '.bin'
|
3589
|
+
logging.info(_('Saving danger map {}').format(name))
|
3590
|
+
danger_map.write_all(Path(outdir) / name)
|
3591
|
+
elif isinstance(danger_map, WolfArray):
|
3592
|
+
name = name + '.tif'
|
3593
|
+
logging.info(_('Saving danger map {}').format(name))
|
3594
|
+
danger_map.write_all(Path(outdir) / name)
|
3595
|
+
else:
|
3596
|
+
logging.error(_('Bad type for danger map {} -- not saved !').format(name))
|
3597
|
+
continue
|
3543
3598
|
|
3544
3599
|
elif itemlabel == _("Setup cache..."):
|
3545
3600
|
|
@@ -4365,7 +4420,11 @@ class WolfMapViewer(wx.Frame):
|
|
4365
4420
|
|
4366
4421
|
self.myinterp.interp_on_array(self.active_array, method)
|
4367
4422
|
|
4368
|
-
def interpolate_triangulation(self):
|
4423
|
+
def interpolate_triangulation(self, keep:Literal['all', 'above', 'below'] = 'all'):
|
4424
|
+
""" Alias to interpolate on triangulation
|
4425
|
+
|
4426
|
+
:param keep: 'all' to keep all points, 'above' to keep only points above the current array's value, 'below' to keep only points below the current array's value
|
4427
|
+
"""
|
4369
4428
|
|
4370
4429
|
if self.active_array is None:
|
4371
4430
|
logging.warning(_('No active array -- Please activate an array first'))
|
@@ -4375,7 +4434,7 @@ class WolfMapViewer(wx.Frame):
|
|
4375
4434
|
logging.warning(_('No active triangulation -- Please activate a triangulation first'))
|
4376
4435
|
return
|
4377
4436
|
|
4378
|
-
self.active_array.interpolate_on_triangulation(self.active_tri.pts, self.active_tri.tri, )
|
4437
|
+
self.active_array.interpolate_on_triangulation(self.active_tri.pts, self.active_tri.tri, keep=keep)
|
4379
4438
|
|
4380
4439
|
def compare_cloud2array(self):
|
4381
4440
|
"""
|
@@ -8404,7 +8463,13 @@ class WolfMapViewer(wx.Frame):
|
|
8404
8463
|
# self.import_3dfaces()
|
8405
8464
|
|
8406
8465
|
elif itemlabel == _("Interpolate on active triangulation..."):
|
8407
|
-
self.interpolate_triangulation()
|
8466
|
+
self.interpolate_triangulation(keep='all')
|
8467
|
+
|
8468
|
+
elif itemlabel == _("Interpolate on active triangulation (keep only above)..."):
|
8469
|
+
self.interpolate_triangulation(keep='above')
|
8470
|
+
|
8471
|
+
elif itemlabel == _("Interpolate on active triangulation (keep only below)..."):
|
8472
|
+
self.interpolate_triangulation(keep='below')
|
8408
8473
|
|
8409
8474
|
elif itemlabel==_("Compare cloud to array..."):
|
8410
8475
|
self.compare_cloud2array()
|
@@ -11540,6 +11605,31 @@ class WolfMapViewer(wx.Frame):
|
|
11540
11605
|
|
11541
11606
|
dlg.Destroy()
|
11542
11607
|
|
11608
|
+
elif _('Reload') in text:
|
11609
|
+
|
11610
|
+
if isinstance(self.selected_object, WolfArray):
|
11611
|
+
if self.selected_object.filename is not None:
|
11612
|
+
|
11613
|
+
dlg = wx.MessageDialog(None, _('Do you want to reload the file ?'), _('Reload'), wx.YES_NO | wx.NO_DEFAULT)
|
11614
|
+
ret = dlg.ShowModal()
|
11615
|
+
if ret == wx.ID_YES:
|
11616
|
+
self.selected_object.read_all()
|
11617
|
+
self.selected_object.mask_data(self.selected_object.nullvalue)
|
11618
|
+
self.selected_object.reset_plot()
|
11619
|
+
|
11620
|
+
dlg.Destroy()
|
11621
|
+
# elif isinstance(self.selected_object, Zones):
|
11622
|
+
# if self.selected_object.filename is not None:
|
11623
|
+
# dlg = wx.MessageDialog(None, _('Do you want to reload the file ?'), _('Reload'), wx.YES_NO | wx.NO_DEFAULT)
|
11624
|
+
# ret = dlg.ShowModal()
|
11625
|
+
# if ret == wx.ID_YES:
|
11626
|
+
# self.selected_object.read()
|
11627
|
+
|
11628
|
+
# dlg.Destroy()
|
11629
|
+
|
11630
|
+
else:
|
11631
|
+
logging.warning(_('Reload not yet implemented for this type of object'))
|
11632
|
+
|
11543
11633
|
def OnClose(self, event):
|
11544
11634
|
""" Close the application """
|
11545
11635
|
|
wolfhece/PyGui.py
CHANGED
@@ -2915,6 +2915,12 @@ class Wolf2DGPUModel(GenMapManager):
|
|
2915
2915
|
if force_reload:
|
2916
2916
|
self._sim.reload_all()
|
2917
2917
|
for cur in self.arrays.values():
|
2918
|
+
|
2919
|
+
if cur.idx == 'water surface elevation [m]':
|
2920
|
+
## Force to recompute the water surface elevation
|
2921
|
+
cur.array.data[:,:] = self.arrays['bathymetry'].array.data[:,:] + self.arrays['h'].array.data[:,:]
|
2922
|
+
cur.array.mask[:,:] = self.arrays['bathymetry'].array.mask[:,:]
|
2923
|
+
|
2918
2924
|
cur.reset_plot()
|
2919
2925
|
# self.mapviewer.Refresh()
|
2920
2926
|
else:
|
wolfhece/PyParams.py
CHANGED
@@ -333,6 +333,35 @@ class Wolf_Param(wx.Frame):
|
|
333
333
|
toShow,
|
334
334
|
toolbar=toolbar)
|
335
335
|
|
336
|
+
def __getstate__(self):
|
337
|
+
state = self.__dict__.copy()
|
338
|
+
# Remove the wxPython GUI from the state to avoid pickling issues
|
339
|
+
state.pop('prop', None)
|
340
|
+
state.pop('sizer', None)
|
341
|
+
state.pop('callback', None)
|
342
|
+
state.pop('callbackdestroy', None)
|
343
|
+
state.pop('DestroyAtClosing', None)
|
344
|
+
state.pop('show_in_active_if_default', None)
|
345
|
+
state.pop('sizerbut', None)
|
346
|
+
state.pop('myIncGroup', None)
|
347
|
+
state.pop('myIncParam', None)
|
348
|
+
state.pop('update_incr_at_every_change', None)
|
349
|
+
state.pop('wxparent', None)
|
350
|
+
state.pop('gui_hydrometry', None)
|
351
|
+
state.pop('cloud_stations_real', None)
|
352
|
+
state.pop('cloud_stations', None)
|
353
|
+
state.pop('gui_hydrometry', None)
|
354
|
+
|
355
|
+
return state
|
356
|
+
|
357
|
+
def __setstate__(self, state):
|
358
|
+
|
359
|
+
self.__dict__.update(state)
|
360
|
+
|
361
|
+
# Reinitialize the wxPython GUI if it was not initialized before pickling
|
362
|
+
if self.wx_exists:
|
363
|
+
self._set_gui()
|
364
|
+
|
336
365
|
@property
|
337
366
|
def has_prop(self) -> bool:
|
338
367
|
""" Return True if the property grid is available """
|