wolfhece 2.1.99__py3-none-any.whl → 2.1.100__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
@@ -987,7 +987,7 @@ class Sim_Explorer(wx.Frame):
987
987
  if mode == 0:
988
988
  # By time [s]
989
989
  prev_time = self._all_times_steps[0][idx] - float(self._interval.GetValue())
990
- diff = [abs(prev_time - i) for i in self._all_times_steps[0][:i]]
990
+ diff = [abs(prev_time - i) for i in self._all_times_steps[0][:idx]]
991
991
  prev_idx = diff.index(min(diff))
992
992
 
993
993
  return prev_idx
@@ -995,7 +995,7 @@ class Sim_Explorer(wx.Frame):
995
995
  elif mode == 1:
996
996
  # By time [hour]
997
997
  prev_time = self._all_times_steps[0][idx] - float(self._interval.GetValue())*3600
998
- diff = [abs(prev_time - i) for i in self._all_times_steps[0][:i]]
998
+ diff = [abs(prev_time - i) for i in self._all_times_steps[0][:idx]]
999
999
  prev_idx = diff.index(min(diff))
1000
1000
 
1001
1001
  return prev_idx
@@ -1009,7 +1009,7 @@ class Sim_Explorer(wx.Frame):
1009
1009
  elif mode == 3:
1010
1010
  # By time step
1011
1011
  prev_idx = self._all_times_steps[1].index(self._all_times_steps[1][idx] - int(self._interval.GetValue()))
1012
- diff = [abs(prev_idx - i) for i in self._all_times_steps[1][:i]]
1012
+ diff = [abs(prev_idx - i) for i in self._all_times_steps[1][:idx]]
1013
1013
  prev_idx = diff.index(min(diff))
1014
1014
 
1015
1015
  return prev_idx
@@ -7581,16 +7581,27 @@ class WolfMapViewer(wx.Frame):
7581
7581
  # myhead.dy = 1.
7582
7582
 
7583
7583
  else:
7584
+
7585
+ dlg = wx.TextEntryDialog(self,_('Spatial step size (assuming dx == dy) ?'), value='1')
7586
+ ret=dlg.ShowModal()
7587
+
7588
+ if ret == wx.ID_CANCEL:
7589
+ dlg.Destroy()
7590
+ return -1
7591
+
7592
+ tmpdx = float(dlg.GetValue())
7593
+ dlg.Destroy()
7594
+
7595
+ dy = dx
7596
+
7584
7597
  myxyz = xyz_scandir(filename, None)
7585
7598
  myhead = header_wolf()
7586
7599
 
7587
- myhead.origx = np.min(myxyz[:, 0]) - .5
7588
- myhead.origy = np.min(myxyz[:, 1]) - .5
7600
+ myhead.origx = np.min(myxyz[:, 0]) - dx/2.
7601
+ myhead.origy = np.min(myxyz[:, 1]) - dy/2.
7589
7602
 
7590
- myhead.dx = 1.
7591
- myhead.dy = 1.
7592
- tmpdx = 1.
7593
- tmpdy = 1.
7603
+ myhead.dx = dx
7604
+ myhead.dy = dy
7594
7605
 
7595
7606
  myhead.nbx = int(np.max(myxyz[:, 0]) - myhead.origx) + 1
7596
7607
  myhead.nby = int(np.max(myxyz[:, 1]) - myhead.origy) + 1
@@ -7608,10 +7619,6 @@ class WolfMapViewer(wx.Frame):
7608
7619
 
7609
7620
  newobj.mask_data(newobj.nullvalue)
7610
7621
 
7611
- # if min(tmpdx, tmpdy) != 1.:
7612
- # newobj.rebin(min(tmpdx, tmpdy))
7613
- # newobj.mask_data(newobj.nullvalue)
7614
-
7615
7622
  newobj.change_gui(self)
7616
7623
  newobj.updatepalette(0)
7617
7624
  self.myarrays.append(newobj)
@@ -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)
@@ -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()