wolfhece 2.1.3__py3-none-any.whl → 2.1.6__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 +33 -3
- wolfhece/PyGui.py +50 -29
- wolfhece/PyVertexvectors.py +55 -11
- wolfhece/Results2DGPU.py +35 -3
- wolfhece/apps/splashscreen.py +1 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/scenario/config_manager.py +79 -7
- wolfhece/wolf_array.py +44 -20
- wolfhece/wolf_vrt.py +2 -0
- {wolfhece-2.1.3.dist-info → wolfhece-2.1.6.dist-info}/METADATA +1 -1
- {wolfhece-2.1.3.dist-info → wolfhece-2.1.6.dist-info}/RECORD +14 -14
- {wolfhece-2.1.3.dist-info → wolfhece-2.1.6.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.3.dist-info → wolfhece-2.1.6.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.3.dist-info → wolfhece-2.1.6.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -933,7 +933,7 @@ class WolfMapViewer(wx.Frame):
|
|
933
933
|
dlg.Destroy()
|
934
934
|
|
935
935
|
|
936
|
-
dlg = wx.FileDialog(self, _("Choose the output file"), wildcard="Geotif (*.tif)|*.tif|all (*.*)|*.*", style=wx.FD_SAVE, defaultDir=def_outdrir)
|
936
|
+
dlg = wx.FileDialog(self, _("Choose the output file"), wildcard="Geotif (*.tif)|*.tif|all (*.*)|*.*", style=wx.FD_SAVE, defaultDir=str(def_outdrir))
|
937
937
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
938
938
|
dlg.Destroy()
|
939
939
|
return
|
@@ -6492,9 +6492,11 @@ class WolfMapViewer(wx.Frame):
|
|
6492
6492
|
elif idx == 4:
|
6493
6493
|
curtype = WOLF_ARRAY_FULL_INTEGER8 #np.int8
|
6494
6494
|
|
6495
|
-
newarray = WolfArray(srcheader=self.selected_object.get_header(), whichtype=curtype)
|
6495
|
+
newarray = WolfArray(srcheader=self.selected_object.get_header(), whichtype=curtype, nullvalue=self.selected_object.nullvalue)
|
6496
6496
|
|
6497
6497
|
newarray.allocate_ressources()
|
6498
|
+
asnewtype = self.selected_object.array.data.astype(newarray.dtype)
|
6499
|
+
newarray.array.data[:,:] = asnewtype[:,:]
|
6498
6500
|
newarray.copy_mask(self.selected_object, forcenullvalue=True, link=False)
|
6499
6501
|
else:
|
6500
6502
|
newarray = WolfArray(mold=self.selected_object)
|
@@ -8168,8 +8170,21 @@ class WolfMapViewer(wx.Frame):
|
|
8168
8170
|
self.copyfrom = self.active_array
|
8169
8171
|
self.mimicme_copyfrom() # force le recopiage de copyfrom dans les autres matrices liées
|
8170
8172
|
|
8173
|
+
if len(self.active_array.SelectionData.myselection) > 5000:
|
8174
|
+
dlg = wx.MessageDialog(self, _('The selection is large, copy to clipboard may be slow ! -- Continue?'), style=wx.OK | wx.CANCEL)
|
8175
|
+
ret = dlg.ShowModal()
|
8176
|
+
|
8177
|
+
if ret == wx.ID_CANCEL:
|
8178
|
+
logging.info(_('Copy to clipboard cancelled -- But source array is well defined !'))
|
8179
|
+
dlg.Destroy()
|
8180
|
+
return
|
8181
|
+
|
8182
|
+
dlg.Destroy()
|
8183
|
+
|
8171
8184
|
self.active_array.SelectionData.copy_to_clipboard()
|
8172
8185
|
|
8186
|
+
logging.info(_('Values copied to clipboard'))
|
8187
|
+
|
8173
8188
|
elif key == ord('C') and ctrldown and altdown:
|
8174
8189
|
if self.active_array is None:
|
8175
8190
|
dlg = wx.MessageDialog(self,
|
@@ -8183,8 +8198,21 @@ class WolfMapViewer(wx.Frame):
|
|
8183
8198
|
self.copyfrom = self.active_array
|
8184
8199
|
self.mimicme_copyfrom() # force le recopiage de copyfrom dans les autres matrices liées
|
8185
8200
|
|
8201
|
+
if len(self.active_array.SelectionData.myselection) > 5000:
|
8202
|
+
dlg = wx.MessageDialog(self, _('The selection is large, copy to clipboard may be slow ! -- Continue?'), style=wx.OK | wx.CANCEL)
|
8203
|
+
ret = dlg.ShowModal()
|
8204
|
+
|
8205
|
+
if ret == wx.ID_CANCEL:
|
8206
|
+
logging.info(_('Copy script to clipboard cancelled -- But source array is well defined !'))
|
8207
|
+
dlg.Destroy()
|
8208
|
+
return
|
8209
|
+
|
8210
|
+
dlg.Destroy()
|
8211
|
+
|
8186
8212
|
self.active_array.SelectionData.copy_to_clipboard(typestr='script')
|
8187
8213
|
|
8214
|
+
logging.info(_('Selection copied to clipboard as script (Python)'))
|
8215
|
+
|
8188
8216
|
elif key == ord('V') and ctrldown:
|
8189
8217
|
# CTRL+V
|
8190
8218
|
# CTRL+ALT+V ou Alt Gr + V
|
@@ -8223,7 +8251,7 @@ class WolfMapViewer(wx.Frame):
|
|
8223
8251
|
self.active_array.SelectionData.update_nb_nodes_selection()
|
8224
8252
|
|
8225
8253
|
else:
|
8226
|
-
logging.info(_('
|
8254
|
+
logging.info(_('Paste selection values'))
|
8227
8255
|
if cursel == 'all':
|
8228
8256
|
self.active_array.paste_all(fromarray)
|
8229
8257
|
|
@@ -8233,6 +8261,8 @@ class WolfMapViewer(wx.Frame):
|
|
8233
8261
|
|
8234
8262
|
self.Refresh()
|
8235
8263
|
|
8264
|
+
logging.info(_('Selection/Values pasted'))
|
8265
|
+
|
8236
8266
|
else:
|
8237
8267
|
if key == wx.WXK_DELETE:
|
8238
8268
|
self.removeobj()
|
wolfhece/PyGui.py
CHANGED
@@ -69,8 +69,7 @@ class GenMapManager(wx.Frame):
|
|
69
69
|
# the garbage collector don't remove it
|
70
70
|
# before us (WolfLauncher has no parent
|
71
71
|
# so it dangles).
|
72
|
-
self._MySplash = WolfLauncher(
|
73
|
-
play_sound=self._configuration[ConfigurationKeys.PLAY_WELCOME_SOUND])
|
72
|
+
self._MySplash = WolfLauncher(play_sound=self._configuration[ConfigurationKeys.PLAY_WELCOME_SOUND])
|
74
73
|
# Don't pollute the call to wf.Frame.__init__
|
75
74
|
kw.pop(SPLASH_PARAM, None)
|
76
75
|
|
@@ -149,40 +148,62 @@ class MapManager(GenMapManager):
|
|
149
148
|
super().__init__(*args, **kw)
|
150
149
|
|
151
150
|
icon = wx.Icon()
|
152
|
-
|
153
|
-
|
151
|
+
|
152
|
+
icon_path = Path(__file__).parent / "apps/wolf_logo.bmp"
|
153
|
+
|
154
|
+
icon.CopyFromBitmap(wx.Bitmap(str(icon_path), wx.BITMAP_TYPE_ANY))
|
154
155
|
|
155
156
|
self.setup_mapviewer(title = 'Wolf - main data manager', wolfparent=self)
|
156
157
|
|
157
|
-
|
158
|
+
try:
|
159
|
+
self.mylogs.GetFrame().SetIcon(icon)
|
160
|
+
except:
|
161
|
+
logging.error("No icon for the log window")
|
162
|
+
|
163
|
+
try:
|
164
|
+
self.mapviewer.mytooltip.SetIcon(icon)
|
165
|
+
except:
|
166
|
+
logging.error("No icon for the tooltip window")
|
167
|
+
|
168
|
+
try:
|
169
|
+
self.mapviewer.SetIcon(icon)
|
170
|
+
except:
|
171
|
+
logging.error("No icon for the mapviewer window")
|
172
|
+
|
173
|
+
# dir_hydro = join(getcwd(),'data\\hydrometry')
|
174
|
+
dir_hydro = Path(__file__).parent / "data/hydrometry"
|
158
175
|
if not exists(dir_hydro):
|
159
176
|
makedirs(dir_hydro, exist_ok=True)
|
160
177
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
178
|
+
try:
|
179
|
+
self.SPWhydrometry = hydrometry_wolfgui(dir=dir_hydro, idx = 'SPW hydrometry', mapviewer=self.mapviewer, parent = self, plotted=False)
|
180
|
+
self.picc = Picc_data(data_dir=Path(r'data/PICC'), mapviewer=self.mapviewer)
|
181
|
+
self.cadaster = Cadaster_data(data_dir=Path(r'data/Cadaster'), mapviewer=self.mapviewer)
|
182
|
+
self.landmaps = PlansTerrier(mapviewer=self.mapviewer, parent = self, idx='LandMaps', plotted=True)
|
183
|
+
|
184
|
+
self.mapviewer.add_object(which='other',
|
185
|
+
newobj=self.SPWhydrometry,
|
186
|
+
ToCheck=False,
|
187
|
+
id='SPW hydrometry')
|
188
|
+
|
189
|
+
self.mapviewer.add_object(which='other',
|
190
|
+
newobj=self.picc,
|
191
|
+
ToCheck=False,
|
192
|
+
id='PICC data')
|
193
|
+
|
194
|
+
self.mapviewer.add_object(which='other',
|
195
|
+
newobj=self.cadaster,
|
196
|
+
ToCheck=False,
|
197
|
+
id='Cadaster data')
|
198
|
+
|
199
|
+
self.mapviewer.add_object(which='other',
|
200
|
+
newobj=self.landmaps,
|
201
|
+
ToCheck=False,
|
202
|
+
id='Land maps')
|
203
|
+
except:
|
204
|
+
logging.error("Can't load some data (hydrometry, picc, cadaster, landmaps) -- Please check the data directories and/or report the issue")
|
166
205
|
|
167
|
-
self.mapviewer.
|
168
|
-
newobj=self.SPWhydrometry,
|
169
|
-
ToCheck=False,
|
170
|
-
id='SPW hydrometry')
|
171
|
-
|
172
|
-
self.mapviewer.add_object(which='other',
|
173
|
-
newobj=self.picc,
|
174
|
-
ToCheck=False,
|
175
|
-
id='PICC data')
|
176
|
-
|
177
|
-
self.mapviewer.add_object(which='other',
|
178
|
-
newobj=self.cadaster,
|
179
|
-
ToCheck=False,
|
180
|
-
id='Cadaster data')
|
181
|
-
|
182
|
-
self.mapviewer.add_object(which='other',
|
183
|
-
newobj=self.landmaps,
|
184
|
-
ToCheck=False,
|
185
|
-
id='Land maps')
|
206
|
+
self.mapviewer.menu_walous()
|
186
207
|
|
187
208
|
class GPU2DModel(GenMapManager):
|
188
209
|
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -1489,6 +1489,41 @@ class vector:
|
|
1489
1489
|
self.xmax=max(vert.x for vert in self.myvertices)
|
1490
1490
|
self.ymax=max(vert.y for vert in self.myvertices)
|
1491
1491
|
|
1492
|
+
@property
|
1493
|
+
def has_interior(self):
|
1494
|
+
""" Return True if the vector has an interior """
|
1495
|
+
|
1496
|
+
not_in_use = [curvert for curvert in self.myvertices if not curvert.in_use]
|
1497
|
+
|
1498
|
+
return len(not_in_use) > 0
|
1499
|
+
|
1500
|
+
def get_subpolygons(self):
|
1501
|
+
"""
|
1502
|
+
Return a list of polygons from the vector
|
1503
|
+
|
1504
|
+
If the vector has no interior, the list contains the whole vector as a polygon
|
1505
|
+
"""
|
1506
|
+
|
1507
|
+
if self.has_interior:
|
1508
|
+
not_in_use = [curvert for curvert in self.myvertices if not curvert.in_use]
|
1509
|
+
|
1510
|
+
alls = []
|
1511
|
+
new_poly = []
|
1512
|
+
for curvert in self.myvertices:
|
1513
|
+
if curvert in not_in_use:
|
1514
|
+
alls.append(new_poly)
|
1515
|
+
new_poly = []
|
1516
|
+
new_poly.append(curvert)
|
1517
|
+
else:
|
1518
|
+
new_poly.append(curvert)
|
1519
|
+
|
1520
|
+
if self.myprop.closed and (self.myvertices[0].x != self.myvertices[-1].x or self.myvertices[0].y != self.myvertices[-1].y):
|
1521
|
+
alls[0].append(self.myvertices[0])
|
1522
|
+
|
1523
|
+
return alls
|
1524
|
+
else:
|
1525
|
+
return [self.myvertices]
|
1526
|
+
|
1492
1527
|
def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
1493
1528
|
"""
|
1494
1529
|
Plot OpenGL
|
@@ -1512,24 +1547,24 @@ class vector:
|
|
1512
1547
|
glLineWidth(float(self.myprop.width))
|
1513
1548
|
#glPointSize(float(self.myprop.width))
|
1514
1549
|
|
1515
|
-
if self.myprop.filled:
|
1516
|
-
glBegin(GL_POLYGON)
|
1517
|
-
else:
|
1518
|
-
glBegin(GL_LINE_STRIP)
|
1519
|
-
|
1520
1550
|
if self.myprop.transparent:
|
1521
1551
|
glColor4ub(int(rgb[0]),int(rgb[1]),int(rgb[2]),int(self.myprop.alpha))
|
1522
1552
|
else:
|
1523
1553
|
glColor3ub(int(rgb[0]),int(rgb[1]),int(rgb[2]))
|
1524
1554
|
|
1525
|
-
|
1526
|
-
glVertex2d(curvertex.x, curvertex.y)
|
1555
|
+
all_polys = self.get_subpolygons()
|
1527
1556
|
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1557
|
+
for curpoly in all_polys:
|
1558
|
+
|
1559
|
+
if self.myprop.filled:
|
1560
|
+
glBegin(GL_POLYGON)
|
1561
|
+
else:
|
1562
|
+
glBegin(GL_LINE_STRIP)
|
1563
|
+
|
1564
|
+
for curvertex in curpoly:
|
1565
|
+
glVertex2d(curvertex.x, curvertex.y)
|
1531
1566
|
|
1532
|
-
|
1567
|
+
glEnd()
|
1533
1568
|
|
1534
1569
|
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE)
|
1535
1570
|
glDisable(GL_BLEND)
|
@@ -1609,6 +1644,8 @@ class vector:
|
|
1609
1644
|
if self.mytree is not None:
|
1610
1645
|
self.mytree.UncheckItem(self.myitem)
|
1611
1646
|
|
1647
|
+
self.parentzone.reset_listogl()
|
1648
|
+
|
1612
1649
|
def use(self):
|
1613
1650
|
"""
|
1614
1651
|
L'objet n'est plus à utiliser
|
@@ -1617,6 +1654,9 @@ class vector:
|
|
1617
1654
|
if self.mytree is not None:
|
1618
1655
|
self.mytree.CheckItem(self.myitem)
|
1619
1656
|
|
1657
|
+
|
1658
|
+
self.parentzone.reset_listogl()
|
1659
|
+
|
1620
1660
|
def fillgrid(self,gridto:CpGrid):
|
1621
1661
|
"""
|
1622
1662
|
Remplissage d'un CpGrid
|
@@ -2571,6 +2611,8 @@ class zone:
|
|
2571
2611
|
if self.mytree is not None:
|
2572
2612
|
self.mytree.UncheckItem(self.myitem)
|
2573
2613
|
|
2614
|
+
self.reset_listogl()
|
2615
|
+
|
2574
2616
|
def use(self):
|
2575
2617
|
"""
|
2576
2618
|
A utiliser
|
@@ -2582,6 +2624,8 @@ class zone:
|
|
2582
2624
|
if self.mytree is not None:
|
2583
2625
|
self.mytree.CheckItem(self.myitem)
|
2584
2626
|
|
2627
|
+
self.reset_listogl()
|
2628
|
+
|
2585
2629
|
def asshapely_ls(self):
|
2586
2630
|
"""
|
2587
2631
|
Retroune la zone comme MultiLineString Shaely
|
wolfhece/Results2DGPU.py
CHANGED
@@ -162,13 +162,32 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
162
162
|
# is available to class's users.
|
163
163
|
|
164
164
|
|
165
|
+
self._result_store = None
|
166
|
+
self.setup_store(store)
|
167
|
+
# if store is None:
|
168
|
+
# if (Path(fname) / "simul_gpu_results/nb_results.txt").exists():
|
169
|
+
# self._result_store = ResultsStore(sim_path = Path(fname), mode='r')
|
170
|
+
# else:
|
171
|
+
# logging.warning(_("No results find in the directory, please check the path to the results directory (simul_gpu_results)"))
|
172
|
+
# else:
|
173
|
+
# self._result_store = store
|
174
|
+
|
175
|
+
self._cache = None
|
176
|
+
|
177
|
+
def setup_store(self, store = None):
|
178
|
+
"""
|
179
|
+
Setup results store
|
180
|
+
"""
|
181
|
+
|
165
182
|
if store is None:
|
166
|
-
self._result_store
|
183
|
+
if self._result_store is None:
|
184
|
+
if (Path(self.filename) / "nb_results.txt").exists():
|
185
|
+
self._result_store = ResultsStore(sim_path = Path(self.filename), mode='r')
|
186
|
+
else:
|
187
|
+
logging.warning(_("No results find in the directory, please check the path to the results directory (simul_gpu_results)"))
|
167
188
|
else:
|
168
189
|
self._result_store = store
|
169
190
|
|
170
|
-
self._cache = None
|
171
|
-
|
172
191
|
def setup_cache(self, start_idx:int=0, end_idx:int = -1, only_h:bool = False):
|
173
192
|
"""
|
174
193
|
Setup cache from start_idx result to end_idx result
|
@@ -322,6 +341,12 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
322
341
|
|
323
342
|
Lecture du fichier de tracking afin de permettre une mise à jour en cours de calcul
|
324
343
|
"""
|
344
|
+
if self._result_store is None:
|
345
|
+
self.setup_store()
|
346
|
+
if self._result_store is None:
|
347
|
+
logging.warning(_("No results store available"))
|
348
|
+
return
|
349
|
+
|
325
350
|
self._result_store.reload()
|
326
351
|
if force_update_timessteps:
|
327
352
|
self.get_times_steps()
|
@@ -395,6 +420,13 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
395
420
|
:param nb : nombre de résultats à lire
|
396
421
|
|
397
422
|
"""
|
423
|
+
|
424
|
+
if self._result_store is None:
|
425
|
+
self.setup_store()
|
426
|
+
if self._result_store is None:
|
427
|
+
logging.warning(_("No results store available"))
|
428
|
+
return
|
429
|
+
|
398
430
|
self.times = [time[ResultType.T.value] for time in self._result_store._sim_times]
|
399
431
|
self.timesteps = [time[ResultType.STEP_NUM.value] for time in self._result_store._sim_times]
|
400
432
|
|
wolfhece/apps/splashscreen.py
CHANGED
@@ -25,7 +25,7 @@ class WolfLauncher(SplashScreen):
|
|
25
25
|
mask = wx.Mask(mybitmap, wx.Colour(255,0,204))
|
26
26
|
mybitmap.SetMask(mask)
|
27
27
|
splash = SPLASH_CENTRE_ON_SCREEN | SPLASH_TIMEOUT
|
28
|
-
duration =
|
28
|
+
duration = 1000 # milliseconds
|
29
29
|
|
30
30
|
# Call the constructor with the above arguments
|
31
31
|
# in exactly the following order.
|
wolfhece/apps/version.py
CHANGED
@@ -30,7 +30,7 @@ from ..PyHydrographs import Hydrograph
|
|
30
30
|
from .update_void import Update_Sim
|
31
31
|
from ..Results2DGPU import wolfres2DGPU
|
32
32
|
from ..PyParams import Wolf_Param
|
33
|
-
from ..PyVertexvectors import Zones, zone, vector, wolfvertex
|
33
|
+
from ..PyVertexvectors import Zones, zone, vector, wolfvertex, getIfromRGB, getRGBfromI
|
34
34
|
|
35
35
|
# WOLFGPU
|
36
36
|
try:
|
@@ -621,10 +621,40 @@ class Config_Manager_2D_GPU:
|
|
621
621
|
|
622
622
|
return tif_list
|
623
623
|
|
624
|
+
def check_nodata(self, from_path:Path):
|
625
|
+
""" Check nodata in a path """
|
626
|
+
|
627
|
+
curtree = self.get_tree(from_path)
|
628
|
+
curdicts = self.get_dicts(curtree)
|
629
|
+
|
630
|
+
# tous les fichiers tif -> list of lists
|
631
|
+
all_tif_bath = [self._select_tif_partname(curdict, 'bath') for curdict in curdicts]
|
632
|
+
all_tif_mann = [self._select_tif_partname(curdict, 'mann') for curdict in curdicts]
|
633
|
+
all_tif_infil = [self._select_tif_partname(curdict, 'infil') for curdict in curdicts]
|
634
|
+
|
635
|
+
# flatten list of lists
|
636
|
+
all_tif_bath = [curel for curlist in all_tif_bath if len(curlist)>0 for curel in curlist]
|
637
|
+
all_tif_mann = [curel for curlist in all_tif_mann if len(curlist)>0 for curel in curlist]
|
638
|
+
all_tif_infil = [curel for curlist in all_tif_infil if len(curlist)>0 for curel in curlist]
|
639
|
+
|
640
|
+
for cur_lst in [all_tif_bath, all_tif_mann, all_tif_infil]:
|
641
|
+
for cur_tif in cur_lst:
|
642
|
+
curarray:WolfArray = WolfArray(cur_tif)
|
643
|
+
if curarray.nullvalue != 99999.:
|
644
|
+
curarray.nullvalue = 99999.
|
645
|
+
curarray.set_nullvalue_in_mask()
|
646
|
+
curarray.write_all()
|
647
|
+
logging.warning(_('Bad nodata value for {} !'.format(cur_tif.name)))
|
648
|
+
|
624
649
|
|
625
650
|
def create_vrt(self, from_path:Path):
|
626
651
|
""" Create a vrt file from a path """
|
627
652
|
|
653
|
+
logging.info(_('Checking virtual files...'))
|
654
|
+
|
655
|
+
logging.info(_('Checking nodata values...'))
|
656
|
+
self.check_nodata(from_path)
|
657
|
+
|
628
658
|
curtree = self.get_tree(from_path)
|
629
659
|
curdicts = self.get_dicts(curtree)
|
630
660
|
|
@@ -658,20 +688,47 @@ class Config_Manager_2D_GPU:
|
|
658
688
|
all_tif = [self._select_tif_partname(curdict, which) for curdict in curdicts]
|
659
689
|
|
660
690
|
# création du fichier vect
|
661
|
-
new_zones = Zones(idx = from_path.name)
|
691
|
+
new_zones = Zones(idx = from_path.name, parent=self)
|
662
692
|
|
663
693
|
for cur_list in all_tif:
|
664
694
|
if len(cur_list)>0:
|
695
|
+
|
696
|
+
logging.info(_('Treating {} files...'.format(len(cur_list))))
|
697
|
+
|
665
698
|
for curtif in cur_list:
|
699
|
+
|
700
|
+
logging.info(_('Start : {} file...'.format(curtif.name)))
|
701
|
+
|
666
702
|
new_zone = zone(name = curtif.name, parent = new_zones)
|
667
703
|
new_zones.add_zone(new_zone)
|
668
704
|
|
669
705
|
curarray = WolfArray(curtif)
|
670
706
|
sux, sux, curvect, interior = curarray.suxsuy_contour()
|
671
707
|
new_zone.add_vector(curvect, forceparent=True)
|
672
|
-
curvect.
|
708
|
+
curvect.set_legend_to_centroid(curtif.name)
|
709
|
+
curvect.myprop.color = getIfromRGB((0, 0, 255))
|
710
|
+
curvect.myprop.width = 3
|
711
|
+
|
712
|
+
bounds = curarray.get_bounds()
|
713
|
+
bounds_vec = vector(name='bounds')
|
714
|
+
|
715
|
+
bounds_vec.add_vertex(wolfvertex(bounds[0][0], bounds[1][0]))
|
716
|
+
bounds_vec.add_vertex(wolfvertex(bounds[0][1], bounds[1][0]))
|
717
|
+
bounds_vec.add_vertex(wolfvertex(bounds[0][1], bounds[1][1]))
|
718
|
+
bounds_vec.add_vertex(wolfvertex(bounds[0][0], bounds[1][1]))
|
719
|
+
bounds_vec.close_force()
|
720
|
+
|
721
|
+
bounds_vec.myprop.color = getIfromRGB((255, 0, 0))
|
722
|
+
bounds_vec.myprop.width = 3
|
723
|
+
|
724
|
+
new_zone.add_vector(bounds_vec, forceparent=True)
|
725
|
+
|
726
|
+
logging.info(_('End : {} file...'.format(curtif.name)))
|
727
|
+
|
728
|
+
new_zones.find_minmax(update=True)
|
729
|
+
new_zones.saveas(str(from_path / (which +'_assembly.vecz')))
|
673
730
|
|
674
|
-
|
731
|
+
logging.info(_(f'End of {which}_assembly.vecz creation !'))
|
675
732
|
|
676
733
|
return new_zones
|
677
734
|
|
@@ -1049,6 +1106,10 @@ class Config_Manager_2D_GPU:
|
|
1049
1106
|
# Execute the batch file in a separate process
|
1050
1107
|
subprocess.Popen(str(batch), shell=True)
|
1051
1108
|
|
1109
|
+
def get_mapviewer(self):
|
1110
|
+
""" Get the mapviewer object """
|
1111
|
+
|
1112
|
+
return self.mapviewer
|
1052
1113
|
|
1053
1114
|
|
1054
1115
|
class UI_Manager_2D_GPU():
|
@@ -1154,9 +1215,9 @@ class UI_Manager_2D_GPU():
|
|
1154
1215
|
self._translate_vrt.Bind(wx.EVT_BUTTON,self.ontranslatevrt2tif)
|
1155
1216
|
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'))
|
1156
1217
|
|
1157
|
-
self._create_vec = wx.Button(self._frame,label = _('
|
1218
|
+
self._create_vec = wx.Button(self._frame,label = _('Search spatial coverage from current level'))
|
1158
1219
|
self._create_vec.Bind(wx.EVT_BUTTON,self.oncreatevec)
|
1159
|
-
self._create_vec.SetToolTip(_('Create a .
|
1220
|
+
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"'))
|
1160
1221
|
|
1161
1222
|
self.checkconsistency = wx.Button(self._frame,label = _('Check consistency'))
|
1162
1223
|
self.checkconsistency.Bind(wx.EVT_BUTTON,self.oncheck_consistency)
|
@@ -1321,7 +1382,18 @@ class UI_Manager_2D_GPU():
|
|
1321
1382
|
mydata = self._treelist.GetItemData(self._selected_item)
|
1322
1383
|
|
1323
1384
|
# création du fichier vrt
|
1324
|
-
self._parent.create_vec(mydata['path'])
|
1385
|
+
new_zones = self._parent.create_vec(mydata['path'])
|
1386
|
+
|
1387
|
+
dlg = wx.MessageDialog(None, _('Do you want to add the new zones to the map ?'), _('Warning'), wx.YES_NO)
|
1388
|
+
ret = dlg.ShowModal()
|
1389
|
+
|
1390
|
+
if ret == wx.ID_YES:
|
1391
|
+
|
1392
|
+
new_zones.set_mapviewer()
|
1393
|
+
|
1394
|
+
self._parent.mapviewer.add_object('vector', newobj = new_zones, id=mydata['path'].name)
|
1395
|
+
|
1396
|
+
dlg.Destroy()
|
1325
1397
|
|
1326
1398
|
def ontranslatevrt2tif(self,e:wx.MouseEvent):
|
1327
1399
|
""" Traduction d'un fichier vrt en tif """
|
wolfhece/wolf_array.py
CHANGED
@@ -2041,6 +2041,14 @@ class Ops_Array(wx.Frame):
|
|
2041
2041
|
pass
|
2042
2042
|
self.parentarray.filter_zone()
|
2043
2043
|
|
2044
|
+
dlg = wx.MessageDialog(None, _('Do you want to set null value in the masked data ?'), _('Masked data'), wx.YES_NO | wx.ICON_QUESTION)
|
2045
|
+
ret = dlg.ShowModal()
|
2046
|
+
|
2047
|
+
if ret == wx.ID_YES:
|
2048
|
+
self.parentarray.set_nullvalue_in_mask()
|
2049
|
+
|
2050
|
+
dlg.Destroy()
|
2051
|
+
|
2044
2052
|
def OnLabelling(self, event:wx.MouseEvent):
|
2045
2053
|
""" Labelling of contiguous zones """
|
2046
2054
|
|
@@ -4351,6 +4359,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4351
4359
|
labeled_array, num_features = label(labeled_array)
|
4352
4360
|
# convertion en masked array
|
4353
4361
|
labeled_array = ma.asarray(labeled_array)
|
4362
|
+
labeled_array.mask = np.zeros(labeled_array.shape, dtype=bool)
|
4354
4363
|
# application du masque
|
4355
4364
|
labeled_array.mask[:,:] = self.array.mask[:,:]
|
4356
4365
|
|
@@ -7105,30 +7114,45 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7105
7114
|
translx += self.translx
|
7106
7115
|
transly += self.transly
|
7107
7116
|
|
7108
|
-
for i in range(self.nbx-1):
|
7109
|
-
|
7110
|
-
|
7111
|
-
|
7112
|
-
|
7117
|
+
# for i in range(self.nbx-1):
|
7118
|
+
# for j in range(self.nby-1):
|
7119
|
+
# x1 = float(i+1) * dx + translx
|
7120
|
+
# y1 = float(j+1) * dy + transly
|
7121
|
+
# if self.array.mask[i, j] ^ self.array.mask[i + 1, j]: # ^ == xor
|
7122
|
+
|
7123
|
+
# # There's a vertical border between the cells (i,j) and
|
7124
|
+
# # (i+1,j).
|
7125
|
+
|
7126
|
+
# # Remember vertical borders are (by convention) located
|
7127
|
+
# # on the left side of a cell.
|
7128
|
+
# # Moreover, (i,j) are counted in numpy coordinates
|
7129
|
+
# # (0-based) but the saved files follow Fortran convention
|
7130
|
+
# # (1-based), so we add +1 to both i,j before storing.
|
7131
|
+
|
7132
|
+
# indicesX.append([i+2, j+1]) # +2, +1 pour être en accord avec le standard de numérotation Fortran
|
7133
|
+
# locls.append(LineString([[x1,y1-dy],[x1,y1]]))
|
7113
7134
|
|
7114
|
-
|
7115
|
-
|
7135
|
+
# if self.array.mask[i, j] ^ self.array.mask[i, j +1]:
|
7136
|
+
# # See vertical border's explanation above (and replace
|
7137
|
+
# # with horizontal).
|
7116
7138
|
|
7117
|
-
|
7118
|
-
|
7119
|
-
# Moreover, (i,j) are counted in numpy coordinates
|
7120
|
-
# (0-based) but the saved files follow Fortran convention
|
7121
|
-
# (1-based), so we add +1 to both i,j before storing.
|
7139
|
+
# indicesY.append([i+1,j+2]) # +1, +2 pour être en accord avec le standard de numérotation Fortran
|
7140
|
+
# locls.append(LineString([[x1-dx,y1],[x1,y1]]))
|
7122
7141
|
|
7123
|
-
|
7124
|
-
|
7142
|
+
horiz = np.where(self.array.mask[0:self.nbx-1,0:self.nby-1] ^ self.array.mask[1:self.nbx,0:self.nby-1])
|
7143
|
+
vert = np.where(self.array.mask[0:self.nbx-1,0:self.nby-1] ^ self.array.mask[0:self.nbx-1,1:self.nby])
|
7125
7144
|
|
7126
|
-
|
7127
|
-
|
7128
|
-
|
7145
|
+
for i,j in zip(horiz[0],horiz[1]):
|
7146
|
+
x1 = float(i+1) * dx + translx
|
7147
|
+
y1 = float(j+1) * dy + transly
|
7148
|
+
indicesX.append([i+2, j+1])
|
7149
|
+
locls.append(LineString([[x1,y1-dy],[x1,y1]]))
|
7129
7150
|
|
7130
|
-
|
7131
|
-
|
7151
|
+
for i,j in zip(vert[0],vert[1]):
|
7152
|
+
x1 = float(i+1) * dx + translx
|
7153
|
+
y1 = float(j+1) * dy + transly
|
7154
|
+
indicesY.append([i+1, j+2])
|
7155
|
+
locls.append(LineString([[x1-dx,y1],[x1,y1]]))
|
7132
7156
|
|
7133
7157
|
if not locls:
|
7134
7158
|
raise Exception(_("I can't detect any contour. Is this right ?"))
|
@@ -7172,7 +7196,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
7172
7196
|
contourgen = vector(name='external border')
|
7173
7197
|
for x,y,z in xy:
|
7174
7198
|
contourgen.add_vertex(wolfvertex(x,y,z))
|
7175
|
-
contourgen.myvertices[-1].in_use = z
|
7199
|
+
contourgen.myvertices[-1].in_use = z == 0. # the new vertex is related to a connection segment --> ignore for numerical precision in intersection operations/calculations
|
7176
7200
|
else:
|
7177
7201
|
contourgen = None
|
7178
7202
|
err = _(f"Unsupported Shapely contour result: {contour.geom_type}")
|
wolfhece/wolf_vrt.py
CHANGED
@@ -107,6 +107,8 @@ def create_vrt_from_files_first_based(files:list[Path]=[], fout:Path='assembly.v
|
|
107
107
|
ymin = geotr[3]+geotr[5]*float(nby)
|
108
108
|
ymax = geotr[3]
|
109
109
|
|
110
|
+
locNoData = raster.GetRasterBand(1).GetNoDataValue()
|
111
|
+
|
110
112
|
options = gdal.BuildVRTOptions(resolution='user',
|
111
113
|
xRes=abs(geotr[1]),
|
112
114
|
yRes=abs(geotr[5]),
|
@@ -6,8 +6,8 @@ wolfhece/ManageParams.py,sha256=Wgt5Zh7QBtyiwTAltPHunSLqt4XuVuRH76GTUrXabS4,219
|
|
6
6
|
wolfhece/Model1D.py,sha256=-cMz-ePSYzrKVVDidiDOz6cojEZ3y6u9gIb7RPwT6Y8,476593
|
7
7
|
wolfhece/PyConfig.py,sha256=oGSL1WsLM9uinlNP4zGBLK3uHPmBfduUi7R-VtWuRFA,8034
|
8
8
|
wolfhece/PyCrosssections.py,sha256=f4dNYRUGZKePruaaBiTcn5vlrw8TFTj9XwTDrdiF_uU,112450
|
9
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
-
wolfhece/PyGui.py,sha256=
|
9
|
+
wolfhece/PyDraw.py,sha256=WJDGhaD7N6udY5WUynS9f-26FQ6Uj0bJZFM2gxkzuWU,378354
|
10
|
+
wolfhece/PyGui.py,sha256=VKE785z9XLIWNbxqpyEceLK_wtmPJyq6A_M_qX_94Lg,104772
|
11
11
|
wolfhece/PyGuiHydrology.py,sha256=wKhR-KthPRyzJ887NmsozmUpm2CIQIwO3IbYORCYjrE,7290
|
12
12
|
wolfhece/PyHydrographs.py,sha256=GKK8U0byI45H9O_e4LAOOi7Aw0Tg7Q0Lx322stPg5IQ,3453
|
13
13
|
wolfhece/PyPalette.py,sha256=_Nm2Lc4UxYlZgK8ifZDioG8a0at8oiteYC0x_4XugFc,24384
|
@@ -15,13 +15,13 @@ wolfhece/PyParams.py,sha256=361iy9b9zTjoPCj9gh8-OIo0TBW5laLG87AkWE6f_eg,96290
|
|
15
15
|
wolfhece/PyPictures.py,sha256=-mJB0JL2YYiEK3D7_ssDkvYiMWK4ve9kXhozQXNeSx8,2216
|
16
16
|
wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
|
17
17
|
wolfhece/PyVertex.py,sha256=dHTjyYYTn0F_NWerlAOBKHV79RUzEEtMJMldQtVc1Cs,40092
|
18
|
-
wolfhece/PyVertexvectors.py,sha256=
|
18
|
+
wolfhece/PyVertexvectors.py,sha256=fp5iCndmybEJij-n_SUrv-Q_Zm3RYn2BwYvPiZuCUwk,223514
|
19
19
|
wolfhece/PyWMS.py,sha256=t6jVZpTxTNSLJxABk8A79cEMWTKoRM_S_SXRipsHLzw,4493
|
20
20
|
wolfhece/RatingCurve.py,sha256=YSQvSvdMHE6hSlWVBF5Oe0-Fh3waNMpOdmcymaCCTis,21706
|
21
21
|
wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
|
22
22
|
wolfhece/RatingCurve_xml.py,sha256=vbLxSWwHPsCAsR13KaG5WVmVn_cha7-6cF4zj7Diiz8,33593
|
23
23
|
wolfhece/ReadDataDCENN.py,sha256=4OMDBgkZ_v7OWmVhyQ-reab7MPxGhFEDY2qS8yThhdM,1240
|
24
|
-
wolfhece/Results2DGPU.py,sha256=
|
24
|
+
wolfhece/Results2DGPU.py,sha256=kUgLZhUbqVVl-LNQX_GghmU70b0IQHoye3bpAy3hPno,20238
|
25
25
|
wolfhece/__init__.py,sha256=FRDE8PiJAWxX9PMXsShRMZ8YADAY4WIgKMRh52rmhiw,23
|
26
26
|
wolfhece/_add_path.py,sha256=nudniS-lsgHwXXq5o626XRDzIeYj76GoGKYt6lcu2Nc,616
|
27
27
|
wolfhece/cli.py,sha256=rHxZGgs_R776VCWhs36pYFoiuiQycwgGTVOLK-JNzjE,1937
|
@@ -48,11 +48,11 @@ wolfhece/rain_SPWMI.py,sha256=YqsF-yFro3y_a6MfVRFfr-Rxi7NR1gl_i8VX7scmzes,13548
|
|
48
48
|
wolfhece/test_Results2DGPU.py,sha256=NOJ_hFXrcLSQXS1dtsqXRQltqIZtDSHMz_EgAJ2_FHU,307
|
49
49
|
wolfhece/textpillow.py,sha256=zEfLrKhfCDyMaVuQOUjHqz6MGKeQ4aewMxOsWi5-wKI,13832
|
50
50
|
wolfhece/tools_mpl.py,sha256=q8Yc4aukPPiUcEzREvZRM_em67XqXaahdoaNt0DETfE,266
|
51
|
-
wolfhece/wolf_array.py,sha256=
|
51
|
+
wolfhece/wolf_array.py,sha256=003bWiCVDjfkCGEDp1ZRZd4xVtufYuGiAK7sC9VJycY,330960
|
52
52
|
wolfhece/wolf_hist.py,sha256=JpRXvzJLUP-RkSkvth3DQWglgTMFI2ZEUDb4RYOfeeI,3284
|
53
53
|
wolfhece/wolf_texture.py,sha256=llQ7aV8scWXIkhpri9XjaPejzoBJsGfsln2ZnlRbFkU,16270
|
54
54
|
wolfhece/wolf_tiles.py,sha256=F2JsJHdAP8fIffNJdG_J26bonCIRtIwMmxKFqdSCRDA,10088
|
55
|
-
wolfhece/wolf_vrt.py,sha256=
|
55
|
+
wolfhece/wolf_vrt.py,sha256=un5CKzAUmzSsjLXK7YLnQEWz8FLoafXJs8oqUvS_-h0,10271
|
56
56
|
wolfhece/wolf_zi_db.py,sha256=Ok0MxQYZMMLRJN1QY-HSplLhUzzb6gkXgBQ3ihhLQHk,12669
|
57
57
|
wolfhece/wolfresults_2D.py,sha256=1OhARaLhP8-8mQfq5hrvt-9D-2eSRdJz7SYfaqSkvXg,159021
|
58
58
|
wolfhece/xyz_file.py,sha256=aQOcTHkHRhXHxL_WxTHwzygp6e47San7SHSpxKQU0dw,5457
|
@@ -65,8 +65,8 @@ wolfhece/apps/__init__.py,sha256=OzzKItATWV0mDkz_LC2L3w5sgT2rt8ExXXCbR_FwvlY,24
|
|
65
65
|
wolfhece/apps/check_install.py,sha256=jrKR-njqnpIh6ZJqvP6KbDUPVCfwTNQj4glQhcyzs9o,630
|
66
66
|
wolfhece/apps/curvedigitizer.py,sha256=avWERHuVxPnJBOD_ibczwW_XG4vAenqWS8W1zjhBox8,4898
|
67
67
|
wolfhece/apps/isocurrent.py,sha256=4XnNWPa8mYUK7V4zdDRFrHFIXNG2AN2og3TqWKKcqjY,3811
|
68
|
-
wolfhece/apps/splashscreen.py,sha256=
|
69
|
-
wolfhece/apps/version.py,sha256=
|
68
|
+
wolfhece/apps/splashscreen.py,sha256=LkEVMK0eCc84NeCWD3CGja7fuQ_k1PrZdyqD3GQk_8c,2118
|
69
|
+
wolfhece/apps/version.py,sha256=e4viWx1A5GTOG7x_ee5ipUIoVs03YPj1mmqIboCFecM,387
|
70
70
|
wolfhece/apps/wolf.py,sha256=gqfm-ZaUJqNsfCzmdtemSeqLw-GVdSVix-evg5WArJI,293
|
71
71
|
wolfhece/apps/wolf2D.py,sha256=gWD9ee2-1pw_nUxjgRaJMuSe4kUT-RWhOeoTt_Lh1mM,267
|
72
72
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -243,7 +243,7 @@ wolfhece/rem/RasterViz.py,sha256=TDhWyMppcYBL71HfhpZuMgYKhz7faZg-MEOQJo_3Ivo,291
|
|
243
243
|
wolfhece/rem/__init__.py,sha256=S2-J5uEGK_VaMFjRUYFIdSScJjZyuXH4RmMmnG3OG7I,19
|
244
244
|
wolfhece/scenario/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
245
245
|
wolfhece/scenario/check_scenario.py,sha256=nFiCscEGHyz1YvjmZoKlYrfmW03-nLiDTDdRoeE6MUs,4619
|
246
|
-
wolfhece/scenario/config_manager.py,sha256=
|
246
|
+
wolfhece/scenario/config_manager.py,sha256=SValpikuNt_XaJXt8P7kAu6iN_N5YlohyL8ry3iT380,77389
|
247
247
|
wolfhece/scenario/imposebc_void.py,sha256=pl7c99HQQMQT7i15fDlOOFYCdOtR5c_XIBOveOTOaLc,5273
|
248
248
|
wolfhece/scenario/update_void.py,sha256=MmiDiwWHvuk0mpXOlMeB2ImY-d1Wi3Wfmg9hrDTAraE,7176
|
249
249
|
wolfhece/shaders/fragment_shader_texture.glsl,sha256=w6h8d5mJqFaGbao0LGmjRcFFdcEQ3ICIl9JpuT71K5k,177
|
@@ -264,8 +264,8 @@ wolfhece/sounds/sonsw2.wav,sha256=pFLVt6By0_EPQNt_3KfEZ9a1uSuYTgQSX1I_Zurv9Rc,11
|
|
264
264
|
wolfhece/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
265
265
|
wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=yGbU_JsF56jsmms0gh7mxa7tbNQ_SxqhpAZxhm-mTy4,14860
|
266
266
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=wCxGRnE3kzEkWlWA6-3X8ADOFux_B0a5QWJ2GnXTgJw,4709
|
267
|
-
wolfhece-2.1.
|
268
|
-
wolfhece-2.1.
|
269
|
-
wolfhece-2.1.
|
270
|
-
wolfhece-2.1.
|
271
|
-
wolfhece-2.1.
|
267
|
+
wolfhece-2.1.6.dist-info/METADATA,sha256=cugMr7AdpxcXB9lUui3lqbla85asvy4lo-Q8-0per-Y,2281
|
268
|
+
wolfhece-2.1.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
269
|
+
wolfhece-2.1.6.dist-info/entry_points.txt,sha256=AIu1KMswrdsqNq_2jPtrRIU4tLjuTnj2dCY-pxIlshw,276
|
270
|
+
wolfhece-2.1.6.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
271
|
+
wolfhece-2.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|