wolfhece 2.1.101__py3-none-any.whl → 2.1.103__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 CHANGED
@@ -5722,6 +5722,10 @@ class WolfMapViewer(wx.Frame):
5722
5722
  logging.warning(_('No active vector !'))
5723
5723
  return
5724
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
+
5725
5729
  if self.active_res2d is None:
5726
5730
  logging.warning(_('No active 2D result !'))
5727
5731
  return
@@ -5748,11 +5752,11 @@ class WolfMapViewer(wx.Frame):
5748
5752
  if self.active_vector is None:
5749
5753
  logging.warning(_('No active vector !'))
5750
5754
  return
5751
-
5755
+
5752
5756
  if self.active_res2d is None:
5753
5757
  logging.warning(_('No active 2D result !'))
5754
5758
  return
5755
-
5759
+
5756
5760
  filterArray = ".csv (*.csv)|*.csv|all (*.*)|*.*"
5757
5761
  fdlg = wx.FileDialog(self, "Choose file name : ", wildcard=filterArray,
5758
5762
  style=wx.FD_SAVE)
@@ -5764,7 +5768,7 @@ class WolfMapViewer(wx.Frame):
5764
5768
  hydrographCSVPath = fdlg.GetPath()
5765
5769
 
5766
5770
  fdlg.Destroy()
5767
-
5771
+
5768
5772
  if hydrographCSVPath is not None:
5769
5773
  # Create a progress dialog
5770
5774
  progress_dialog = wx.ProgressDialog(
@@ -5796,18 +5800,18 @@ class WolfMapViewer(wx.Frame):
5796
5800
  wx.MessageBox(_("Error exporting hydrographs"), _("Export Hydrographs"), wx.OK | wx.ICON_ERROR)
5797
5801
  logging.error(_('Error exporting hydrographs'))
5798
5802
 
5799
-
5803
+
5800
5804
  elif itemlabel == _("Export integrated Q along all vectors in active zone..."):
5801
5805
  autoscale = False
5802
5806
 
5803
5807
  if self.active_zone is None:
5804
5808
  logging.warning(_('No active zone !'))
5805
5809
  return
5806
-
5810
+
5807
5811
  if self.active_res2d is None:
5808
5812
  logging.warning(_('No active 2D result !'))
5809
5813
  return
5810
-
5814
+
5811
5815
  filterArray = ".csv (*.csv)|*.csv|all (*.*)|*.*"
5812
5816
  fdlg = wx.FileDialog(self, "Choose file name : ", wildcard=filterArray,
5813
5817
  style=wx.FD_SAVE)
@@ -5850,7 +5854,7 @@ class WolfMapViewer(wx.Frame):
5850
5854
  else:
5851
5855
  wx.MessageBox(_("Error exporting hydrographs"), _("Export Hydrographs"), wx.OK | wx.ICON_ERROR)
5852
5856
  logging.error(_('Error exporting hydrographs'))
5853
-
5857
+
5854
5858
 
5855
5859
  elif itemlabel == _("Plot stats unknown (selected nodes)..."):
5856
5860
  autoscale = False
@@ -7638,6 +7642,9 @@ class WolfMapViewer(wx.Frame):
7638
7642
  res = wolfres2DGPU(filename, plotted=False)
7639
7643
 
7640
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
7641
7648
 
7642
7649
  header = header_wolf()
7643
7650
  res_header = res[0].get_header()
wolfhece/PyGui.py CHANGED
@@ -59,7 +59,7 @@ except ImportError as e:
59
59
  try:
60
60
  from .RatingCurve import SPWMIGaugingStations,SPWDCENNGaugingStations
61
61
  from .mesh2d.wolf2dprev import *
62
- from .Results2DGPU import wolfres2DGPU
62
+ # from .Results2DGPU import wolfres2DGPU
63
63
  from .PyGuiHydrology import GuiHydrology
64
64
  from .RatingCurve import SPWMIGaugingStations,SPWDCENNGaugingStations
65
65
  from .hydrology.Catchment import Catchment
@@ -71,6 +71,7 @@ try:
71
71
  from .mesh2d.gpu_2d import Sim_2D_GPU
72
72
  from .mesh2d.wolf2dprev import prev_sim2D
73
73
  from .mesh2d.cst_2D_boundary_conditions import BCType_2D, BCType_2D_OO, BCType_2D_GPU, Direction
74
+
74
75
  except ImportError as e:
75
76
  print(f"Import Error: {e} - RatingCurve, mesh2d, Results2DGPU, PyGuiHydrology, RatingCurve, hydrology, PyParams, picc, wolf_zi_db, CpGrid")
76
77
  print("Please install the required modules using 'pip install -r requirements.txt'")
@@ -2994,7 +2995,10 @@ class Wolf2DGPUModel(GenMapManager):
2994
2995
 
2995
2996
  def add_boundary_condition(self, i: int, j: int, bc_type:BCType_2D_GPU, bc_value: float, border:Direction):
2996
2997
  """ alias """
2997
- from wolfgpu.simple_simulation import BoundaryConditionsTypes, Direction as ss_direction
2998
+ try:
2999
+ from wolfgpu.simple_simulation import BoundaryConditionsTypes, Direction as ss_direction
3000
+ except ImportError:
3001
+ logging.error(_('Cannot import BoundaryConditionsTypes and Direction from wolfgpu.simple_simulation'))
2998
3002
 
2999
3003
  def convert_dirhece2gpu(direction:Direction) -> ss_direction:
3000
3004
  """ Convert the boundary conditions from HECE to GPU """
wolfhece/Results2DGPU.py CHANGED
@@ -27,7 +27,7 @@ from .PyPalette import wolfpalette
27
27
 
28
28
  try:
29
29
  from wolfgpu.results_store import ResultsStore, ResultType
30
- except :
30
+ except ImportError:
31
31
  logging.debug(_("Unable to import wolfgpu.results_store.ResultsStore. Please install wolfgpu package or add a symlink to the wolfgpu package in the wolfhece directory"))
32
32
 
33
33
  def _load_res(x) -> tuple[csr_array, csr_array, csr_array]:
@@ -12,6 +12,24 @@ copying or distribution of this file, via any medium, is strictly prohibited.
12
12
  def main():
13
13
  # Check if installation is complete
14
14
  ret = 'Checking installation\n---------------------\n\n'
15
+
16
+
17
+ # Get list of packages
18
+ import pkg_resources
19
+ installed_packages = pkg_resources.working_set
20
+ packages = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])
21
+
22
+ #is osgeo in packages?
23
+ if 'osgeo' in packages:
24
+ ret += 'OSGeo seems installed\n\n'
25
+ else:
26
+ ret += 'OSGeo not installed\n Please install GDAL from https://github.com/cgohlke/geospatial-wheels/releases\n\n'
27
+
28
+ if 'wolfgpu' in packages:
29
+ ret += 'WolfGPU seems installed\n\n'
30
+ else:
31
+ ret += 'WolfGPU not installed\n Please install WolfGPU if needed\n\n'
32
+
15
33
  try:
16
34
  from osgeo import ogr, gdal
17
35
  ret += 'GDAL/OGR installed\n\n'
@@ -25,7 +43,7 @@ def main():
25
43
  except ImportError as e:
26
44
  ret += 'Wolfpy not accessible\n\n'
27
45
  ret += 'Error : ' + str(e) + '\n\n'
28
-
46
+
29
47
  try:
30
48
  from ..PyGui import MapManager
31
49
  ret += 'Wolfhece installed\n\n'
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 = 101
8
+ self.patch = 103
9
9
 
10
10
  def __str__(self):
11
11
 
wolfhece/mesh2d/gpu_2d.py CHANGED
@@ -8,7 +8,7 @@ from ..wolf_array import WOLF_ARRAY_FULL_LOGICAL, WOLF_ARRAY_FULL_SINGLE, WOLF_A
8
8
  from ..wolf_array import WolfArray, header_wolf
9
9
  from ..PyTranslate import _
10
10
  from ..PyVertexvectors import vector, zone, Zones
11
- from wolfgpu.simple_simulation import SimpleSimulation
11
+ # from wolfgpu.simple_simulation import SimpleSimulation
12
12
 
13
13
  class infiltration_GPU():
14
14
  def __init__(self, parent:"Sim_2D_GPU") -> None:
@@ -83,7 +83,7 @@ class Sim_2D_GPU():
83
83
  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"))
84
84
 
85
85
  self.dir = Path(directory)
86
- self._sim = None
86
+ self._sim:SimpleSimulation = None
87
87
  self._cached_arrays = {}
88
88
  self.magnetic_grid:header_wolf = None
89
89
 
@@ -100,6 +100,7 @@ class Sim_2D_GPU():
100
100
  ('h','Initial water depth [m]',WOLF_ARRAY_FULL_SINGLE),
101
101
  ('qx','Initial discharge along X [m^2/s]',WOLF_ARRAY_FULL_SINGLE),
102
102
  ('qy','Initial discharge along Y [m^2/s]',WOLF_ARRAY_FULL_SINGLE),
103
+ ('bridge_roof','Bridge/Culvert (roof el.) [m]',WOLF_ARRAY_FULL_SINGLE),
103
104
  ]}
104
105
 
105
106
  self.files_ic=['Initial water depth [m]','Initial discharge along X [m^2/s]','Initial discharge along Y [m^2/s]']
@@ -126,11 +127,11 @@ class Sim_2D_GPU():
126
127
  self._sim = None
127
128
 
128
129
  @property
129
- def sim(self) -> SimpleSimulation:
130
+ def sim(self):
130
131
  return self._sim
131
132
 
132
133
  @sim.setter
133
- def sim(self, value:SimpleSimulation) -> None:
134
+ def sim(self, value) -> None:
134
135
  self._sim = value
135
136
 
136
137
  def __str__(self) -> str:
@@ -165,11 +166,9 @@ class Sim_2D_GPU():
165
166
  else:
166
167
  return None
167
168
 
168
- def __getitem__(self, key:Literal['nap', 'bathymetry', 'manning', 'infiltrations_zones', 'h', 'qx', 'qy']) -> WolfArray:
169
+ def __getitem__(self, key:Literal['nap', 'bathymetry', 'manning', 'infiltration_zones', 'h', 'qx', 'qy', 'bridge_roof']) -> WolfArray:
169
170
  """ Get an array from the simulation """
170
171
 
171
- nullvalues = {'nap':0, 'bathymetry':99999, 'manning':0, 'infiltration_zones':0, 'h':0, 'qx':0, 'qy':0}
172
-
173
172
  if self.is_loaded:
174
173
  if key in self._get_name_arrays():
175
174
  descr = self._get_description_arrays()[self._get_name_arrays().index(key)]
@@ -178,7 +177,7 @@ class Sim_2D_GPU():
178
177
  locarray = WolfArray(srcheader=self.get_header(),
179
178
  np_source=self.sim.__getattribute__(key),
180
179
  idx= descr,
181
- nullvalue=nullvalues[key],
180
+ nullvalue=self.nullvalues[key],
182
181
  whichtype=self.files_array['Characteristics'][self._get_name_arrays().index(key)][2],
183
182
  masknull=False)
184
183
  locarray.loaded = True
@@ -212,6 +211,11 @@ class Sim_2D_GPU():
212
211
  def create_arrays_from(self, source:WolfArray):
213
212
  """ Create arrays from a source """
214
213
 
214
+ try:
215
+ from wolfgpu.simple_simulation import SimpleSimulation
216
+ except:
217
+ 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"))
218
+
215
219
  if self.is_loaded:
216
220
  logging.error(_("Simulation exists, cannot create arrays from source or delete simulation first !"))
217
221
  else:
@@ -346,11 +350,15 @@ class Sim_2D_GPU():
346
350
 
347
351
  return x,y
348
352
 
353
+ @property
354
+ def nullvalues(self) -> dict[str,int]:
355
+ """ Define null values for the arrays """
356
+
357
+ return {'nap':0, 'bathymetry':99999., 'manning':0, 'infiltration_zones':0, 'h':0., 'qx':0., 'qy':0., 'bridge_roof':99999.}
358
+
349
359
  def verify_files(self):
350
360
  """ Verify the files """
351
361
 
352
- nullvalues = {'nap':0, 'bathymetry':99999, 'manning':99999, 'infiltration_zones':99999, 'h':99999, 'qx':99999, 'qy':99999}
353
-
354
362
  if self.is_loaded:
355
363
  header = self.get_header()
356
364
  ref_mask= self.sim.nap == 0
@@ -362,7 +370,7 @@ class Sim_2D_GPU():
362
370
  if tmparray.shape != (header.nbx, header.nby):
363
371
  logging.error(_("Bad shape for array {0}".format(cur[0])))
364
372
  return False
365
- if np.any(tmparray[np.logical_not(ref_mask)] == nullvalues[cur[0]]):
373
+ if np.any(tmparray[np.logical_not(ref_mask)] == self.nullvalues[cur[0]]):
366
374
  logging.error(_("Null value found in array {0}".format(cur[0])))
367
375
  return False
368
376
  return True
@@ -123,6 +123,17 @@ def import_files(module_files:Union[list[Path],list[str]]) -> list[types.ModuleT
123
123
  sys.path.pop(0)
124
124
  os.chdir(olddir)
125
125
 
126
+ # Test if some routines are missing
127
+ # if "impose_bc" in py_file.name:
128
+ # to_test = ['impose_bc']
129
+
130
+ # elif "update_void" in py_file.name:
131
+ # to_test = ['update_topobathy', 'update_manning', 'update_infiltration', 'update_roof']
132
+
133
+ # for routine in to_test:
134
+ # if not hasattr(module, routine):
135
+ # logging.warning(f'Le module {module} ne contient pas la routine {routine}.')
136
+
126
137
  modules.append(module)
127
138
 
128
139
  return modules
@@ -30,7 +30,7 @@ import types
30
30
 
31
31
  from ..PyTranslate import _
32
32
  from ..wolfresults_2D import Wolfresults_2D
33
- from ..wolf_array import WolfArray, header_wolf, WOLF_ARRAY_FULL_INTEGER
33
+ from ..wolf_array import WolfArray, header_wolf, WOLF_ARRAY_FULL_INTEGER, WOLF_ARRAY_FULL_SINGLE
34
34
  from .check_scenario import check_file_update, check_file_bc, import_files
35
35
  from .update_void import create_new_file as update_void
36
36
  from .imposebc_void import create_new_file as bc_void
@@ -56,7 +56,7 @@ except:
56
56
  # mann_*.tif
57
57
  # infil_*.tif
58
58
 
59
- ACCEPTED_PREFIX = ['bath_', 'mann_', 'infil_']
59
+ ACCEPTED_PREFIX = ['bath_', 'mann_', 'infil_', 'roof_']
60
60
 
61
61
  def delete_folder(pth:Path):
62
62
  for sub in pth.iterdir():
@@ -471,7 +471,7 @@ class Config_Manager_2D_GPU:
471
471
 
472
472
  logging.info(_('Number of tif files : {}'.format(len(list_tif))))
473
473
 
474
- standard_files = ['bathymetry.tif', 'manning.tif', 'infiltration.tif', 'h.tif', 'qx.tif', 'qy.tif']
474
+ standard_files = ['bathymetry.tif', 'manning.tif', 'infiltration.tif', 'h.tif', 'qx.tif', 'qy.tif', 'roof.tif']
475
475
 
476
476
  log = ''
477
477
  for curtif in list_tif:
@@ -502,6 +502,12 @@ class Config_Manager_2D_GPU:
502
502
  loclog += _('Did you mean "infil_" ?') + '\n'
503
503
  break
504
504
 
505
+ tests = ['rof_', 'rooof_', 'rofo_', 'oof_', 'roff_']
506
+ for test in tests:
507
+ if curtif.name.lower().startswith(test):
508
+ loclog += _('Did you mean "roof_" ?') + '\n'
509
+ break
510
+
505
511
  logging.warning(loclog)
506
512
 
507
513
  log += loclog
@@ -612,7 +618,9 @@ class Config_Manager_2D_GPU:
612
618
  self._test_is_results(curdict)
613
619
 
614
620
  def _recursive_find_files(self, wd:Path, curdict:dict, erase_cache:bool = True):
615
- """ Recherche récursive des fichiers de simulation/scenario dans les répertoires dont la structure a été traduite en dictionnaire """
621
+ """ Recherche récursive des fichiers de simulation/scenario dans les
622
+ répertoires dont la structure a été traduite en dictionnaire """
623
+
616
624
  if len(curdict.keys())>0:
617
625
  for k in curdict.keys():
618
626
  self._recursive_find_files(k, curdict[k])
@@ -763,15 +771,19 @@ class Config_Manager_2D_GPU:
763
771
 
764
772
  return curdict
765
773
 
766
- def _select_tif_partname(self, curdict:dict, tifstr:Literal['bath_', 'mann_', 'infil_']):
774
+ def _select_tif_partname(self, curdict:dict, tifstr:Literal['bath_', 'mann_', 'infil_', 'roof_']):
767
775
  """ Select tif files with a 'str' as name's prefix """
768
776
 
777
+ assert tifstr in ACCEPTED_PREFIX, _('Bad prefix !')
778
+
769
779
  if tifstr == 'bath_':
770
780
  forced_add = ['bathymetry.tif']
771
781
  elif tifstr == 'mann_':
772
782
  forced_add = ['manning.tif']
773
783
  elif tifstr == 'infil_':
774
784
  forced_add = ['infiltration.tif']
785
+ elif tifstr == 'roof_':
786
+ forced_add = ['roof.tif']
775
787
 
776
788
  tif_list = [curtif for curtif in curdict[GPU_2D_file_extensions.TIF.value] \
777
789
  if curtif.name.lower().startswith(tifstr) or \
@@ -793,13 +805,15 @@ class Config_Manager_2D_GPU:
793
805
  all_tif_bath = [self._select_tif_partname(curdict, 'bath_') for curdict in curdicts]
794
806
  all_tif_mann = [self._select_tif_partname(curdict, 'mann_') for curdict in curdicts]
795
807
  all_tif_infil = [self._select_tif_partname(curdict, 'infil_') for curdict in curdicts]
808
+ all_tif_roof = [self._select_tif_partname(curdict, 'roof_') for curdict in curdicts]
796
809
 
797
810
  # flatten list of lists
798
811
  all_tif_bath = [curel for curlist in all_tif_bath if len(curlist)>0 for curel in curlist]
799
812
  all_tif_mann = [curel for curlist in all_tif_mann if len(curlist)>0 for curel in curlist]
800
813
  all_tif_infil = [curel for curlist in all_tif_infil if len(curlist)>0 for curel in curlist]
814
+ all_tif_roof = [curel for curlist in all_tif_roof if len(curlist)>0 for curel in curlist]
801
815
 
802
- for cur_lst in [all_tif_bath, all_tif_mann, all_tif_infil]:
816
+ for cur_lst in [all_tif_bath, all_tif_mann, all_tif_infil, all_tif_roof]:
803
817
  for cur_tif in cur_lst:
804
818
  curarray:WolfArray = WolfArray(cur_tif)
805
819
  if curarray.nullvalue != 99999.:
@@ -824,21 +838,31 @@ class Config_Manager_2D_GPU:
824
838
  all_tif_bath = [self._select_tif_partname(curdict, 'bath_') for curdict in curdicts]
825
839
  all_tif_mann = [self._select_tif_partname(curdict, 'mann_') for curdict in curdicts]
826
840
  all_tif_infil = [self._select_tif_partname(curdict, 'infil_') for curdict in curdicts]
841
+ all_tif_roof = [self._select_tif_partname(curdict, 'roof_') for curdict in curdicts]
827
842
 
828
843
  # flatten list of lists
829
844
  all_tif_bath = [curel for curlist in all_tif_bath if len(curlist)>0 for curel in curlist]
830
845
  all_tif_mann = [curel for curlist in all_tif_mann if len(curlist)>0 for curel in curlist]
831
846
  all_tif_infil = [curel for curlist in all_tif_infil if len(curlist)>0 for curel in curlist]
847
+ all_tif_roof = [curel for curlist in all_tif_roof if len(curlist)>0 for curel in curlist]
832
848
 
833
849
  # création du fichier vrt
834
850
  create_vrt_from_files_first_based(all_tif_bath, from_path / '__bath_assembly.vrt')
835
851
  create_vrt_from_files_first_based(all_tif_mann, from_path / '__mann_assembly.vrt')
852
+
836
853
  if len(all_tif_infil)>0:
837
854
  create_vrt_from_files_first_based(all_tif_infil, from_path / '__infil_assembly.vrt')
855
+ else:
856
+ logging.info(_('No infiltration files found ! -> no __infil_assembly.vrt file created !'))
857
+
858
+ if len(all_tif_roof)>0:
859
+ create_vrt_from_files_first_based(all_tif_roof, from_path / '__roof_assembly.vrt')
860
+ else:
861
+ logging.info(_('No roof files found ! -> no __roof_assembly.vrt file created !'))
838
862
 
839
863
  def create_vec(self,
840
864
  from_path:Path,
841
- which:Literal['bath_', 'mann_', 'infil_'] = 'bath_') -> Zones:
865
+ which:Literal['bath_', 'mann_', 'infil_', 'roof_'] = 'bath_') -> Zones:
842
866
  """ Create a vec file from a path """
843
867
 
844
868
  assert which in ACCEPTED_PREFIX, _('Bad prefix !')
@@ -897,17 +921,18 @@ class Config_Manager_2D_GPU:
897
921
 
898
922
  def translate_vrt2tif(self, from_path:Path):
899
923
  """ Translate vrt to tif """
900
- vrtin = ['__bath_assembly.vrt', '__mann_assembly.vrt', '__infil_assembly.vrt']
901
- fout = ['__bathymetry.tif' , '__manning.tif', '__infiltration.tif']
924
+
925
+ vrtin = ['__bath_assembly.vrt', '__mann_assembly.vrt', '__infil_assembly.vrt', '__roof_assembly.vrt']
926
+ fout = ['__bathymetry.tif' , '__manning.tif', '__infiltration.tif', '__roof.tif']
902
927
 
903
928
  for curin, curout in zip(vrtin, fout):
904
929
  if (from_path / curin).exists():
905
930
  translate_vrt2tif(from_path / curin, from_path / curout)
906
931
 
907
- def apply_scripts_bath_mann_inf(self, from_path:Path):
932
+ def apply_scripts_bath_mann_inf_roof(self, from_path:Path):
908
933
  """ Apply all scripts """
909
934
 
910
- filenames = ['__bathymetry.tif', '__manning.tif', '__infiltration.tif']
935
+ filenames = ['__bathymetry.tif', '__manning.tif', '__infiltration.tif', '__roof.tif']
911
936
 
912
937
  # check if present on disk
913
938
  if not all([(from_path / curfile).exists() for curfile in filenames]):
@@ -920,12 +945,13 @@ class Config_Manager_2D_GPU:
920
945
 
921
946
  arrays = [WolfArray(from_path / curfile) for curfile in filenames]
922
947
 
923
- self._apply_scripts_update_topo_maning_inf(from_path, arrays[0], arrays[1], arrays[2])
948
+ self._apply_scripts_update_topo_maning_inf_roof(from_path, arrays[0], arrays[1], arrays[2], arrays[3])
924
949
 
925
950
  # write the files
926
951
  arrays[0].write_all(from_path / '__bathymetry_after_scripts.tif')
927
952
  arrays[1].write_all(from_path / '__manning_after_scripts.tif')
928
953
  arrays[2].write_all(from_path / '__infiltration_after_scripts.tif')
954
+ arrays[3].write_all(from_path / '__roof_after_scripts.tif')
929
955
 
930
956
  def _import_scripts(self, from_path:Path, which) -> list[types.ModuleType]:
931
957
  """ List all modules in structure and import them.
@@ -967,29 +993,59 @@ class Config_Manager_2D_GPU:
967
993
 
968
994
  return imported_mod
969
995
 
970
- def _import_scripts_topo_manning(self, from_path:Path) -> list[types.ModuleType]:
996
+ def _import_scripts_topo_manning_inf_roof(self, from_path:Path) -> list[types.ModuleType]:
971
997
  """ import all topo and manning scripts from a path """
972
998
 
973
999
  return self._import_scripts(from_path, WOLF_UPDATE)
974
1000
 
975
- def _apply_scripts_update_topo_maning_inf(self,
1001
+ def _apply_scripts_update_topo_maning_inf_roof(self,
976
1002
  modules:list[types.ModuleType] | Path | str,
977
1003
  array_bat:WolfArray,
978
1004
  array_mann:WolfArray,
979
- array_inf:WolfArray):
1005
+ array_inf:WolfArray,
1006
+ array_roof:WolfArray):
980
1007
  """ Apply all scripts from a list of modules """
981
1008
 
982
1009
  if isinstance(modules, str):
983
1010
  modules = Path(modules)
984
1011
 
985
1012
  if isinstance(modules, Path):
986
- modules = self._import_scripts_topo_manning(modules)
1013
+ modules = self._import_scripts_topo_manning_inf_roof(modules)
987
1014
 
988
1015
  for curmod in modules:
989
1016
  instmod = curmod.Update_Sim_Scenario()
990
- instmod.update_topobathy(array_bat)
991
- instmod.update_manning(array_mann)
992
- instmod.update_infiltration(array_inf)
1017
+ try:
1018
+ if not hasattr(instmod, "update_topobathy"):
1019
+ logging.info(_('No update_topobathy method found in the script {}!').format(curmod))
1020
+ else:
1021
+ instmod.update_topobathy(array_bat)
1022
+ except Exception as e:
1023
+ logging.error(_('An error occured during bathymetry script - {}!').format(e))
1024
+
1025
+ try:
1026
+ if not hasattr(instmod, "update_manning"):
1027
+ logging.info(_('No update_manning method found in the script {}!').format(curmod))
1028
+ else:
1029
+ instmod.update_manning(array_mann)
1030
+ except Exception as e:
1031
+ logging.error(_('An error occured during manning script - {}!').format(e))
1032
+
1033
+ try:
1034
+ if not hasattr(instmod, "update_infiltration"):
1035
+ logging.info(_('No update_infiltration method found in the script {}!').format(curmod))
1036
+ else:
1037
+ instmod.update_infiltration(array_inf)
1038
+ except Exception as e:
1039
+ logging.error(_('An error occured during infiltration script - {}!').format(e))
1040
+
1041
+ try:
1042
+ if not hasattr(instmod, "update_roof"):
1043
+ logging.info(_('No update_roof method found in the script {}!').format(curmod))
1044
+ else:
1045
+ instmod.update_roof(array_roof)
1046
+ except Exception as e:
1047
+ logging.error(_('An error occured during roof script - {}!').format(e))
1048
+
993
1049
 
994
1050
  def _import_scripts_bc(self, from_path:Path) -> list[types.ModuleType]:
995
1051
  """ Import all BC's scripts from a path """
@@ -1006,7 +1062,10 @@ class Config_Manager_2D_GPU:
1006
1062
  modules = self._import_scripts_bc(modules)
1007
1063
 
1008
1064
  for curmod in modules:
1009
- curmod.Impose_BC_Scenario().impose_bc(sim)
1065
+ try:
1066
+ curmod.Impose_BC_Scenario().impose_bc(sim)
1067
+ except Exception as e:
1068
+ logging.error(_('An error occured during BC script - {}!').format(e))
1010
1069
 
1011
1070
 
1012
1071
  def load_hydrograph(self, path:Path, toplot=True) -> tuple[Hydrograph_scenario, plt.Figure, plt.Axes]:
@@ -1088,11 +1147,30 @@ class Config_Manager_2D_GPU:
1088
1147
  else:
1089
1148
  logging.error(_("No 'bathymetry.tif' file found in the root directory !"))
1090
1149
 
1150
+ def create_void_roof(self):
1151
+ """ create void roof file """
1152
+
1153
+ if (self.workingdir / 'bathymetry.tif').exists():
1154
+ locheader = self.get_header()
1155
+ roof = WolfArray(srcheader=locheader, whichtype= WOLF_ARRAY_FULL_SINGLE)
1156
+ roof.array.data[:,:] = 99999.
1157
+ roof.nullvalue = 99999.
1158
+ roof.write_all(str(self.workingdir / 'roof.tif'))
1159
+
1160
+ if (self.workingdir / 'roof.tif').exists():
1161
+ logging.info(_('roof.tif created and set to 99999. ! -- Please edit it !'))
1162
+ else:
1163
+ logging.error(_("roof.tif not created ! -- Does 'bathymetry.tif' or any '.tif' file exist in the root directory ?"))
1164
+ else:
1165
+ logging.error(_("No 'bathymetry.tif' file found in the root directory !"))
1166
+
1167
+
1091
1168
  def create_simulation(self,
1092
1169
  dir:Path,
1093
1170
  idx_hydros:list[int] = [-1],
1094
1171
  delete_existing:bool = False,
1095
- preserve_ic:bool=False) -> list[Path]:
1172
+ preserve_ic:bool=False,
1173
+ callback = None) -> list[Path]:
1096
1174
  """ Create a simulation from different hydrographs """
1097
1175
 
1098
1176
  if isinstance(dir, str):
@@ -1188,17 +1266,32 @@ class Config_Manager_2D_GPU:
1188
1266
  infiltration = WolfArray(srcheader=bat.get_header(), whichtype= WOLF_ARRAY_FULL_INTEGER)
1189
1267
  infiltration.array.data[:,:] = 0
1190
1268
 
1269
+ # check for roof
1270
+ if exists(dir / '__roof.tif'):
1271
+ roof = WolfArray(str(dir / '__roof.tif'))
1272
+ if roof.wolftype != WOLF_ARRAY_FULL_SINGLE:
1273
+ logging.error(_('Roof .tif must be a full single array ! -- The array will be ignored !'))
1274
+ roof = WolfArray(srcheader=bat.get_header(), whichtype= WOLF_ARRAY_FULL_SINGLE)
1275
+ roof.array.data[:,:] = 99999.
1276
+ else:
1277
+ roof = WolfArray(srcheader=bat.get_header(), whichtype= WOLF_ARRAY_FULL_SINGLE)
1278
+ roof.array.data[:,:] = 99999.
1279
+
1191
1280
  # applying Python scrpitps on ARRAYS
1192
- self._apply_scripts_update_topo_maning_inf(dir, bat, man, infiltration)
1281
+ self._apply_scripts_update_topo_maning_inf_roof(dir, bat, man, infiltration, roof)
1193
1282
 
1194
1283
  # save arrays on disk
1195
1284
  bat.write_all(str(dir / '__bathymetry_after_scripts.tif'))
1196
1285
  man.write_all(str(dir / '__manning_after_scripts.tif'))
1197
1286
  infiltration.write_all(str(dir / '__infiltration_after_scripts.tif'))
1287
+ roof.write_all(str(dir / '__roof_after_scripts.tif'))
1198
1288
 
1199
1289
  # create simulation
1200
1290
  allsims = []
1201
- for curdir, curhydro, curic in zip(used_dirs, used_hydros, used_ic):
1291
+ for id_sim, (curdir, curhydro, curic) in enumerate(zip(used_dirs, used_hydros, used_ic)):
1292
+
1293
+ if callback is not None:
1294
+ callback(id_sim)
1202
1295
 
1203
1296
  # instanciation de la simulation
1204
1297
  cursim = SimpleSimulation(self._header.nbx, self._header.nby)
@@ -1260,6 +1353,13 @@ class Config_Manager_2D_GPU:
1260
1353
 
1261
1354
  cursim.infiltration_zones = np.asarray(infiltration.array.data, dtype=np.int32)
1262
1355
 
1356
+ if roof.nbnotnull == 0:
1357
+ cursim.bridge_roof = None
1358
+ logging.info(_("No cells defined as roof ! -- Roof will be ignored !"))
1359
+ else:
1360
+ cursim.bridge_roof = roof.array.data
1361
+ logging.info(_("You have {} cells defined as roof").format(roof.nbnotnull))
1362
+
1263
1363
  # add hydrograph
1264
1364
  for idx, curline in curhydro.data.iterrows():
1265
1365
  cursim.add_infiltration(float(idx), [float(cur) for cur in curline.values])
@@ -1505,29 +1605,33 @@ class UI_Manager_2D_GPU():
1505
1605
  self._create_void_infil.Bind(wx.EVT_BUTTON,self.oncreate_void_infil)
1506
1606
  self._create_void_infil.SetToolTip(_('Create a void infiltration zones file based on bathymetry.tif'))
1507
1607
 
1608
+ self._create_void_roof = wx.Button(self._frame,label = _('Create .tif bridge/culvert roof elevation'))
1609
+ self._create_void_roof.Bind(wx.EVT_BUTTON,self.oncreate_void_roof)
1610
+ self._create_void_roof.SetToolTip(_('Create a void roof file based on bathymetry.tif'))
1611
+
1508
1612
  self._create_void_scripts = wx.Button(self._frame,label = _('Create void scripts'))
1509
1613
  self._create_void_scripts.Bind(wx.EVT_BUTTON,self.oncreate_void_scripts)
1510
1614
  self._create_void_scripts.SetToolTip(_('Create void script files for topography, manning and infiltration'))
1511
1615
 
1512
1616
  self._create_vrt = wx.Button(self._frame,label = _('Assembly .vrt to current level'))
1513
1617
  self._create_vrt.Bind(wx.EVT_BUTTON,self.oncreatevrt)
1514
- self._create_vrt.SetToolTip(_('Create a .vrt file from all bathymetry and manning .tif files\nBe sure that all files are right named !\n\n - bathymetry must contain "bath"\n - manning must contain "mann"\n - infiltration must contain "infil"'))
1618
+ self._create_vrt.SetToolTip(_('Create a .vrt file from all bathymetry, manning, infiltration and roof .tif files\nBe sure that all files are right named !\n\n - bathymetry must contain "bath"\n - manning must contain "mann"\n - infiltration must contain "infil"\n - roof must contain "roof"'))
1515
1619
 
1516
1620
  self._translate_vrt = wx.Button(self._frame,label = _('Translate .vrt to .tif'))
1517
1621
  self._translate_vrt.Bind(wx.EVT_BUTTON,self.ontranslatevrt2tif)
1518
- self._translate_vrt.SetToolTip(_('Translate .vrt files to .tif files\n\n - __bath_assembly.vrt -> __bathymetry.tif\n - __mann_assembly.vrt -> __manning.tif\n - __infil_assembly.vrt -> __infiltration.tif'))
1622
+ self._translate_vrt.SetToolTip(_('Translate .vrt files to .tif files\n\n - __bath_assembly.vrt -> __bathymetry.tif\n - __mann_assembly.vrt -> __manning.tif\n - __infil_assembly.vrt -> __infiltration.tif\n - __roof_assembly.vrt -> __roof.tif'))
1519
1623
 
1520
- self._apply_scripts = wx.Button(self._frame,label = _('Apply scripts on bathymetry, manning and infiltration'))
1624
+ self._apply_scripts = wx.Button(self._frame,label = _('Apply scripts on bathymetry, manning, infiltration and roof elevation'))
1521
1625
  self._apply_scripts.Bind(wx.EVT_BUTTON,self.onapply_scripts)
1522
- self._apply_scripts.SetToolTip(_('Apply scripts on bathymetry, manning and infiltration\n\n - bathymetry.tif\n - manning.tif\n - infiltration.tif\n\nThe scripts must be in the structure starting with parent directory and descending\n\n - bathymetry.py\n - manning.py\n - infiltration.py'))
1626
+ self._apply_scripts.SetToolTip(_('Apply scripts on bathymetry, manning and infiltration\n\n - bathymetry.tif\n - manning.tif\n - infiltration.tif\n - roof.tif\n\nThe scripts must be in the structure starting with parent directory and descending.'))
1523
1627
 
1524
1628
  self._create_vec = wx.Button(self._frame,label = _('Search spatial coverage from current level'))
1525
1629
  self._create_vec.Bind(wx.EVT_BUTTON,self.oncreatevec)
1526
- self._create_vec.SetToolTip(_('Create a .vecz file (with contour and global bounds) from all bathymetry and manning .tif files\nBe sure that all files are right named !\n\n - bathymetry must contain "bath"\n - manning must contain "mann"\n - infiltration must contain "infil"'))
1630
+ self._create_vec.SetToolTip(_('Create a .vecz file (with contour and global bounds) from all bathymetry and manning .tif files\nBe sure that all files are right named !\n\n - bathymetry must contain "bath"\n - manning must contain "mann"\n - infiltration must contain "infil"\n - roof must contain "roof"'))
1527
1631
 
1528
1632
  self._check_prefix = wx.Button(self._frame,label = _('Check prefix (tif files)'))
1529
1633
  self._check_prefix.Bind(wx.EVT_BUTTON,self.oncheck_prefix)
1530
- self._check_prefix.SetToolTip(_('Check prefix of .tif files\n\n - bath_*.tif\n - mann_*.tif\n - infil_*.tif\n\nThe prefix must be "bath_", "mann_" and "infil_"'))
1634
+ self._check_prefix.SetToolTip(_('Check prefix of .tif files\n\n - bath_*.tif\n - mann_*.tif\n - infil_*.tif\n - roof_*.tif\n\nThe prefix must be "bath_", "mann_", "infil_" and "roof_"'))
1531
1635
 
1532
1636
  self._checkconsistency = wx.Button(self._frame,label = _('Check consistency'))
1533
1637
  self._checkconsistency.Bind(wx.EVT_BUTTON,self.oncheck_consistency)
@@ -1577,6 +1681,7 @@ class UI_Manager_2D_GPU():
1577
1681
  # buttons -> sizer
1578
1682
  sizer_buttons.Add(self._reload,1,wx.EXPAND)
1579
1683
  sizer_buttons.Add(self._create_void_infil,1,wx.EXPAND)
1684
+ sizer_buttons.Add(self._create_void_roof,1,wx.EXPAND)
1580
1685
  sizer_buttons.Add(self._create_void_scripts,1,wx.EXPAND)
1581
1686
  sizer_buttons.Add(self._check_prefix,1,wx.EXPAND)
1582
1687
  sizer_buttons.Add(self._create_vrt,1,wx.EXPAND)
@@ -1645,6 +1750,12 @@ class UI_Manager_2D_GPU():
1645
1750
  self._parent.create_void_infil()
1646
1751
  self.reload()
1647
1752
 
1753
+ def oncreate_void_roof(self, e:wx.MouseEvent):
1754
+ """ Création d'un fichier de toit de pont vide """
1755
+
1756
+ self._parent.create_void_roof()
1757
+ self.reload()
1758
+
1648
1759
  def oncreate_void_scripts(self,e:wx.MouseEvent):
1649
1760
  """ Création d'un script vide """
1650
1761
 
@@ -1701,9 +1812,17 @@ class UI_Manager_2D_GPU():
1701
1812
  def oncreatevrt(self,e:wx.MouseEvent):
1702
1813
  """ Création d'un fichier vrt """
1703
1814
 
1815
+ if self._selected_item is None:
1816
+ logging.error(_('Please select a scenario to analyze by activating an elemnt in the tree list !'))
1817
+ return
1818
+
1704
1819
  logging.info(_('Creating vrt ...'))
1705
1820
  mydata = self._treelist.GetItemData(self._selected_item)
1706
1821
 
1822
+ if not 'path' in mydata:
1823
+ logging.error(_('Please select a scenario to analyze !'))
1824
+ return
1825
+
1707
1826
  # création du fichier vrt
1708
1827
  self._parent.create_vrt(mydata['path'])
1709
1828
  logging.info(_('... done !'))
@@ -1713,6 +1832,10 @@ class UI_Manager_2D_GPU():
1713
1832
  def oncreatevec(self,e:wx.MouseEvent):
1714
1833
  """ Création d'un fichier vec """
1715
1834
 
1835
+ if self._selected_item is None:
1836
+ logging.error(_('Please select a scenario to analyze by activating an elemnt in the tree list !'))
1837
+ return
1838
+
1716
1839
  logging.info(_('Creating vecz ...'))
1717
1840
  mydata = self._treelist.GetItemData(self._selected_item)
1718
1841
 
@@ -1783,7 +1906,7 @@ class UI_Manager_2D_GPU():
1783
1906
  return
1784
1907
 
1785
1908
  # application des scripts
1786
- self._parent.apply_scripts_bath_mann_inf(mydata['path'])
1909
+ self._parent.apply_scripts_bath_mann_inf_roof(mydata['path'])
1787
1910
 
1788
1911
  self.reload()
1789
1912
  logging.info(_('... done !'))
@@ -1794,7 +1917,7 @@ class UI_Manager_2D_GPU():
1794
1917
  logging.info(_('Checking prefix ...'))
1795
1918
  if self._selected_item is None or self._selected_item == self._treelist.GetRootItem():
1796
1919
  logging.info(_('No item selected ! -- using root item'))
1797
- with wx.MessageDialog(None, _('No item selected ! -- using root item'), _('Warning'), wx.OK | wx.CANCEL | wx.ICON_WARNING) as dlg:
1920
+ with wx.MessageDialog(None, _('No item selected ! -- using root item ?'), _('Warning'), wx.OK | wx.CANCEL | wx.ICON_WARNING) as dlg:
1798
1921
  ret = dlg.ShowModal()
1799
1922
  if ret != wx.ID_OK:
1800
1923
  return
@@ -1805,7 +1928,7 @@ class UI_Manager_2D_GPU():
1805
1928
  # création du fichier vrt
1806
1929
  log = self._parent.check_prefix(mydata['.tif']+mydata['.tiff'])
1807
1930
  if log =='':
1808
- self._txtctrl.WriteText(_("All is fine !"))
1931
+ self._txtctrl.WriteText("\n".join([_("All is fine !")]))
1809
1932
  else:
1810
1933
  self._txtctrl.WriteText(log)
1811
1934
 
@@ -1816,16 +1939,16 @@ class UI_Manager_2D_GPU():
1816
1939
 
1817
1940
  log = self._parent.check_consistency()
1818
1941
  if log =='':
1819
- self._txtctrl.WriteText(_("All is fine !\n\n"))
1942
+ self._txtctrl.WriteText("\n\n".join([_("All is fine !")]))
1820
1943
  else:
1821
- self._txtctrl.WriteText(log +"\n\n")
1944
+ self._txtctrl.WriteText("\n\n".join([log]))
1822
1945
 
1823
1946
  # Info on Python Environment and wolfgpu Path and version
1824
1947
  # -------------------------------------------------------
1825
1948
 
1826
1949
  import sys
1827
1950
  # Python Environment
1828
- self._txtctrl.write(_('Python Environment\n'))
1951
+ self._txtctrl.write(_('\nPython Environment\n'))
1829
1952
  self._txtctrl.write('-------------------\n')
1830
1953
  self._txtctrl.write('Python version : {}\n'.format(sys.version))
1831
1954
  self._txtctrl.write('Python path : {}\n'.format(sys.executable))
@@ -1948,7 +2071,11 @@ class UI_Manager_2D_GPU():
1948
2071
  preserve_ic = ret == wx.ID_YES
1949
2072
  dlg.Destroy()
1950
2073
 
1951
- allsims = self._parent.create_simulation(Path(path), hydro, destroy_if_exists, preserve_ic)
2074
+ pgbar = wx.ProgressDialog(_('Creating simulations ...'), _('Please wait ...'), maximum=len(hydro), parent=self._frame, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
2075
+
2076
+ allsims = self._parent.create_simulation(Path(path), hydro, destroy_if_exists, preserve_ic, callback=pgbar.Update)
2077
+
2078
+ pgbar.Destroy()
1952
2079
 
1953
2080
  self.reload()
1954
2081
 
@@ -40,7 +40,7 @@ class Update_Sim:
40
40
  - topobahty.array.mask[:,:]
41
41
  - topobahty.array.data[:,:]
42
42
 
43
- Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'esace alloué.
43
+ Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'espace alloué.
44
44
 
45
45
  EN
46
46
 
@@ -71,7 +71,7 @@ class Update_Sim:
71
71
  - manning.array.mask[:,:]
72
72
  - manning.array.data[:,:]
73
73
 
74
- Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'esace alloué.
74
+ Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'espace alloué.
75
75
 
76
76
  EN
77
77
 
@@ -102,7 +102,7 @@ class Update_Sim:
102
102
  - infiltration_zones.array.mask[:,:]
103
103
  - infiltration_zones.array.data[:,:]
104
104
 
105
- Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'esace alloué.
105
+ Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'espace alloué.
106
106
 
107
107
  EN
108
108
 
@@ -119,6 +119,37 @@ class Update_Sim:
119
119
  """
120
120
  pass
121
121
 
122
+ def update_roof(self, roof:WolfArray):
123
+ """
124
+ FR
125
+
126
+ Cette fonction doit être particularisée afin d'appliquer des modifications
127
+ à l'altimétrie des ponts et ponceaux (toits)'.
128
+
129
+ L'information de base se trouve dans le paramètre 'roof' de classe 'WolfArray'.
130
+
131
+ La matrice Numpy, en <Float32>, (avec masque - cf np.ma ) est accessible via :
132
+ - roof.array[:,:]
133
+ - roof.array.mask[:,:]
134
+ - roof.array.data[:,:]
135
+
136
+ Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'espace alloué.
137
+
138
+ EN
139
+
140
+ This function must be customized to apply modifications to the roof elevation of bridges/culverts.
141
+
142
+ The basic information is located in the 'roof' parameter ('WolfArray' class).
143
+
144
+ The Numpy array, in <Float32>, (with a mask - see np.ma), can be accessed via:
145
+ - roof.array[:,:]
146
+ - roof.array.mask[:,:]
147
+ - roof.array.data[:,:]
148
+
149
+ It is not allowed to replace the array (creating a new array and/or pointing an other array). All operations must be performed within the allocated space.
150
+ """
151
+ pass
152
+
122
153
  def create_empty_method(method_name, method_signature, docstring, imports):
123
154
  # Fonction utilitaire pour créer des méthodes vides avec la même signature, la documentation et les importations
124
155
  imports_str = '\n'.join(f'import {module}' for module in imports)
wolfhece/wolf_array.py CHANGED
@@ -2678,17 +2678,29 @@ class Ops_Array(wx.Frame):
2678
2678
 
2679
2679
  # operator value
2680
2680
  opval = self.opvalue.GetValue()
2681
- if opval.lower() == 'null' or opval.lower() == 'nan':
2681
+ if opval.lower() == 'null' or opval.lower() == 'nan' or opval.lower() == 'nul':
2682
2682
  curopvalue = self.parentarray.nullvalue
2683
2683
  else:
2684
- curopvalue = float(opval)
2684
+ try:
2685
+ tmp_float = float(opval)
2686
+ except:
2687
+ logging.error('Error in float conversion - Do you try to set null value ? - Accepted values : "Null" or "NaN"')
2688
+ return
2689
+
2690
+ curopvalue = tmp_float
2685
2691
 
2686
2692
  # condition value
2687
2693
  curcondvalue = self.condvalue.GetValue()
2688
- if curcondvalue.lower() == 'null' or curcondvalue.lower() == 'nan':
2694
+ if curcondvalue.lower() == 'null' or curcondvalue.lower() == 'nan' or curcondvalue.lower() == 'nul':
2689
2695
  curcondvalue = self.parentarray.nullvalue
2690
2696
  else:
2691
- curcondvalue = float(curcondvalue)
2697
+ try:
2698
+ tmp_float = float(curcondvalue)
2699
+ except:
2700
+ logging.error('Error in float conversion - Do you try to set null value ? - Accepted values : "Null" or "NaN"')
2701
+ return
2702
+
2703
+ curcondvalue = tmp_float
2692
2704
 
2693
2705
  self.parentarray.SelectionData.treat_select(curop, curcond, curopvalue, curcondvalue)
2694
2706
 
@@ -2698,8 +2710,16 @@ class Ops_Array(wx.Frame):
2698
2710
  curop = self.choiceop.GetSelection()
2699
2711
  curcond = self.condition.GetSelection()
2700
2712
 
2701
- curopvalue = float(self.opvalue.GetValue())
2702
- curcondvalue = float(self.condvalue.GetValue())
2713
+ try:
2714
+ curopvalue = float(self.opvalue.GetValue())
2715
+ except:
2716
+ logging.error('Error in float conversion - operator')
2717
+ return
2718
+ try:
2719
+ curcondvalue = float(self.condvalue.GetValue())
2720
+ except:
2721
+ logging.error('Error in float conversion - condition')
2722
+ return
2703
2723
 
2704
2724
  self.parentarray.SelectionData.mask_condition(curop, curcond, curopvalue, curcondvalue)
2705
2725
  self.refresh_array()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.101
3
+ Version: 2.1.103
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
@@ -7,8 +7,8 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
7
  wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
8
8
  wolfhece/PyConfig.py,sha256=Bb1T8qjgKMChadJYDrHO9uo6CwItiAXScZpYkDXqZF8,11387
9
9
  wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
10
- wolfhece/PyDraw.py,sha256=7EgqbpTex4_SImJhHmTpsVOa6-9Czv9Cy7V7ZWnoqE4,476329
11
- wolfhece/PyGui.py,sha256=t1JmyLzRzM1aI-TiDmIqPyoN2FLd1j6Y8rl4u-NJVOc,143676
10
+ wolfhece/PyDraw.py,sha256=p1lxn2ScM3f5QI97r80XDg4pgWSc6T-craaPVPfcX2Y,476586
11
+ wolfhece/PyGui.py,sha256=jyeYF7srKH3HLZQGQIqcRW3u308KUDA-oLwzX-jkDzQ,143843
12
12
  wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
13
13
  wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
14
14
  wolfhece/PyPalette.py,sha256=81n1P-olOe4wElTLv-miSDhqvJU_RHcxgfpHt794dSw,31436
@@ -22,7 +22,7 @@ wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
22
22
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
23
23
  wolfhece/RatingCurve_xml.py,sha256=cUjReVMHFKtakA2wVey5zz6lCgHlSr72y7ZfswZDvTM,33891
24
24
  wolfhece/ReadDataDCENN.py,sha256=vm-I4YMryvRldjXTvRYEUCxZsjb_tM7U9yj6OaPyD0k,1538
25
- wolfhece/Results2DGPU.py,sha256=fb_s9w3xvoYQUMHPfC4dfY4xGYrf8kNjzrKr3kgPjmU,24442
25
+ wolfhece/Results2DGPU.py,sha256=dtLGrNe0VOWJHw5moduLBIaXFf2xRkmpKlIfmB2zje0,24453
26
26
  wolfhece/__init__.py,sha256=FRDE8PiJAWxX9PMXsShRMZ8YADAY4WIgKMRh52rmhiw,23
27
27
  wolfhece/_add_path.py,sha256=nudniS-lsgHwXXq5o626XRDzIeYj76GoGKYt6lcu2Nc,616
28
28
  wolfhece/analyze_vect.py,sha256=3lkMwaQ4KRddBVRvlP9PcM66wZwwC0eCmypP91AW-os,6015
@@ -51,7 +51,7 @@ wolfhece/pywalous.py,sha256=mWB7UxlYMIbPxNUDlONQEjcOOy9VSaRU9aYWZ5IFLu8,19164
51
51
  wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
52
52
  wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
53
53
  wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
54
- wolfhece/wolf_array.py,sha256=9cprIFDd1-HnUU2wiXlBwxZTF8j7eMpinwPIuv-y7A0,419498
54
+ wolfhece/wolf_array.py,sha256=ZJ_HvlN2GeuW4lNJ15-HZSOK5iNc_t5eN4YmL3lJYbY,420268
55
55
  wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
56
56
  wolfhece/wolf_texture.py,sha256=DS5eobLxrq9ljyebYfpMSQPn8shkUAZZVfqrOKN_QUU,16951
57
57
  wolfhece/wolf_tiles.py,sha256=2Ho2I20rHRY81KXxjgLOYISdF4OkJ2d6omeY4shDoGI,10386
@@ -73,13 +73,13 @@ wolfhece/apps/WolfPython2.png,sha256=VMPV-M-3BCOg8zOJss8bXwPmzRYZy8Fo-XtnVYNgbaw
73
73
  wolfhece/apps/WolfPython3.png,sha256=3G84zx14HnlB9YXMY4VUAO7IB3eu7JFvi4Kpmc_4zBE,403298
74
74
  wolfhece/apps/__init__.py,sha256=OzzKItATWV0mDkz_LC2L3w5sgT2rt8ExXXCbR_FwvlY,24
75
75
  wolfhece/apps/acceptability.py,sha256=hMIxTRNQARTTWJJaakb6kEK9udNh-w64VDgxxezVk3k,790
76
- wolfhece/apps/check_install.py,sha256=Xoi_d8MzKzNAy2xqEpERdsqgRPu0hbBWukI0WkIYzD0,1701
76
+ wolfhece/apps/check_install.py,sha256=kpfBBGjYqu_Ptk2XlQWmiXHxpiWY4ICt3N4B1VsACgs,2299
77
77
  wolfhece/apps/check_version.py,sha256=Zze7ltzcM2ZzIGMwkcASIjapCG8CEzzW9kwNscA3NhM,1768
78
78
  wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefgmk,5334
79
79
  wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
80
80
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
81
81
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
82
- wolfhece/apps/version.py,sha256=O6kRLN9ca4T45HDLQqitzmq_yGo7Vf11NVrPuLXreCM,389
82
+ wolfhece/apps/version.py,sha256=JzbTGIrCJEVfos-Oqf4HYsLQF6ZIUulzpzVopj07hdk,389
83
83
  wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
84
84
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
85
85
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -226,7 +226,7 @@ wolfhece/mesh2d/bc_manager.py,sha256=fKED0RhUjCmd0xd0lcOeZqiga5Glqs1ag1boYhXlq0k
226
226
  wolfhece/mesh2d/cell_tracker.py,sha256=mPmnD5lEf3gLPuLqtAIo-Gp-ipAwQdPxzjWOGt0b7jM,8958
227
227
  wolfhece/mesh2d/config_manager.py,sha256=DcdxCIIs_dyC6ayJOBULeY364LONogL9PBaqBtC9eQ4,14736
228
228
  wolfhece/mesh2d/cst_2D_boundary_conditions.py,sha256=Y4DF68uAklF3fXJgf05nb_JvJk2pvzcu_wu5nFXpWJo,5008
229
- wolfhece/mesh2d/gpu_2d.py,sha256=QM1TCOJ0lN1GXvI3Y6v9l5glAodL7EiEUGNHM0KUfO0,23879
229
+ wolfhece/mesh2d/gpu_2d.py,sha256=XeQIYMqdwFsLw-wDE5jbyphhCgta5QfZhE_7lVtNiCE,24260
230
230
  wolfhece/mesh2d/simple_2d.py,sha256=mVFbTTG2Ah1idz2aYrxI44mi-Z24nC9Vxw1qP2Oib3Y,111350
231
231
  wolfhece/mesh2d/wolf2dprev.py,sha256=D3CmGMYuhOJxQ7AyTSK97gko1ZaIRvO-0RbD2XvHfDM,491600
232
232
  wolfhece/models/5_coul.pal,sha256=OI1UqcNIDBpJn2k_VDel__r-hKjjvdob0eqinGCI3QY,160
@@ -268,10 +268,10 @@ wolfhece/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
268
268
  wolfhece/report/reporting.py,sha256=JUEXovx_S4jpYkJEBU0AC-1Qw2OkkWyV3VAp6iOfSHc,19494
269
269
  wolfhece/report/wolf_report.png,sha256=NoSV58LSwb-oxCcZScRiJno-kxDwRdm_bK-fiMsKJdA,592485
270
270
  wolfhece/scenario/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
271
- wolfhece/scenario/check_scenario.py,sha256=VVjtxfcLAgq_Pf8VSqRq6BJ-y4Zi24CntJpZWxAv3n8,5162
272
- wolfhece/scenario/config_manager.py,sha256=wYwDAryRjF0dZlssTXsO0uPzoUXY71CxSW0QEP47KpI,99478
271
+ wolfhece/scenario/check_scenario.py,sha256=d-LWa_FxmPxTSc_H1lDHwqLB6TCqj1IUrRJhatfPMMA,5623
272
+ wolfhece/scenario/config_manager.py,sha256=FGhSbiZ6960-aZg1HHl131nnYGVcrE8C1rjGorrHH0E,105867
273
273
  wolfhece/scenario/imposebc_void.py,sha256=PqA_99hKcaqK5zsK6IRIc5Exgg3WVpgWU8xpwNL49zQ,5571
274
- wolfhece/scenario/update_void.py,sha256=ay8C_FxfXN627Hx46waaAO6F3ovYmOCTxseUumKAY7c,7474
274
+ wolfhece/scenario/update_void.py,sha256=zb4LBX7uQCJykZWOKPQMTDtzoWkPRJqlx2qWMPvCnw8,8755
275
275
  wolfhece/shaders/fragment_shader_texture.glsl,sha256=w6h8d5mJqFaGbao0LGmjRcFFdcEQ3ICIl9JpuT71K5k,177
276
276
  wolfhece/shaders/geom_grid.glsl,sha256=7eAkutCrwoeJpIdF69Ar7K18YyClvVG8ArJJARcmC-Q,742
277
277
  wolfhece/shaders/quad_frag_shader.glsl,sha256=GYGg9q4vFXiMuLK-pxSLz7crAE3dvlzJ7-e7PMfwSq0,1227
@@ -292,8 +292,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
292
292
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
293
293
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
294
294
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
295
- wolfhece-2.1.101.dist-info/METADATA,sha256=yIG3slf37M70RNNQpU4S5csPCRVEh4d_QvspxTCYZCc,2618
296
- wolfhece-2.1.101.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
297
- wolfhece-2.1.101.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
298
- wolfhece-2.1.101.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
299
- wolfhece-2.1.101.dist-info/RECORD,,
295
+ wolfhece-2.1.103.dist-info/METADATA,sha256=P_o5O7D46xHTvlo0hbWZ22gjXmXz14bE2xqOjlekwD0,2618
296
+ wolfhece-2.1.103.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
297
+ wolfhece-2.1.103.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
298
+ wolfhece-2.1.103.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
299
+ wolfhece-2.1.103.dist-info/RECORD,,