wolfhece 2.2.15__py3-none-any.whl → 2.2.17__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/Model1D.py +12 -12
- wolfhece/PyDraw.py +31 -6
- wolfhece/PyGui.py +9 -1
- wolfhece/PyParams.py +29 -0
- wolfhece/Results2DGPU.py +6 -0
- wolfhece/__init__.py +1 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/apps/wolf.py +1 -1
- wolfhece/assets/__init__.py +0 -1
- wolfhece/assets/mesh.py +807 -0
- wolfhece/friction_law.py +3 -3
- wolfhece/hydrology/SubBasin.py +154 -154
- wolfhece/hydrometry/kiwis.py +55 -16
- wolfhece/lazviewer/laz_viewer.py +4 -4
- wolfhece/mesh2d/wolf2dprev.py +23 -0
- wolfhece/pyshields.py +38 -2
- wolfhece/wolf_array.py +78 -24
- wolfhece/wolfresults_2D.py +698 -183
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/METADATA +2 -3
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/RECORD +23 -22
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/WHEEL +1 -1
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.15.dist-info → wolfhece-2.2.17.dist-info}/top_level.txt +0 -0
wolfhece/Model1D.py
CHANGED
@@ -1860,7 +1860,7 @@ class Creator_1D:
|
|
1860
1860
|
format ='zones',
|
1861
1861
|
save_as: str='',
|
1862
1862
|
return_list = True) -> list[crosssections]: # FIXME list of cross sections
|
1863
|
-
"""
|
1863
|
+
r"""
|
1864
1864
|
Save each `Zone` in `Zones` as a cross sections file and,
|
1865
1865
|
return a list of cross sections.
|
1866
1866
|
|
@@ -2530,7 +2530,7 @@ class Creator_1D:
|
|
2530
2530
|
return file_path
|
2531
2531
|
|
2532
2532
|
def count_lists_in_list(self, lst: list[list], nodes_1D = False) -> int:
|
2533
|
-
"""
|
2533
|
+
r"""
|
2534
2534
|
Return the sum of lengths of lists in a list.
|
2535
2535
|
- /!\ Attention for 1D nodes (nodes_1D),
|
2536
2536
|
the number of nodes is the number
|
@@ -2602,7 +2602,7 @@ class Creator_1D:
|
|
2602
2602
|
def _write_relations_profiles(self,
|
2603
2603
|
crosses:list[list[profile]],
|
2604
2604
|
save_as:str) -> None:
|
2605
|
-
"""
|
2605
|
+
r"""
|
2606
2606
|
/!\ Has been deprecated.
|
2607
2607
|
|
2608
2608
|
- Write the HSPW (Heigh, wetted Section, wetted Perimeter, top Width)relations
|
@@ -2680,7 +2680,7 @@ class Creator_1D:
|
|
2680
2680
|
def __write_relations_profiles(self,
|
2681
2681
|
crosses:list[list[profile]],
|
2682
2682
|
save_as:str) -> None:
|
2683
|
-
"""
|
2683
|
+
r"""
|
2684
2684
|
/!\ Has been deprecated.
|
2685
2685
|
|
2686
2686
|
- Write the HSPW (Height, wetted Section, wetted Perimeter, top Width)relations
|
@@ -3285,7 +3285,7 @@ class Creator_1D:
|
|
3285
3285
|
raise Exception('Define a writing a method!')
|
3286
3286
|
|
3287
3287
|
def read_hydrograph_from_textfile(self, file:str)-> list[list[list,list]]: # FIXME nameread discharges from
|
3288
|
-
"""
|
3288
|
+
r"""
|
3289
3289
|
Return a hydrograph from a text file.
|
3290
3290
|
/!\ The file should be on the wolf hydrograph format.
|
3291
3291
|
|
@@ -3401,7 +3401,7 @@ class Creator_1D:
|
|
3401
3401
|
save_as: str,
|
3402
3402
|
writing_method: Literal['continuous', 'stepwise'] = 'continuous',
|
3403
3403
|
epsilon:float = 0.01):
|
3404
|
-
"""
|
3404
|
+
r"""
|
3405
3405
|
- Write the infiltration files (.inf, .infil, .tv) and,
|
3406
3406
|
- Apply the preprocessing mode to the hydrographs before writing them.
|
3407
3407
|
|
@@ -4201,7 +4201,7 @@ class Creator_1D:
|
|
4201
4201
|
raise Exception(_('Bad type of boundary condition.'))
|
4202
4202
|
|
4203
4203
|
def write_width_file(self, crosses:list[list[profile]], width:float , save_as:str):
|
4204
|
-
'''
|
4204
|
+
r'''
|
4205
4205
|
Write the width file (.width file).
|
4206
4206
|
- The width is constant for all the profiles
|
4207
4207
|
|
@@ -4597,7 +4597,7 @@ class Creator_1D:
|
|
4597
4597
|
logging.info(f'{directory} removed.')
|
4598
4598
|
|
4599
4599
|
def find_1D_binary_results(self, directory:str) -> tuple[str]: #FIXME find why self is not working
|
4600
|
-
"""
|
4600
|
+
r"""
|
4601
4601
|
/!\ This method has been deprecated.
|
4602
4602
|
Return a tuple containing the paths to the model:
|
4603
4603
|
|
@@ -4627,7 +4627,7 @@ class Creator_1D:
|
|
4627
4627
|
return (head_file,results_depths, results_discharges, results_wetted_sections)
|
4628
4628
|
|
4629
4629
|
def read_1D_binary_results(self, results: list[str]) -> tuple[np.ndarray]:
|
4630
|
-
'''
|
4630
|
+
r'''
|
4631
4631
|
/!\ This method has been deprecated. Check the the class` Wolfresults_1D` for the new implementation.
|
4632
4632
|
Return a tuple containing the simulated results as numpy arrays in this order:
|
4633
4633
|
- 0. Nodes coordinates (np.ndarray),
|
@@ -4701,7 +4701,7 @@ class Creator_1D:
|
|
4701
4701
|
landmark:Zones = None,
|
4702
4702
|
banks: Zones = None,
|
4703
4703
|
dpi: float = Constants.DPI.value ) -> None:
|
4704
|
-
"""
|
4704
|
+
r"""
|
4705
4705
|
/!\ This method has been deprecated. Check the the class` Wolfresults_1D` for the new implementation.
|
4706
4706
|
Plot the results of 1D model either:
|
4707
4707
|
- as a gif (evolution of all parameters)
|
@@ -5040,7 +5040,7 @@ class Creator_1D:
|
|
5040
5040
|
which_nodes:list[int] = [0,-1],
|
5041
5041
|
save_as:str ='',
|
5042
5042
|
figure_size = (20,10)):
|
5043
|
-
"""
|
5043
|
+
r"""
|
5044
5044
|
/!\ This method has been deprecated. Check the the class` Wolfresults_1D` for the new implementation.
|
5045
5045
|
|
5046
5046
|
Plot the hydrographs of the nodes.
|
@@ -8907,7 +8907,7 @@ class Wolfresults_1D:
|
|
8907
8907
|
figsize:tuple = (20,10),
|
8908
8908
|
alpha:float = 0.3,
|
8909
8909
|
save_as:str=''):
|
8910
|
-
"""
|
8910
|
+
r"""
|
8911
8911
|
/!\ Deprecating
|
8912
8912
|
Animate the selected variables in figures, save them as a file and
|
8913
8913
|
return the information associated with their axes.
|
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)
|
@@ -998,7 +1003,7 @@ class Sim_Explorer(wx.Frame):
|
|
998
1003
|
secax.tick_params(axis='x', rotation=30)
|
999
1004
|
|
1000
1005
|
ax[1].plot(main_x, self.active_res2d.all_dt, 'o-')
|
1001
|
-
ax[1].set_ylabel(_('$\Delta t$ [s]'), fontsize=8)
|
1006
|
+
ax[1].set_ylabel(_(r'$\Delta t$ [s]'), fontsize=8)
|
1002
1007
|
ax[1].grid(which='both')
|
1003
1008
|
ax[1].set_xticks(main_x)
|
1004
1009
|
ax[1].set_xticklabels([])
|
@@ -2887,7 +2892,7 @@ class WolfMapViewer(wx.Frame):
|
|
2887
2892
|
self.menuwolf2d.AppendSeparator()
|
2888
2893
|
|
2889
2894
|
self.menu2d_dangermap = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map"), _("Compute the danger map"))
|
2890
|
-
|
2895
|
+
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
2896
|
self.menu2d_dangermaph = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map - only h"), _("Compute the danger map - only waterdepth"))
|
2892
2897
|
|
2893
2898
|
self.menuwolf2d.AppendSeparator()
|
@@ -3519,16 +3524,21 @@ class WolfMapViewer(wx.Frame):
|
|
3519
3524
|
every = dlg.GetValue()
|
3520
3525
|
|
3521
3526
|
if itemlabel == _("Danger map"):
|
3527
|
+
logging.info(_('Danger map -- Be patient !'))
|
3522
3528
|
pgbar = wx.ProgressDialog(_('Danger map'), _('Danger map'), maximum = end_step-1, parent=self, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
|
3523
3529
|
def _callback(id, msg):
|
3524
3530
|
pgbar.Update(id+1-start_step, msg)
|
3525
3531
|
|
3526
|
-
danger_maps = self.active_res2d.
|
3532
|
+
danger_maps = self.active_res2d.danger_map(start_step-1, end_step-1, every, _callback)
|
3527
3533
|
|
3528
3534
|
pgbar.Hide()
|
3529
3535
|
pgbar.Destroy()
|
3536
|
+
logging.info(_('Danger map done !'))
|
3530
3537
|
else:
|
3538
|
+
|
3539
|
+
logging.info(_('Multiprocess danger map -- Be patient !'))
|
3531
3540
|
danger_maps = self.active_res2d.danger_map_multiprocess(start_step-1, end_step-1, every)
|
3541
|
+
logging.info(_('Multiprocess danger map done !'))
|
3532
3542
|
|
3533
3543
|
with wx.DirDialog(None, _('Choose a directory to store results'), style=wx.DD_DEFAULT_STYLE) as dlg:
|
3534
3544
|
|
@@ -3537,9 +3547,24 @@ class WolfMapViewer(wx.Frame):
|
|
3537
3547
|
|
3538
3548
|
outdir = dlg.GetPath()
|
3539
3549
|
|
3540
|
-
names = ['danger_h
|
3550
|
+
names = ['danger_h', 'danger_u',
|
3551
|
+
'danger_q', 'danger_Z',
|
3552
|
+
'danger_head',
|
3553
|
+
'danger_toal', 'danger_tom']
|
3554
|
+
|
3541
3555
|
for name, danger_map in zip(names, danger_maps):
|
3542
|
-
|
3556
|
+
|
3557
|
+
if isinstance(danger_map, WolfArrayMB):
|
3558
|
+
name = name + '.bin'
|
3559
|
+
logging.info(_('Saving danger map {}').format(name))
|
3560
|
+
danger_map.write_all(Path(outdir) / name)
|
3561
|
+
elif isinstance(danger_map, WolfArray):
|
3562
|
+
name = name + '.tif'
|
3563
|
+
logging.info(_('Saving danger map {}').format(name))
|
3564
|
+
danger_map.write_all(Path(outdir) / name)
|
3565
|
+
else:
|
3566
|
+
logging.error(_('Bad type for danger map {} -- not saved !').format(name))
|
3567
|
+
continue
|
3543
3568
|
|
3544
3569
|
elif itemlabel == _("Setup cache..."):
|
3545
3570
|
|
wolfhece/PyGui.py
CHANGED
@@ -155,6 +155,8 @@ class GenMapManager(wx.Frame):
|
|
155
155
|
class MapManager(GenMapManager):
|
156
156
|
|
157
157
|
def __init__(self,*args, **kw):
|
158
|
+
|
159
|
+
logging.info("MapManager")
|
158
160
|
super().__init__(*args, **kw)
|
159
161
|
|
160
162
|
icon = wx.Icon()
|
@@ -181,7 +183,7 @@ class MapManager(GenMapManager):
|
|
181
183
|
except:
|
182
184
|
logging.error("No icon for the log window")
|
183
185
|
|
184
|
-
|
186
|
+
logging.info("MapManager - MapViewer created")
|
185
187
|
# Set directory for hydrometry data, relative to the current file
|
186
188
|
dir_data = Path(__file__).parent / "data"
|
187
189
|
dir_hydro = dir_data / "hydrometry"
|
@@ -196,11 +198,16 @@ class MapManager(GenMapManager):
|
|
196
198
|
if not dir_picc.exists():
|
197
199
|
dir_picc.mkdir(parents=True, exist_ok=True)
|
198
200
|
|
201
|
+
logging.info("MapManager - Data directories created")
|
199
202
|
try:
|
200
203
|
self.SPWhydrometry = hydrometry_wolfgui(dir=dir_hydro, idx = 'SPW hydrometry', mapviewer=self.mapviewer, parent = self, plotted=False)
|
204
|
+
logging.info("MapManager - hydrometry_wolfgui created")
|
201
205
|
self.picc = Picc_data(data_dir=dir_picc, mapviewer=self.mapviewer)
|
206
|
+
logging.info("MapManager - Picc_data created")
|
202
207
|
self.cadaster = Cadaster_data(data_dir=dir_cadaster, mapviewer=self.mapviewer)
|
208
|
+
logging.info("MapManager - Cadaster_data created")
|
203
209
|
self.landmaps = PlansTerrier(mapviewer=self.mapviewer, parent = self, idx='LandMaps', plotted=True)
|
210
|
+
logging.info("MapManager - PlansTerrier created")
|
204
211
|
|
205
212
|
self.mapviewer.add_object(which='other',
|
206
213
|
newobj=self.SPWhydrometry,
|
@@ -225,6 +232,7 @@ class MapManager(GenMapManager):
|
|
225
232
|
logging.warning("Can't load some data (hydrometry, picc, cadaster, landmaps) -- Please check the data directories and/or report the issue")
|
226
233
|
|
227
234
|
self.mapviewer.menu_walous()
|
235
|
+
logging.info("MapManager - Menu Walous created")
|
228
236
|
|
229
237
|
# class GPU2DModel(GenMapManager):
|
230
238
|
|
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 """
|
wolfhece/Results2DGPU.py
CHANGED
@@ -193,11 +193,17 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
193
193
|
if key in dct:
|
194
194
|
dct.pop(key)
|
195
195
|
|
196
|
+
dct['isGPU'] = True
|
197
|
+
|
196
198
|
return dct
|
197
199
|
|
198
200
|
def __setstate__(self, dct):
|
201
|
+
|
199
202
|
super().__setstate__(dct)
|
200
203
|
|
204
|
+
self._loader(self.filename)
|
205
|
+
self._post_loader()
|
206
|
+
|
201
207
|
self._result_store = None
|
202
208
|
self._cache = None
|
203
209
|
self.setup_store(self._result_store)
|
wolfhece/__init__.py
CHANGED
@@ -7,7 +7,7 @@ try:
|
|
7
7
|
ogr.UseExceptions()
|
8
8
|
osr.UseExceptions()
|
9
9
|
except ImportError as e:
|
10
|
-
print(e)
|
10
|
+
# print(e)
|
11
11
|
raise Exception(_('Error importing GDAL library\nPlease ensure GDAL is installed and the Python bindings are available\n\ngdal wheels can be found at https://github.com/cgohlke/geospatial-wheels'))
|
12
12
|
|
13
13
|
from .apps.version import WolfVersion
|
wolfhece/apps/version.py
CHANGED
wolfhece/apps/wolf.py
CHANGED
@@ -8,10 +8,10 @@ This script and its content are protected by copyright law. Unauthorized
|
|
8
8
|
copying or distribution of this file, via any medium, is strictly prohibited.
|
9
9
|
"""
|
10
10
|
|
11
|
+
import ctypes
|
11
12
|
import wx
|
12
13
|
from ..PyTranslate import _
|
13
14
|
|
14
|
-
import ctypes
|
15
15
|
myappid = 'wolf_hece_uliege' # arbitrary string
|
16
16
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
|
17
17
|
|
wolfhece/assets/__init__.py
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
from . import _add_path
|