wolfhece 2.1.100__py3-none-any.whl → 2.1.102__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 +207 -16
- wolfhece/PyGui.py +1039 -53
- wolfhece/Results2DGPU.py +37 -13
- wolfhece/acceptability/func.py +43 -32
- wolfhece/apps/version.py +1 -1
- wolfhece/bernoulli/losses.py +3 -3
- wolfhece/gpuview.py +4 -1
- wolfhece/libs/__init__.py +11 -10
- wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
- wolfhece/math_parser/calculator.py +5 -4
- wolfhece/mesh2d/bc_manager.py +25 -2
- wolfhece/mesh2d/gpu_2d.py +647 -0
- wolfhece/mesh2d/simple_2d.py +581 -163
- wolfhece/mesh2d/wolf2dprev.py +4 -1
- wolfhece/scenario/check_scenario.py +11 -0
- wolfhece/scenario/config_manager.py +257 -53
- wolfhece/scenario/update_void.py +34 -3
- wolfhece/wolf_array.py +261 -79
- wolfhece/wolfresults_2D.py +53 -20
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.102.dist-info}/METADATA +3 -1
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.102.dist-info}/RECORD +24 -23
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.102.dist-info}/WHEEL +1 -1
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.102.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.102.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -262,7 +262,7 @@ class Memory_Views_GUI(wx.Frame):
|
|
262
262
|
def __init__(self, parent, title, memory_views:Memory_Views, mapviewer:"WolfMapViewer"):
|
263
263
|
""" Constructor """
|
264
264
|
|
265
|
-
super(Memory_Views_GUI, self).__init__(parent, title=title, size=(200, 400), style = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX
|
265
|
+
super(Memory_Views_GUI, self).__init__(parent, title=title, size=(200, 400), style = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX))
|
266
266
|
self.mapviewer = mapviewer
|
267
267
|
self._memory_views = memory_views
|
268
268
|
|
@@ -1241,6 +1241,7 @@ class WolfMapViewer(wx.Frame):
|
|
1241
1241
|
self.menuwalous = None
|
1242
1242
|
self.timer_ps = None
|
1243
1243
|
self.menusim2D = None
|
1244
|
+
self.menusim2D_GPU = None
|
1244
1245
|
self.menulaz = None
|
1245
1246
|
self.menutiles = None
|
1246
1247
|
|
@@ -1267,14 +1268,31 @@ class WolfMapViewer(wx.Frame):
|
|
1267
1268
|
|
1268
1269
|
# SIMULATION 2D
|
1269
1270
|
|
1270
|
-
|
1271
|
-
|
1271
|
+
self.menu_sim2d = wx.Menu()
|
1272
|
+
self.menu_sim2d_cpu = wx.Menu()
|
1273
|
+
self.menu_sim2d_gpu = wx.Menu()
|
1274
|
+
self.menu_sim1d = wx.Menu()
|
1272
1275
|
|
1273
|
-
self.
|
1276
|
+
sim2d = self.menu_sim2d_cpu.Append(wx.ID_ANY, _('Create/Open multiblock model'), _('Create or open a multiblock model in the viewer --> CPU/Fortran Wolf2D model'))
|
1277
|
+
check2D = self.menu_sim2d_cpu.Append(wx.ID_ANY, _('Check headers'), _('Check the header .txt files from an existing 2D CPU simulation'))
|
1278
|
+
|
1279
|
+
sim2dgpu = self.menu_sim2d_gpu.Append(wx.ID_ANY, _('Create/Open GPU model'), _('Create or open a GPU model in the viewer --> GPU Wolf2D model'))
|
1280
|
+
|
1281
|
+
create1Dmodel = self.menu_sim1d.Append(wx.ID_ANY, _('Create Wolf1D...'),('Create a 1D model using crossections, vectors and arrays...'))
|
1282
|
+
|
1283
|
+
|
1284
|
+
self.menu_sim2d.Append(wx.ID_ANY,_('2D GPU'),self.menu_sim2d_gpu)
|
1285
|
+
self.menu_sim2d.Append(wx.ID_ANY,_('2D CPU'),self.menu_sim2d_cpu)
|
1286
|
+
self.filemenu.Append(wx.ID_ANY,_('2D Model'),self.menu_sim2d)
|
1287
|
+
self.filemenu.Append(wx.ID_ANY,_('1D Model'),self.menu_sim1d)
|
1288
|
+
|
1289
|
+
# self.filemenu.AppendSeparator()
|
1274
1290
|
|
1275
1291
|
# SIMULATION Hydrologique
|
1276
1292
|
|
1277
|
-
|
1293
|
+
self.menu_hydrology = wx.Menu()
|
1294
|
+
hydrol = self.menu_hydrology.Append(wx.ID_ANY, _('Open Hydrological model'), _('Hydrological simulation'))
|
1295
|
+
self.filemenu.Append(wx.ID_ANY,_('Hydrology'),self.menu_hydrology)
|
1278
1296
|
|
1279
1297
|
self.filemenu.AppendSeparator()
|
1280
1298
|
|
@@ -1302,7 +1320,6 @@ class WolfMapViewer(wx.Frame):
|
|
1302
1320
|
createscenario2D = self.menucreateobj.Append(wx.ID_ANY, _('Create scenarios manager ...'), _('New scenarios manager 2D'))
|
1303
1321
|
createbcmanager2D = self.menucreateobj.Append(wx.ID_ANY, _('Create BC manager Wolf2D...'), _('New BC manager 2D'))
|
1304
1322
|
createpartsystem = self.menucreateobj.Append(wx.ID_ANY, _('Create particle system...'), _('Create a particle system - Lagrangian view'))
|
1305
|
-
create1Dmodel = self.menucreateobj.Append(wx.ID_ANY, _('Create Wolf1D...'),('Create a 1D model using crossections, vectors and arrays...'))
|
1306
1323
|
create_acceptability = self.menucreateobj.Append(wx.ID_ANY, _('Create acceptability manager...'), _('Create acceptability manager'))
|
1307
1324
|
|
1308
1325
|
self.filemenu.AppendSeparator()
|
@@ -1395,10 +1412,19 @@ class WolfMapViewer(wx.Frame):
|
|
1395
1412
|
_("Apply mask from sim2D"))
|
1396
1413
|
filterinund = self.analyzemenu.Append(wx.ID_ANY, _("Filter inundation arrays..."),
|
1397
1414
|
_("Filter arrays"))
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1415
|
+
# Plot hydrographs
|
1416
|
+
self.menuHydrographs = wx.Menu()
|
1417
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Integrate Q...'),self.menuHydrographs)
|
1418
|
+
plotqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Plot integrated Q along active vector..."),
|
1419
|
+
_("Integrate Q along the active vector and plot"))
|
1420
|
+
plotqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Plot integrated Q along active zone..."),
|
1421
|
+
_("Integrate Q along the active zone and plot"))
|
1422
|
+
self.menuHydrographs.AppendSeparator()
|
1423
|
+
exportqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Export integrated Q along active vector..."),
|
1424
|
+
_("Integrate Q along the active vector and export"))
|
1425
|
+
exportqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Export integrated Q along all vectors in active zone..."),
|
1426
|
+
_("Integrate Q along ALL VECTORS of the active zone and export"))
|
1427
|
+
|
1402
1428
|
plothselect = self.analyzemenu.Append(wx.ID_ANY, _("Plot stats unknown (selected nodes)..."),
|
1403
1429
|
_("Compute stats and plot on the selected nodes"))
|
1404
1430
|
plothvector = self.analyzemenu.Append(wx.ID_ANY, _("Plot stats unknown (inside active vector)..."),
|
@@ -1634,6 +1660,13 @@ class WolfMapViewer(wx.Frame):
|
|
1634
1660
|
|
1635
1661
|
newview = Wolf2DModel(splash = False)
|
1636
1662
|
|
1663
|
+
def create_2D_GPU_model(self):
|
1664
|
+
""" Create a 2D GPU model """
|
1665
|
+
|
1666
|
+
from .PyGui import Wolf2DGPUModel
|
1667
|
+
|
1668
|
+
newview = Wolf2DGPUModel(splash = False)
|
1669
|
+
|
1637
1670
|
def check_2D_MB_headers(self):
|
1638
1671
|
""" Check headers of a 2D simulation without opening viewer"""
|
1639
1672
|
|
@@ -2707,8 +2740,41 @@ class WolfMapViewer(wx.Frame):
|
|
2707
2740
|
|
2708
2741
|
self.menusim2D.Bind(wx.EVT_MENU, self.Onmenusim2D)
|
2709
2742
|
|
2743
|
+
def menu_sim2DGPU(self):
|
2744
|
+
""" Menu for 2D GPU simulations """
|
2745
|
+
|
2746
|
+
if self.menusim2D_GPU is None:
|
2747
|
+
self.menusim2D_GPU = wx.Menu()
|
2748
|
+
self.menubar.Append(self.menusim2D_GPU, _('Tools 2D GPU'))
|
2749
|
+
|
2750
|
+
menu2dGPU_options = self.menusim2D_GPU.Append(wx.ID_ANY, _("Parameters..."), _("Parameters"))
|
2751
|
+
|
2752
|
+
self.menusim2D_GPU.Bind(wx.EVT_MENU, self.Onmenusim2DGPU)
|
2753
|
+
|
2754
|
+
def Onmenusim2DGPU(self, event: wx.MenuEvent):
|
2755
|
+
""" Action to perform when menu 2D GPU entry is selected """
|
2756
|
+
|
2757
|
+
id = event.GetId()
|
2758
|
+
item = self.menubar.FindItemById(event.GetId())
|
2759
|
+
|
2760
|
+
if item is None:
|
2761
|
+
return
|
2762
|
+
|
2763
|
+
itemlabel = item.ItemLabel
|
2764
|
+
|
2765
|
+
from .PyGui import Wolf2DGPUModel
|
2766
|
+
|
2767
|
+
if not isinstance(self.wolfparent, Wolf2DGPUModel):
|
2768
|
+
logging.error(_('This is not a 2D GPUmodel'))
|
2769
|
+
return
|
2770
|
+
|
2771
|
+
self.wolfparent:Wolf2DGPUModel
|
2772
|
+
|
2773
|
+
if itemlabel == _("Parameters..."):
|
2774
|
+
self.wolfparent.show_properties()
|
2775
|
+
|
2710
2776
|
def Onmenusim2D(self, event: wx.MenuEvent):
|
2711
|
-
""" Action to perform
|
2777
|
+
""" Action to perform when menu 2D entry is selected """
|
2712
2778
|
|
2713
2779
|
id = event.GetId()
|
2714
2780
|
item = self.menubar.FindItemById(event.GetId())
|
@@ -5648,7 +5714,7 @@ class WolfMapViewer(wx.Frame):
|
|
5648
5714
|
self.check_for_updates()
|
5649
5715
|
autoscale = False
|
5650
5716
|
|
5651
|
-
elif itemlabel == _("
|
5717
|
+
elif itemlabel == _("Plot integrated Q along active vector..."):
|
5652
5718
|
""" Integrate Q along active vector """
|
5653
5719
|
autoscale = False
|
5654
5720
|
|
@@ -5656,13 +5722,17 @@ class WolfMapViewer(wx.Frame):
|
|
5656
5722
|
logging.warning(_('No active vector !'))
|
5657
5723
|
return
|
5658
5724
|
|
5725
|
+
if self.active_vector.closed:
|
5726
|
+
logging.error(_('The active vector is closed ! - You can only plot Q along a cross section not a polygon !'))
|
5727
|
+
return
|
5728
|
+
|
5659
5729
|
if self.active_res2d is None:
|
5660
5730
|
logging.warning(_('No active 2D result !'))
|
5661
5731
|
return
|
5662
5732
|
|
5663
5733
|
self.active_res2d.plot_q(self.active_vector, 'border', toshow=True)
|
5664
5734
|
|
5665
|
-
elif itemlabel == _("
|
5735
|
+
elif itemlabel == _("Plot integrated Q along active zone..."):
|
5666
5736
|
""" Integrate Q along active zone """
|
5667
5737
|
autoscale = False
|
5668
5738
|
|
@@ -5676,6 +5746,116 @@ class WolfMapViewer(wx.Frame):
|
|
5676
5746
|
|
5677
5747
|
self.active_res2d.plot_q(self.active_zone.myvectors, ['border'] * self.active_zone.nbvectors, toshow=True)
|
5678
5748
|
|
5749
|
+
elif itemlabel == _("Export integrated Q along active vector..."):
|
5750
|
+
autoscale = False
|
5751
|
+
|
5752
|
+
if self.active_vector is None:
|
5753
|
+
logging.warning(_('No active vector !'))
|
5754
|
+
return
|
5755
|
+
|
5756
|
+
if self.active_res2d is None:
|
5757
|
+
logging.warning(_('No active 2D result !'))
|
5758
|
+
return
|
5759
|
+
|
5760
|
+
filterArray = ".csv (*.csv)|*.csv|all (*.*)|*.*"
|
5761
|
+
fdlg = wx.FileDialog(self, "Choose file name : ", wildcard=filterArray,
|
5762
|
+
style=wx.FD_SAVE)
|
5763
|
+
ret = fdlg.ShowModal()
|
5764
|
+
hydrographCSVPath = None
|
5765
|
+
if ret == wx.ID_OK:
|
5766
|
+
curfil = fdlg.GetFilterIndex()
|
5767
|
+
|
5768
|
+
hydrographCSVPath = fdlg.GetPath()
|
5769
|
+
|
5770
|
+
fdlg.Destroy()
|
5771
|
+
|
5772
|
+
if hydrographCSVPath is not None:
|
5773
|
+
# Create a progress dialog
|
5774
|
+
progress_dialog = wx.ProgressDialog(
|
5775
|
+
_("Export Progress"),
|
5776
|
+
_("Exporting hydrographs..."),
|
5777
|
+
maximum=100,
|
5778
|
+
parent=self,
|
5779
|
+
style= wx.PD_AUTO_HIDE | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME
|
5780
|
+
)
|
5781
|
+
|
5782
|
+
def update_progress(progress):
|
5783
|
+
progress_dialog.Update(progress)
|
5784
|
+
|
5785
|
+
try:
|
5786
|
+
# Call the export function, passing the progress callback
|
5787
|
+
status = self.active_res2d.export_hydrographs(
|
5788
|
+
vect=self.active_vector,
|
5789
|
+
filename=hydrographCSVPath,
|
5790
|
+
progress_callback=update_progress
|
5791
|
+
)
|
5792
|
+
finally:
|
5793
|
+
progress_dialog.Destroy() # Ensure dialog is destroyed even if an error occurs
|
5794
|
+
|
5795
|
+
# Inform the user about the result
|
5796
|
+
if status:
|
5797
|
+
wx.MessageBox(_("Hydrographs exported successfully"), _("Export Hydrographs"), wx.OK | wx.ICON_INFORMATION)
|
5798
|
+
logging.info(_('Hydrographs exported successfully'))
|
5799
|
+
else:
|
5800
|
+
wx.MessageBox(_("Error exporting hydrographs"), _("Export Hydrographs"), wx.OK | wx.ICON_ERROR)
|
5801
|
+
logging.error(_('Error exporting hydrographs'))
|
5802
|
+
|
5803
|
+
|
5804
|
+
elif itemlabel == _("Export integrated Q along all vectors in active zone..."):
|
5805
|
+
autoscale = False
|
5806
|
+
|
5807
|
+
if self.active_zone is None:
|
5808
|
+
logging.warning(_('No active zone !'))
|
5809
|
+
return
|
5810
|
+
|
5811
|
+
if self.active_res2d is None:
|
5812
|
+
logging.warning(_('No active 2D result !'))
|
5813
|
+
return
|
5814
|
+
|
5815
|
+
filterArray = ".csv (*.csv)|*.csv|all (*.*)|*.*"
|
5816
|
+
fdlg = wx.FileDialog(self, "Choose file name : ", wildcard=filterArray,
|
5817
|
+
style=wx.FD_SAVE)
|
5818
|
+
ret = fdlg.ShowModal()
|
5819
|
+
hydrographCSVPath = None
|
5820
|
+
if ret == wx.ID_OK:
|
5821
|
+
curfil = fdlg.GetFilterIndex()
|
5822
|
+
|
5823
|
+
hydrographCSVPath = fdlg.GetPath()
|
5824
|
+
|
5825
|
+
fdlg.Destroy()
|
5826
|
+
|
5827
|
+
if hydrographCSVPath is not None:
|
5828
|
+
# Create a progress dialog
|
5829
|
+
progress_dialog = wx.ProgressDialog(
|
5830
|
+
_("Export Progress"),
|
5831
|
+
_("Exporting hydrographs..."),
|
5832
|
+
maximum=100,
|
5833
|
+
parent=self,
|
5834
|
+
style= wx.PD_AUTO_HIDE | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME
|
5835
|
+
)
|
5836
|
+
|
5837
|
+
def update_progress(progress):
|
5838
|
+
progress_dialog.Update(progress)
|
5839
|
+
|
5840
|
+
try:
|
5841
|
+
# Call the export function, passing the progress callback
|
5842
|
+
status = self.active_res2d.export_hydrographs(
|
5843
|
+
vect=self.active_zone,
|
5844
|
+
filename=hydrographCSVPath,
|
5845
|
+
progress_callback=update_progress
|
5846
|
+
)
|
5847
|
+
finally:
|
5848
|
+
progress_dialog.Destroy() # Ensure dialog is destroyed even if an error occurs
|
5849
|
+
|
5850
|
+
# Inform the user about the result
|
5851
|
+
if status:
|
5852
|
+
wx.MessageBox(_("Hydrographs exported successfully"), _("Export Hydrographs"), wx.OK | wx.ICON_INFORMATION)
|
5853
|
+
logging.info(_('Hydrographs exported successfully'))
|
5854
|
+
else:
|
5855
|
+
wx.MessageBox(_("Error exporting hydrographs"), _("Export Hydrographs"), wx.OK | wx.ICON_ERROR)
|
5856
|
+
logging.error(_('Error exporting hydrographs'))
|
5857
|
+
|
5858
|
+
|
5679
5859
|
elif itemlabel == _("Plot stats unknown (selected nodes)..."):
|
5680
5860
|
autoscale = False
|
5681
5861
|
|
@@ -6301,7 +6481,11 @@ class WolfMapViewer(wx.Frame):
|
|
6301
6481
|
|
6302
6482
|
self.create_2D_MB_model()
|
6303
6483
|
|
6304
|
-
elif itemlabel == _('Open
|
6484
|
+
elif itemlabel == _('Create/Open GPU model'):
|
6485
|
+
|
6486
|
+
self.create_2D_GPU_model()
|
6487
|
+
|
6488
|
+
elif itemlabel == _('Open Hydrological model'):
|
6305
6489
|
|
6306
6490
|
self.open_hydrological_model()
|
6307
6491
|
|
@@ -6649,7 +6833,7 @@ class WolfMapViewer(wx.Frame):
|
|
6649
6833
|
fnpos = dlg.GetPath()
|
6650
6834
|
dlg.Destroy()
|
6651
6835
|
|
6652
|
-
choices = ["matplotlib", "scipy"
|
6836
|
+
choices = ["matplotlib", "scipy"] #, "pyvista"]
|
6653
6837
|
dlg = wx.SingleChoiceDialog(None, _("Pick an interpolation method"), _("Choices"), choices)
|
6654
6838
|
ret = dlg.ShowModal()
|
6655
6839
|
if ret == wx.ID_CANCEL:
|
@@ -7458,6 +7642,9 @@ class WolfMapViewer(wx.Frame):
|
|
7458
7642
|
res = wolfres2DGPU(filename, plotted=False)
|
7459
7643
|
|
7460
7644
|
tilesmap = res._result_store._tile_packer.tile_indirection_map()
|
7645
|
+
if tilesmap is None:
|
7646
|
+
logging.warning(_('No tile map found in the simulation'))
|
7647
|
+
return
|
7461
7648
|
|
7462
7649
|
header = header_wolf()
|
7463
7650
|
res_header = res[0].get_header()
|
@@ -8008,7 +8195,11 @@ class WolfMapViewer(wx.Frame):
|
|
8008
8195
|
return [curobj.idx for curobj in self._get_list(drawing_type) if curobj.plotted == checked_state]
|
8009
8196
|
|
8010
8197
|
def get_list_objects(self, drawing_type:draw_type, checked_state:bool=True):
|
8011
|
-
""" Create a list of objects of type draw_type
|
8198
|
+
""" Create a list of objects of type draw_type
|
8199
|
+
|
8200
|
+
:param drawing_type: type of object to search
|
8201
|
+
:param checked_state: if True/False, return only objects that are plotted or not. None return all objects.
|
8202
|
+
"""
|
8012
8203
|
|
8013
8204
|
if checked_state is None:
|
8014
8205
|
return [curobj for curobj in self._get_list(drawing_type)]
|