wolfhece 2.1.99__py3-none-any.whl → 2.1.101__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.
Files changed (35) hide show
  1. wolfhece/PyDraw.py +220 -29
  2. wolfhece/PyGui.py +1039 -53
  3. wolfhece/PyVertexvectors.py +2 -2
  4. wolfhece/Results2DGPU.py +37 -13
  5. wolfhece/acceptability/Parallels.py +2 -2
  6. wolfhece/acceptability/_add_path.py +23 -0
  7. wolfhece/acceptability/acceptability.py +594 -563
  8. wolfhece/acceptability/acceptability_gui.py +564 -331
  9. wolfhece/acceptability/cli.py +307 -120
  10. wolfhece/acceptability/func.py +1754 -1597
  11. wolfhece/apps/version.py +1 -1
  12. wolfhece/bernoulli/losses.py +76 -23
  13. wolfhece/bernoulli/losses_jax.py +143 -0
  14. wolfhece/bernoulli/pipe.py +7 -2
  15. wolfhece/gpuview.py +4 -1
  16. wolfhece/libs/__init__.py +11 -10
  17. wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
  18. wolfhece/math_parser/__init__.py +4 -4
  19. wolfhece/math_parser/calculator.py +51 -9
  20. wolfhece/mesh2d/bc_manager.py +25 -2
  21. wolfhece/mesh2d/gpu_2d.py +644 -0
  22. wolfhece/mesh2d/simple_2d.py +2817 -0
  23. wolfhece/mesh2d/wolf2dprev.py +5 -2
  24. wolfhece/pidcontroller.py +131 -0
  25. wolfhece/pywalous.py +7 -7
  26. wolfhece/scenario/config_manager.py +98 -21
  27. wolfhece/wolf_array.py +391 -176
  28. wolfhece/wolf_vrt.py +108 -7
  29. wolfhece/wolfresults_2D.py +113 -6
  30. wolfhece/xyz_file.py +91 -51
  31. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/METADATA +3 -1
  32. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/RECORD +35 -30
  33. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/WHEEL +1 -1
  34. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/entry_points.txt +0 -0
  35. {wolfhece-2.1.99.dist-info → wolfhece-2.1.101.dist-info}/top_level.txt +0 -0
@@ -6917,5 +6917,5 @@ class Grid(Zones):
6917
6917
  contour.add_vertex(newvert)
6918
6918
  newvert=wolfvertex(locox,locey)
6919
6919
  contour.add_vertex(newvert)
6920
-
6921
- self.find_minmax(True)
6920
+
6921
+ self.find_minmax(True)
wolfhece/Results2DGPU.py CHANGED
@@ -622,21 +622,45 @@ class wolfres2DGPU(Wolfresults_2D):
622
622
 
623
623
 
624
624
  self.mapviewer.add_object('vector', newobj = grid_tiles, id = 'Tiles')
625
- class Sim_2D_GPU():
626
- """ Simulation 2D GPU -- Interface """
627
625
 
628
- def __init__(self, fname:Union[str,Path] = '') -> None:
626
+ def set_hqxqy_as_initial_conditions(self, idx:int = None, as_multiblocks:bool = False):
627
+ """
628
+ Set the result as IC
629
+
630
+ :param idx : 0-based index
631
+ """
632
+
633
+ if idx is not None:
634
+ if idx>=0 and idx<self.get_nbresults():
635
+ self.read_oneresult(idx)
636
+ elif idx ==-1:
637
+ self.read_oneresult(-1) # last one
638
+ else:
639
+ logging.error(_('Bad index for initial conditions'))
640
+ return
641
+
642
+ self.set_currentview(views_2D.WATERDEPTH)
629
643
 
630
- try:
631
- from wolfgpu.simple_simulation import SimpleSimulation
632
- except:
633
- logging.error(_("Unable to import wolfgpu.simple_simulation.SimpleSimulation. Please install wolfgpu package or add a symlink to the wolfgpu package in the wolfhece directory"))
644
+ hini = self.as_WolfArray()
634
645
 
635
- self.filename = Path(fname)
636
- self.loaded = False
646
+ self.set_currentview(views_2D.QX)
637
647
 
638
- if self.filename.exists():
639
- self.sim = SimpleSimulation.load(self.filename)
640
- self.loaded = True
648
+ qxini = self.as_WolfArray()
641
649
 
642
- pass
650
+ self.set_currentview(views_2D.QY)
651
+
652
+ qyini = self.as_WolfArray()
653
+
654
+ if (hini is not None) and (qxini is not None) and (qyini is not None):
655
+
656
+ # hini = hini.as_WolfArray()
657
+ # qxini = qxini.as_WolfArray()
658
+ # qyini = qyini.as_WolfArray()
659
+
660
+ hini.write_all(self.filename.parent / 'h.npy')
661
+ qxini.write_all(self.filename.parent / 'qx.npy')
662
+ qyini.write_all(self.filename.parent / 'qy.npy')
663
+
664
+ logging.info(_('Initial conditions saved as Numpy files'))
665
+ else:
666
+ logging.error(_('No initial conditions saved'))
@@ -7,7 +7,7 @@ Copyright (c) 2024 University of Liege. All rights reserved.
7
7
  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
+ #import _add_path #AP
11
11
  from .func import clip_layer, data_modification, vector_to_raster, compute_vulnerability, match_vulnerability2sim, compute_acceptability, shp_to_raster, Accept_Manager
12
12
  import geopandas as gpd
13
13
  import multiprocessing
@@ -76,7 +76,7 @@ def parallel_v2r(manager:Accept_Manager,
76
76
  if number_procs == 1:
77
77
  result_list=[]
78
78
  for curlayer in layers:
79
- result_list.append(vector_to_raster(curlayer, manager, attribute, pixel,convert_to_sparse))
79
+ result_list.append(vector_to_raster(curlayer, manager, attribute, pixel, convert_to_sparse))
80
80
 
81
81
  else:
82
82
  pool = multiprocessing.Pool(processes=number_procs)
@@ -0,0 +1,23 @@
1
+ import os
2
+ import os.path
3
+ import sys
4
+ import platform
5
+
6
+
7
+ def _add_path():
8
+ _root_dir = os.path.dirname(os.path.realpath(__file__))
9
+
10
+ # manual specify list of dll directories, with paths relative to _root_dir
11
+ _dll_dirs = ['libs', 'shaders']
12
+
13
+ if platform.system() == 'Windows':
14
+ os.environ.setdefault('PATH', '')
15
+ paths = os.environ['PATH'].split(';')
16
+ for x in _dll_dirs:
17
+ x = os.path.join(_root_dir, x)
18
+ if os.path.isdir(x) and x not in paths:
19
+ paths = [x] + paths
20
+ os.environ['PATH'] = ';'.join(paths)
21
+
22
+
23
+ _add_path()