wolfhece 2.0.30__py3-none-any.whl → 2.0.32__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/PyCrosssections.py +3 -2
- wolfhece/PyDraw.py +36 -10
- wolfhece/PyGui.py +8 -2
- wolfhece/PyVertexvectors.py +151 -17
- wolfhece/apps/version.py +1 -1
- wolfhece/picc.py +43 -13
- wolfhece/scenario/config_manager.py +41 -5
- wolfhece/wolf_array.py +104 -30
- {wolfhece-2.0.30.dist-info → wolfhece-2.0.32.dist-info}/METADATA +1 -1
- {wolfhece-2.0.30.dist-info → wolfhece-2.0.32.dist-info}/RECORD +13 -13
- {wolfhece-2.0.30.dist-info → wolfhece-2.0.32.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.30.dist-info → wolfhece-2.0.32.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.30.dist-info → wolfhece-2.0.32.dist-info}/top_level.txt +0 -0
wolfhece/PyCrosssections.py
CHANGED
@@ -1732,6 +1732,7 @@ class crosssections(Element_To_Draw):
|
|
1732
1732
|
else:
|
1733
1733
|
self.dirlaz=''
|
1734
1734
|
self.gridlaz =None
|
1735
|
+
|
1735
1736
|
elif isinstance(dirlaz,xyz_laz_grids):
|
1736
1737
|
self.gridlaz = dirlaz
|
1737
1738
|
self.dirlaz = 'instance xyz_laz_grids'
|
@@ -1870,7 +1871,7 @@ class crosssections(Element_To_Draw):
|
|
1870
1871
|
tmpzones=myfile
|
1871
1872
|
elif isinstance(myfile, str):
|
1872
1873
|
self.filename=myfile
|
1873
|
-
tmpzones=Zones(myfile)
|
1874
|
+
tmpzones=Zones(myfile, find_minmax=False)
|
1874
1875
|
|
1875
1876
|
curzone:zone
|
1876
1877
|
curvec:vector
|
@@ -2484,7 +2485,7 @@ class crosssections(Element_To_Draw):
|
|
2484
2485
|
def find_minmax(self, update:bool=False):
|
2485
2486
|
if update:
|
2486
2487
|
for idx,vect in self.myprofiles.items():
|
2487
|
-
vect['cs'].find_minmax()
|
2488
|
+
vect['cs'].find_minmax(only_firstlast = True)
|
2488
2489
|
|
2489
2490
|
self.xmin=min(vect['cs'].xmin for idx,vect in self.myprofiles.items())
|
2490
2491
|
self.ymin=min(vect['cs'].ymin for idx,vect in self.myprofiles.items())
|
wolfhece/PyDraw.py
CHANGED
@@ -59,7 +59,7 @@ from .PyCrosssections import crosssections, profile, Interpolator, Interpolators
|
|
59
59
|
from .GraphNotebook import PlotNotebook
|
60
60
|
from .lazviewer.laz_viewer import myviewer, read_laz, clip_data_xyz, xyz_laz_grids, choices_laz_colormap, Classification_LAZ
|
61
61
|
from . import Lidar2002
|
62
|
-
from .picc import Picc_data
|
62
|
+
from .picc import Picc_data, Cadaster_data
|
63
63
|
|
64
64
|
try:
|
65
65
|
from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
|
@@ -213,6 +213,7 @@ class WolfMapViewer(wx.Frame):
|
|
213
213
|
self.menubar = wx.MenuBar()
|
214
214
|
|
215
215
|
self.menuwolf2d = None
|
216
|
+
self.menu2d_cache_setup = None
|
216
217
|
self.menuparticlesystem = None
|
217
218
|
self.menu2dGPU = None
|
218
219
|
self.timer_ps = None
|
@@ -659,9 +660,10 @@ class WolfMapViewer(wx.Frame):
|
|
659
660
|
def menu_2dgpu(self):
|
660
661
|
|
661
662
|
if self.menuwolf2d is not None:
|
662
|
-
self.menu2d_cache_setup
|
663
|
-
|
664
|
-
|
663
|
+
if self.menu2d_cache_setup is None:
|
664
|
+
self.menu2d_cache_setup = self.menuwolf2d.Append(wx.ID_ANY, _("Setup cache..."), _("Set up cache for 2D GPU model"))
|
665
|
+
self.menu2d_cache_reset = self.menuwolf2d.Append(wx.ID_ANY, _("Clear cache..."), _("Clear cache for 2D GPU model"))
|
666
|
+
self.menu2d_show_tiles = self.menuwolf2d.Append(wx.ID_ANY, _("Show tiles..."), _("Show a grid of tiles for 2D GPU model"))
|
665
667
|
|
666
668
|
|
667
669
|
def menu_particlesystem(self):
|
@@ -3182,7 +3184,7 @@ class WolfMapViewer(wx.Frame):
|
|
3182
3184
|
logging.warning(_('No active 2D result !'))
|
3183
3185
|
return
|
3184
3186
|
|
3185
|
-
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown to plot'), _('Unknown'), [_('Water depth'),
|
3187
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown to plot'), _('Unknown'), [_('Water depth'), _('Water level'), _('Head')])
|
3186
3188
|
|
3187
3189
|
ret = dlg.ShowModal()
|
3188
3190
|
if ret == wx.ID_CANCEL:
|
@@ -4106,7 +4108,7 @@ class WolfMapViewer(wx.Frame):
|
|
4106
4108
|
obj: WolfArray
|
4107
4109
|
|
4108
4110
|
if obj.filename == '':
|
4109
|
-
filterArray = "bin (*.bin)|*.bin|all (*.*)|*.*"
|
4111
|
+
filterArray = "bin (*.bin)|*.bin|Geotif (*.tif)|*.tif|Numpy (*.npy)|*.npy|all (*.*)|*.*"
|
4110
4112
|
fdlg = wx.FileDialog(self, "Choose file", wildcard=filterArray, style=wx.FD_SAVE)
|
4111
4113
|
fdlg.ShowModal()
|
4112
4114
|
if fdlg.ShowModal() == wx.ID_OK:
|
@@ -4267,7 +4269,7 @@ class WolfMapViewer(wx.Frame):
|
|
4267
4269
|
for obj in self.iterator_over_objects(draw_type.ARRAYS):
|
4268
4270
|
obj: WolfArray
|
4269
4271
|
|
4270
|
-
filterArray = "bin (*.bin)|*.bin|all (*.*)|*.*"
|
4272
|
+
filterArray = "bin (*.bin)|*.bin|Geotif (*.tif)|*.tif|Numpy (*.npy)|all (*.*)|*.*"
|
4271
4273
|
fdlg = wx.FileDialog(self, "Choose file name for Array : " + obj.idx, wildcard=filterArray,
|
4272
4274
|
style=wx.FD_SAVE)
|
4273
4275
|
ret = fdlg.ShowModal()
|
@@ -4665,6 +4667,8 @@ class WolfMapViewer(wx.Frame):
|
|
4665
4667
|
file = wx.DirDialog(self, "Choose directory containing GPU results")
|
4666
4668
|
elif which.lower() == 'bridges':
|
4667
4669
|
file = wx.DirDialog(self, "Choose directory containing bridges")
|
4670
|
+
elif which.lower() == 'weirs':
|
4671
|
+
file = wx.DirDialog(self, "Choose directory containing weirs")
|
4668
4672
|
elif which.lower() in ['vector', 'tiles', 'tilescomp']:
|
4669
4673
|
file = wx.FileDialog(self, "Choose file", wildcard=filterVector)
|
4670
4674
|
elif which.lower() == 'cloud':
|
@@ -5648,7 +5652,7 @@ class WolfMapViewer(wx.Frame):
|
|
5648
5652
|
|
5649
5653
|
if self.selected_object is not None:
|
5650
5654
|
if type(self.selected_object) is WolfArray or type(self.selected_object) is WolfArray_Sim2D:
|
5651
|
-
filterArray = "bin (*.bin)|*.bin|
|
5655
|
+
filterArray = "bin (*.bin)|*.bin|Geotif (*.tif)|*.tif|Numpy (*.npy)|*.npy|all (*.*)|*.*"
|
5652
5656
|
fdlg = wx.FileDialog(self, "Choose file name for Array : " + self.selected_object.idx, wildcard=filterArray,
|
5653
5657
|
style=wx.FD_SAVE)
|
5654
5658
|
ret = fdlg.ShowModal()
|
@@ -5689,7 +5693,7 @@ class WolfMapViewer(wx.Frame):
|
|
5689
5693
|
elif text == _('Properties'):
|
5690
5694
|
|
5691
5695
|
myobj = self.selected_object
|
5692
|
-
if type(myobj) in [WolfArray, WolfArray_Sim2D, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data]:
|
5696
|
+
if type(myobj) in [WolfArray, WolfArray_Sim2D, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data, Cadaster_data]:
|
5693
5697
|
myobj.show_properties()
|
5694
5698
|
|
5695
5699
|
elif text == _('Boundary conditions'):
|
@@ -6215,7 +6219,7 @@ class WolfMapViewer(wx.Frame):
|
|
6215
6219
|
if ctrl:
|
6216
6220
|
myobj.show_properties()
|
6217
6221
|
|
6218
|
-
elif type(myobj)
|
6222
|
+
elif type(myobj) in [Picc_data, Cadaster_data]:
|
6219
6223
|
if ctrl:
|
6220
6224
|
myobj.show_properties()
|
6221
6225
|
|
@@ -6751,6 +6755,8 @@ class WolfMapViewer(wx.Frame):
|
|
6751
6755
|
if r == wx.ID_YES:
|
6752
6756
|
self.active_vector.close_force()
|
6753
6757
|
|
6758
|
+
self.active_vector.parentzone.plot(prep = True)
|
6759
|
+
|
6754
6760
|
elif self.action == 'modify vertices':
|
6755
6761
|
|
6756
6762
|
# end of vertices modification
|
@@ -6891,8 +6897,10 @@ class WolfMapViewer(wx.Frame):
|
|
6891
6897
|
'1,2...9': _('Arrays : transfer the selection to the dictionary'),
|
6892
6898
|
'i': _('Arrays : 2D interpolation based on the selection on the current matrix'),
|
6893
6899
|
'CTRL+C': _('Arrays : Set copy source and current selection to clipboard as string'),
|
6900
|
+
'CTRL+X': _('Arrays : Crop the active array using the active vector and make a copy'),
|
6894
6901
|
'CTRL+V': _('Arrays : paste selected values'),
|
6895
6902
|
'CTRL+ALT+C or ALTGr+C': _('Arrays : Set copy source and current selection to clipboard as script'),
|
6903
|
+
'CTRL+ALT+X or ALTGr+X': _('Arrays : Crop the active array using the active vector without masking the values outside the vector'),
|
6896
6904
|
'CTRL+ALT+V or ALTGr+V': _('Arrays : paste selection to active array'),
|
6897
6905
|
|
6898
6906
|
'p or P': _('Cross sections : Pick a profile/cross section'),
|
@@ -7083,6 +7091,20 @@ class WolfMapViewer(wx.Frame):
|
|
7083
7091
|
self.active_res2d.update_zoom_2(1./1.1)
|
7084
7092
|
self.Refresh()
|
7085
7093
|
|
7094
|
+
elif key == ord('X'):
|
7095
|
+
# Create a new array from the active array and the active vector
|
7096
|
+
# Node outside the vector are set to NullValue
|
7097
|
+
if self.active_array is not None and self.active_vector is not None:
|
7098
|
+
|
7099
|
+
bbox = self.active_vector.get_bounds_xx_yy()
|
7100
|
+
newarray = self.active_array.crop_array(bbox)
|
7101
|
+
|
7102
|
+
if not altdown:
|
7103
|
+
newarray.mask_outsidepoly(self.active_vector)
|
7104
|
+
|
7105
|
+
self.add_object('array', newobj = newarray, id = self.active_array.idx + '_crop')
|
7106
|
+
|
7107
|
+
|
7086
7108
|
elif key == ord('Q'):
|
7087
7109
|
# If Ctrl-Q is hit, then we must *not* handle it
|
7088
7110
|
# because it is tied to the Ctrl-Q accelerator
|
@@ -7192,14 +7214,18 @@ class WolfMapViewer(wx.Frame):
|
|
7192
7214
|
elif len(cursel) > 0:
|
7193
7215
|
self.active_array.mngselection.myselection = cursel.copy()
|
7194
7216
|
self.active_array.mngselection.update_nb_nodes_sections()
|
7217
|
+
|
7195
7218
|
else:
|
7196
7219
|
logging.info(_('Copy selection values'))
|
7197
7220
|
if cursel == 'all':
|
7198
7221
|
self.active_array.paste_all(fromarray)
|
7222
|
+
|
7199
7223
|
elif len(cursel) > 0:
|
7200
7224
|
z = fromarray.mngselection.get_values_sel()
|
7201
7225
|
self.active_array.set_values_sel(cursel, z)
|
7202
7226
|
|
7227
|
+
self.Refresh()
|
7228
|
+
|
7203
7229
|
else:
|
7204
7230
|
if key == wx.WXK_DELETE:
|
7205
7231
|
self.removeobj()
|
wolfhece/PyGui.py
CHANGED
@@ -29,7 +29,7 @@ from .RatingCurve import SPWMIGaugingStations,SPWDCENNGaugingStations
|
|
29
29
|
from .hydrology.Catchment import Catchment
|
30
30
|
from .hydrology.forcedexchanges import forced_exchanges
|
31
31
|
from .PyParams import Wolf_Param
|
32
|
-
from .picc import Picc_data
|
32
|
+
from .picc import Picc_data, Cadaster_data
|
33
33
|
|
34
34
|
# FIXME : Is it necessary to override wx.Frame ? WolfMapManager is a wx.Frame.
|
35
35
|
# Is it sufficient to run a wx.App ?
|
@@ -152,7 +152,8 @@ class MapManager(GenMapManager):
|
|
152
152
|
makedirs(dir_hydro, exist_ok=True)
|
153
153
|
|
154
154
|
self.SPWhydrometry=hydrometry(dir=dir_hydro)
|
155
|
-
self.picc = Picc_data(data_dir=Path(r'data/PICC'))
|
155
|
+
self.picc = Picc_data(data_dir=Path(r'data/PICC'), mapviewer=self.mapviewer)
|
156
|
+
self.cadaster = Cadaster_data(data_dir=Path(r'data/Cadaster'), mapviewer=self.mapviewer)
|
156
157
|
|
157
158
|
self.mapviewer.add_object(which='other',
|
158
159
|
newobj=self.SPWhydrometry,
|
@@ -164,6 +165,11 @@ class MapManager(GenMapManager):
|
|
164
165
|
ToCheck=False,
|
165
166
|
id='PICC data')
|
166
167
|
|
168
|
+
self.mapviewer.add_object(which='other',
|
169
|
+
newobj=self.cadaster,
|
170
|
+
ToCheck=False,
|
171
|
+
id='Cadaster data')
|
172
|
+
|
167
173
|
class GPU2DModel(GenMapManager):
|
168
174
|
|
169
175
|
mydir:str
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -602,6 +602,7 @@ class vectorproperties:
|
|
602
602
|
self.parent.textimage=None
|
603
603
|
|
604
604
|
try:
|
605
|
+
self.parent.parentzone.prep_listogl()
|
605
606
|
self.parent.parentzone.parent.mapviewer.Refresh()
|
606
607
|
except:
|
607
608
|
pass
|
@@ -639,7 +640,7 @@ class vectorproperties:
|
|
639
640
|
self.myprops.addparam('Draw','Closed',False,'Logical','',whichdict='Default')
|
640
641
|
self.myprops.addparam('Draw','Filled',False,'Logical','',whichdict='Default')
|
641
642
|
self.myprops.addparam('Draw','Transparent',False,'Logical','',whichdict='Default')
|
642
|
-
self.myprops.addparam('Draw','Alpha',0,'Integer','
|
643
|
+
self.myprops.addparam('Draw','Alpha',0,'Integer','Transparency intensity (255 is opaque)',whichdict='Default')
|
643
644
|
self.myprops.addparam('Draw','Flash',False,'Logical','',whichdict='Default')
|
644
645
|
|
645
646
|
self.myprops.addparam('Legend','Visible',False,'Logical','',whichdict='Default')
|
@@ -1258,15 +1259,24 @@ class vector:
|
|
1258
1259
|
|
1259
1260
|
return self.myvertices[indexmp]
|
1260
1261
|
|
1261
|
-
def find_minmax(self):
|
1262
|
+
def find_minmax(self, only_firstlast:bool=False):
|
1262
1263
|
"""
|
1263
1264
|
Recherche l'extension spatiale du vecteur
|
1265
|
+
|
1266
|
+
:param only_firstlast: si True, on ne recherche que les coordonnées du premier et du dernier vertex
|
1264
1267
|
"""
|
1265
1268
|
if len(self.myvertices)>0:
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1269
|
+
|
1270
|
+
if only_firstlast:
|
1271
|
+
self.xmin=min(self.myvertices[0].x, self.myvertices[-1].x)
|
1272
|
+
self.ymin=min(self.myvertices[0].y, self.myvertices[-1].y)
|
1273
|
+
self.xmax=max(self.myvertices[0].x, self.myvertices[-1].x)
|
1274
|
+
self.ymax=max(self.myvertices[0].y, self.myvertices[-1].y)
|
1275
|
+
else:
|
1276
|
+
self.xmin=min(vert.x for vert in self.myvertices)
|
1277
|
+
self.ymin=min(vert.y for vert in self.myvertices)
|
1278
|
+
self.xmax=max(vert.x for vert in self.myvertices)
|
1279
|
+
self.ymax=max(vert.y for vert in self.myvertices)
|
1270
1280
|
|
1271
1281
|
def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
1272
1282
|
"""
|
@@ -1937,10 +1947,17 @@ class zone:
|
|
1937
1947
|
tmp_nbvectors=int(lines[1])
|
1938
1948
|
self.myvectors=[]
|
1939
1949
|
curstart=2
|
1950
|
+
|
1951
|
+
if tmp_nbvectors>1000:
|
1952
|
+
logging.info(_('Many vectors in zone -- {} -- Be patient !').format(tmp_nbvectors))
|
1953
|
+
|
1940
1954
|
for i in range(tmp_nbvectors):
|
1941
1955
|
curvec=vector(lines[curstart:],parentzone=self,is2D=is2D)
|
1942
1956
|
curstart+=curvec._nblines()
|
1943
1957
|
self.myvectors.append(curvec)
|
1958
|
+
if tmp_nbvectors>1000:
|
1959
|
+
if i%100==0:
|
1960
|
+
logging.info(_('{} vectors read').format(i))
|
1944
1961
|
|
1945
1962
|
if name!='' and self.myname=='':
|
1946
1963
|
self.myname=name
|
@@ -2109,13 +2126,16 @@ class zone:
|
|
2109
2126
|
|
2110
2127
|
return nb
|
2111
2128
|
|
2112
|
-
def find_minmax(self,update=False):
|
2129
|
+
def find_minmax(self, update=False, only_firstlast:bool=False):
|
2113
2130
|
"""
|
2114
2131
|
Recherche de l'emprise spatiale de toute la zone
|
2132
|
+
|
2133
|
+
:param update: True = mise à jour des valeurs ; False = utilisation des valeurs déjà calculées
|
2134
|
+
:param only_firstlast: True = recherche uniquement sur les premiers et derniers points de chaque vecteur
|
2115
2135
|
"""
|
2116
2136
|
if update:
|
2117
2137
|
for vect in self.myvectors:
|
2118
|
-
vect.find_minmax()
|
2138
|
+
vect.find_minmax(only_firstlast=only_firstlast)
|
2119
2139
|
|
2120
2140
|
if self.nbvectors==0:
|
2121
2141
|
self.xmin=-99999.
|
@@ -2140,6 +2160,12 @@ class zone:
|
|
2140
2160
|
self.ymin=minsy[0]
|
2141
2161
|
self.ymax=maxsy[0]
|
2142
2162
|
|
2163
|
+
def prep_listogl(self):
|
2164
|
+
"""
|
2165
|
+
Préparation des listes OpenGL pour augmenter la vitesse d'affichage
|
2166
|
+
"""
|
2167
|
+
self.plot(prep = True)
|
2168
|
+
|
2143
2169
|
def plot(self, prep:bool=False):
|
2144
2170
|
"""
|
2145
2171
|
Graphique OpenGL
|
@@ -3313,10 +3339,24 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3313
3339
|
plotted: bool = True,
|
3314
3340
|
mapviewer=None,
|
3315
3341
|
need_for_wx: bool = False,
|
3316
|
-
bbox:Polygon = None
|
3317
|
-
|
3318
|
-
|
3319
|
-
|
3342
|
+
bbox:Polygon = None,
|
3343
|
+
find_minmax:bool = True) -> None:
|
3344
|
+
"""
|
3345
|
+
Objet de gestion et d'affichage d'informations vectorielles
|
3346
|
+
|
3347
|
+
:param filename: nom du fichier à lire
|
3348
|
+
:param ox: origine X
|
3349
|
+
:param oy: origine Y
|
3350
|
+
:param tx: Translation selon X
|
3351
|
+
:param ty: Translation selon Y
|
3352
|
+
:param parent: objet parent -- soit une instance 'WolfMapViewer', soit une instance 'Ops_Array' --> est utile pour transférer la propriété 'active_vector' et obtenir diverses informations ou lancer des actions
|
3353
|
+
:param is2D: si True --> les vecteurs sont en 2D
|
3354
|
+
:param idx: identifiant
|
3355
|
+
:param plotted: si True --> les vecteurs sont prêts à être affichés
|
3356
|
+
:param mapviewer: instance WolfMapViewer
|
3357
|
+
:param need_for_wx: si True --> permet l'affichage de la structure via WX car une app WX existe et est en cours d'exécution
|
3358
|
+
:param bbox: bounding box
|
3359
|
+
:param find_minmax: si True --> recherche des valeurs min et max
|
3320
3360
|
|
3321
3361
|
wx_exists : si True --> permet l'affichage de la structure via WX car une app WX existe et est en cours d'exécution
|
3322
3362
|
|
@@ -3377,6 +3417,9 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3377
3417
|
elif self.filename.endswith('.shp'):
|
3378
3418
|
self.is2D=False
|
3379
3419
|
self.import_shapefile(self.filename, bbox=bbox)
|
3420
|
+
elif self.filename.endswith('.gpkg'):
|
3421
|
+
self.is2D=False
|
3422
|
+
self.import_gpkg(self.filename, bbox=bbox)
|
3380
3423
|
elif Path(filename).is_dir() and self.filename.endswith('.gdb'):
|
3381
3424
|
self.is2D=False
|
3382
3425
|
self.import_gdb(self.filename, bbox=bbox)
|
@@ -3403,7 +3446,11 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3403
3446
|
self.myzones.append(curzone)
|
3404
3447
|
curstart+=curzone._nblines()
|
3405
3448
|
|
3406
|
-
|
3449
|
+
if find_minmax:
|
3450
|
+
self.find_minmax(True)
|
3451
|
+
|
3452
|
+
if plotted:
|
3453
|
+
self.prep_listogl()
|
3407
3454
|
|
3408
3455
|
@property
|
3409
3456
|
def nbzones(self):
|
@@ -3449,6 +3496,9 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3449
3496
|
|
3450
3497
|
content = gpd.read_file(fn, bbox=bbox, layer=curlayer)
|
3451
3498
|
|
3499
|
+
if len(content)>1000:
|
3500
|
+
logging.warning(_('Layer {} contains more than 1000 elements -- it may take a while to import'.format(curlayer)))
|
3501
|
+
|
3452
3502
|
for idx, row in content.iterrows():
|
3453
3503
|
if 'NAME' in row.keys():
|
3454
3504
|
name = row['NAME']
|
@@ -3465,6 +3515,54 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3465
3515
|
newzone = zone(name=name, parent = self, fromshapely = poly)
|
3466
3516
|
self.add_zone(newzone)
|
3467
3517
|
|
3518
|
+
if len(content)>1000:
|
3519
|
+
if idx%100==0:
|
3520
|
+
logging.info(_('Imported {} elements'.format(idx)))
|
3521
|
+
|
3522
|
+
def import_gpkg(self, fn:str, bbox:Polygon = None):
|
3523
|
+
""" Import gdb by using geopandas and Fiona"""
|
3524
|
+
|
3525
|
+
import fiona
|
3526
|
+
|
3527
|
+
layers = fiona.listlayers(fn)
|
3528
|
+
|
3529
|
+
if self.wx_exists:
|
3530
|
+
dlg = wx.MultiChoiceDialog(None, _('Choose the layers to import'), _('Choose the layers'), layers)
|
3531
|
+
|
3532
|
+
if dlg.ShowModal() == wx.ID_OK:
|
3533
|
+
layers = [layers[i] for i in dlg.GetSelections()]
|
3534
|
+
else:
|
3535
|
+
return
|
3536
|
+
|
3537
|
+
for curlayer in layers:
|
3538
|
+
|
3539
|
+
content = gpd.read_file(fn, bbox=bbox, layer=curlayer)
|
3540
|
+
|
3541
|
+
if len(content)>1000:
|
3542
|
+
logging.warning(_('Layer {} contains more than 1000 elements -- it may take a while to import'.format(curlayer)))
|
3543
|
+
|
3544
|
+
for idx, row in content.iterrows():
|
3545
|
+
if 'NAME' in row.keys():
|
3546
|
+
name = row['NAME']
|
3547
|
+
elif 'MAJ_NIV3T' in row.keys():
|
3548
|
+
# WALOUS
|
3549
|
+
name = row['MAJ_NIV3T']
|
3550
|
+
elif 'NATUR_DESC' in row.keys():
|
3551
|
+
name = row['NATUR_DESC']
|
3552
|
+
elif 'Type' in row.keys():
|
3553
|
+
name = row['Type']
|
3554
|
+
else:
|
3555
|
+
name = str(idx)
|
3556
|
+
|
3557
|
+
poly = row['geometry']
|
3558
|
+
|
3559
|
+
newzone = zone(name=name, parent = self, fromshapely = poly)
|
3560
|
+
self.add_zone(newzone)
|
3561
|
+
|
3562
|
+
if len(content)>1000:
|
3563
|
+
if idx%100==0:
|
3564
|
+
logging.info(_('Imported {} elements'.format(idx)))
|
3565
|
+
|
3468
3566
|
def set_mapviewer(self):
|
3469
3567
|
""" Recherche d'une instance WolfMapViewer depuis le parent """
|
3470
3568
|
from .PyDraw import WolfMapViewer
|
@@ -3480,6 +3578,36 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3480
3578
|
|
3481
3579
|
assert isinstance(self.mapviewer, WolfMapViewer), _('Bad mapviewer -- verify your code or bad parent')
|
3482
3580
|
|
3581
|
+
def colorize_data(self, colors:dict[str:list[int]]) -> None:
|
3582
|
+
"""
|
3583
|
+
Colorize zones based on a dictionary of colors
|
3584
|
+
|
3585
|
+
Zone's name must be the key of the dictionary
|
3586
|
+
|
3587
|
+
"""
|
3588
|
+
|
3589
|
+
std_color = getIfromRGB([10, 10, 10])
|
3590
|
+
|
3591
|
+
for curzone in self.myzones:
|
3592
|
+
if curzone.myname in colors:
|
3593
|
+
curcolor = getIfromRGB(colors[curzone.myname])
|
3594
|
+
else:
|
3595
|
+
curcolor = std_color
|
3596
|
+
|
3597
|
+
for curvect in curzone.myvectors:
|
3598
|
+
curvect.myprop.color = curcolor
|
3599
|
+
curvect.myprop.alpha = 180
|
3600
|
+
curvect.myprop.transparent = True
|
3601
|
+
curvect.myprop.filled = True
|
3602
|
+
|
3603
|
+
def set_width(self, width:int) -> None:
|
3604
|
+
""" Change with of all vectors in all zones """
|
3605
|
+
for curzone in self.myzones:
|
3606
|
+
for curvect in curzone.myvectors:
|
3607
|
+
curvect.myprop.width = width
|
3608
|
+
|
3609
|
+
self.prep_listogl()
|
3610
|
+
|
3483
3611
|
def get_zone(self,keyzone:Union[int, str])->zone:
|
3484
3612
|
"""
|
3485
3613
|
Retrouve la zone sur base de son nom ou de sa position
|
@@ -3646,7 +3774,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3646
3774
|
Préparation des listes OpenGL pour augmenter la vitesse d'affichage
|
3647
3775
|
"""
|
3648
3776
|
for curzone in self.myzones:
|
3649
|
-
curzone.
|
3777
|
+
curzone.prep_listogl()
|
3650
3778
|
|
3651
3779
|
def check_plot(self):
|
3652
3780
|
"""
|
@@ -3704,15 +3832,16 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3704
3832
|
if forceparent:
|
3705
3833
|
addedzone.parent = self
|
3706
3834
|
|
3707
|
-
def find_minmax(self,update=False):
|
3835
|
+
def find_minmax(self, update=False, only_firstlast:bool=False):
|
3708
3836
|
"""
|
3709
3837
|
Trouve les bornes des vertices pour toutes les zones et tous les vecteurs
|
3710
3838
|
|
3711
|
-
update : si True, force la MAJ des minmax dans chaque zone; si False, compile les minmax déjà présents
|
3839
|
+
:param update : si True, force la MAJ des minmax dans chaque zone; si False, compile les minmax déjà présents
|
3840
|
+
:param only_firstlast : si True, ne prend en compte que le premier et le dernier vertex de chaque vecteur
|
3712
3841
|
"""
|
3713
3842
|
if update:
|
3714
3843
|
for zone in self.myzones:
|
3715
|
-
zone.find_minmax(update)
|
3844
|
+
zone.find_minmax(update, only_firstlast)
|
3716
3845
|
|
3717
3846
|
if len(self.myzones)>0:
|
3718
3847
|
|
@@ -4249,6 +4378,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4249
4378
|
self.mapviewer.start_action('capture vertices', _('Capture vertices'))
|
4250
4379
|
firstvert=wolfvertex(0.,0.)
|
4251
4380
|
self.active_vector.add_vertex(firstvert)
|
4381
|
+
self.active_vector.parentzone.reset_listogl()
|
4252
4382
|
self.mapviewer.mimicme()
|
4253
4383
|
|
4254
4384
|
def OnReverse(self, event:wx.MouseEvent):
|
@@ -4575,6 +4705,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4575
4705
|
if ret==wx.ID_YES:
|
4576
4706
|
|
4577
4707
|
self.mapviwer.add_object('triangulation',newobj=mytri)
|
4708
|
+
self.mapviewer.Refresh()
|
4578
4709
|
|
4579
4710
|
dlg.Destroy()
|
4580
4711
|
|
@@ -4596,7 +4727,9 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4596
4727
|
return
|
4597
4728
|
|
4598
4729
|
mytri = myzone.createmultibin()
|
4730
|
+
|
4599
4731
|
self.mapviewer.add_object('triangulation',newobj=mytri)
|
4732
|
+
self.mapviewer.Refresh()
|
4600
4733
|
|
4601
4734
|
def Oncreatemultibin_project(self, event:wx.MouseEvent):
|
4602
4735
|
"""
|
@@ -4618,6 +4751,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4618
4751
|
|
4619
4752
|
mytri = myzone.createmultibin_proj()
|
4620
4753
|
self.mapviewer.add_object('triangulation',newobj=mytri)
|
4754
|
+
self.mapviewer.Refresh()
|
4621
4755
|
|
4622
4756
|
def save_images_fromvec(self, dir=''):
|
4623
4757
|
"""
|
wolfhece/apps/version.py
CHANGED
wolfhece/picc.py
CHANGED
@@ -27,14 +27,15 @@ class Picc_data(Element_To_Draw):
|
|
27
27
|
super().__init__(idx = idx, plotted = plotted, mapviewer = mapviewer, need_for_wx= need_for_wx)
|
28
28
|
|
29
29
|
self.data_dir = data_dir
|
30
|
-
self._filename_vector = 'PICC_Vesdre.shp'
|
30
|
+
self._filename_vector = 'Wallonie.gdb' #'PICC_Vesdre.shp'
|
31
31
|
self._filename_points = 'PICC_Vesdre_points.shp'
|
32
32
|
self.zones = None
|
33
33
|
self.cloud = None
|
34
|
+
self._colors = {'Habitation': [255, 0, 0], 'Annexe': [0, 255, 0], 'Culture, sport ou loisir': [0, 0, 255], 'Autre': [10, 10, 10]}
|
34
35
|
|
35
36
|
return None
|
36
37
|
|
37
|
-
def read_data(self, data_dir:Path = None, bbox:Union[Polygon, list[float]] = None) -> None:
|
38
|
+
def read_data(self, data_dir:Path = None, bbox:Union[Polygon, list[float]] = None, colorize:bool = True) -> None:
|
38
39
|
"""
|
39
40
|
Read data from PICC directory
|
40
41
|
|
@@ -45,16 +46,16 @@ class Picc_data(Element_To_Draw):
|
|
45
46
|
if data_dir is None:
|
46
47
|
data_dir = self.data_dir
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
if
|
51
|
-
self.zones = Zones(data_dir / self._filename_vector, bbox = bbox)
|
49
|
+
datafile = data_dir / self._filename_vector
|
50
|
+
|
51
|
+
if datafile.exists():
|
52
|
+
self.zones = Zones(data_dir / self._filename_vector, bbox = bbox, mapviewer=self.mapviewer)
|
52
53
|
self.zones.prep_listogl()
|
53
54
|
else:
|
54
|
-
logging.error(_('File not found : {}').format(
|
55
|
+
logging.error(_('File not found : {}').format(datafile))
|
55
56
|
|
56
57
|
if self.mapviewer is not None:
|
57
|
-
dlg = wx.SingleChoiceDialog(None, _('Would you like to select a PICC file or a GDB database ?'), _('
|
58
|
+
dlg = wx.SingleChoiceDialog(None, _('Would you like to select a PICC file or a GDB database ?'), _('Choose data source'), ['Shape file/GPKG', 'GDB database'], wx.CHOICEDLG_STYLE)
|
58
59
|
ret = dlg.ShowModal()
|
59
60
|
|
60
61
|
if ret == wx.ID_CANCEL:
|
@@ -63,8 +64,9 @@ class Picc_data(Element_To_Draw):
|
|
63
64
|
choice = dlg.GetStringSelection()
|
64
65
|
dlg.Destroy()
|
65
66
|
|
66
|
-
if choice == '
|
67
|
-
with wx.FileDialog(None, _('Select a
|
67
|
+
if choice == 'Shape file/GPKG':
|
68
|
+
with wx.FileDialog(None, _('Select a file'), wildcard="Shapefile (*.shp)|*.shp|Gpkg (*.gpkg)|*.gpkg", style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fileDialog:
|
69
|
+
|
68
70
|
if fileDialog.ShowModal() == wx.ID_CANCEL:
|
69
71
|
return
|
70
72
|
|
@@ -73,7 +75,7 @@ class Picc_data(Element_To_Draw):
|
|
73
75
|
try:
|
74
76
|
self.data_dir = Path(pathname).parent
|
75
77
|
self._filename_vector = Path(pathname).name
|
76
|
-
self.zones = Zones(pathname, bbox = bbox)
|
78
|
+
self.zones = Zones(pathname, bbox = bbox, mapviewer=self.mapviewer)
|
77
79
|
self.zones.prep_listogl()
|
78
80
|
except:
|
79
81
|
logging.error(_('File not found : {}').format(pathname))
|
@@ -88,7 +90,7 @@ class Picc_data(Element_To_Draw):
|
|
88
90
|
try:
|
89
91
|
self.data_dir = Path(pathname)
|
90
92
|
self._filename_vector = ''
|
91
|
-
self.zones = Zones(self.data_dir, bbox = bbox)
|
93
|
+
self.zones = Zones(self.data_dir, bbox = bbox, mapviewer=self.mapviewer)
|
92
94
|
self.zones.prep_listogl()
|
93
95
|
|
94
96
|
except:
|
@@ -101,7 +103,13 @@ class Picc_data(Element_To_Draw):
|
|
101
103
|
self.cloud.myprop.width = 3
|
102
104
|
self.cloud.myprop.color = getIfromRGB([0, 0, 255])
|
103
105
|
else:
|
104
|
-
logging.error(_('
|
106
|
+
logging.error(_('Point file not found : {}').format(pointfile))
|
107
|
+
|
108
|
+
if self.zones is not None:
|
109
|
+
if colorize:
|
110
|
+
self.zones.colorize_data(self._colors)
|
111
|
+
self.zones.prep_listogl()
|
112
|
+
|
105
113
|
|
106
114
|
def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
107
115
|
""" Plot data in OpenGL context
|
@@ -158,3 +166,25 @@ class Picc_data(Element_To_Draw):
|
|
158
166
|
self.cloud.show_properties()
|
159
167
|
else:
|
160
168
|
logging.warning(_('No cloud properties to show !'))
|
169
|
+
|
170
|
+
class Cadaster_data(Picc_data):
|
171
|
+
""" Read and show cadaster data """
|
172
|
+
|
173
|
+
def __init__(self,
|
174
|
+
idx:str = '',
|
175
|
+
plotted:bool = True,
|
176
|
+
mapviewer = None,
|
177
|
+
need_for_wx:bool = False,
|
178
|
+
data_dir:Path = Path(r'./data/Cadastre'),
|
179
|
+
bbox:Union[Polygon, list[float]] = None) -> None:
|
180
|
+
|
181
|
+
super().__init__(idx = idx, plotted = plotted, mapviewer = mapviewer, need_for_wx= need_for_wx, data_dir = data_dir, bbox = bbox)
|
182
|
+
|
183
|
+
self._filename_vector = 'Cadastre.shp'
|
184
|
+
self._filename_points = ''
|
185
|
+
|
186
|
+
def read_data(self, data_dir: Path = None, bbox:Union[Polygon, List[float]] = None, colorize: bool = True) -> None:
|
187
|
+
|
188
|
+
super().read_data(data_dir, bbox, colorize=False)
|
189
|
+
if self.zones is not None:
|
190
|
+
self.zones.set_width(3)
|
@@ -70,6 +70,7 @@ WOLF_BC = 'Wolf boundary conditions'
|
|
70
70
|
OTHER_SCRIPTS = 'Other scripts'
|
71
71
|
IS_SIMUL = 'is_simul'
|
72
72
|
IS_SCENARIO = 'is_scenario'
|
73
|
+
IS_RESULTS = 'is_results'
|
73
74
|
HAS_RESULTS = 'has_results'
|
74
75
|
MISSING = 'missing'
|
75
76
|
SUBDIRS = 'subdirs'
|
@@ -300,7 +301,10 @@ class Config_Manager_2D_GPU:
|
|
300
301
|
for key, curdict in self._flat_configs:
|
301
302
|
if GPU_2D_file_extensions.NPY.value in curdict.keys():
|
302
303
|
if len(curdict[GPU_2D_file_extensions.NPY.value])>0:
|
303
|
-
|
304
|
+
if not curdict[IS_RESULTS]:
|
305
|
+
all_numpy += curdict[GPU_2D_file_extensions.NPY.value]
|
306
|
+
else:
|
307
|
+
logging.warning(_('Numpy files in simulation directory -- Ignored !'))
|
304
308
|
|
305
309
|
return all_numpy
|
306
310
|
|
@@ -334,22 +338,36 @@ class Config_Manager_2D_GPU:
|
|
334
338
|
"""
|
335
339
|
Check consistency of all files
|
336
340
|
|
337
|
-
All numpy files must have the same shape as the tif file in
|
341
|
+
All numpy files must have the same shape as the tif file in the root directory
|
338
342
|
All hydrographs must have the same number of columns
|
339
343
|
"""
|
340
344
|
|
345
|
+
logging.info(_('Checking consistency of all files except simulation results...\n'))
|
346
|
+
|
347
|
+
logging.info(_('NPY files...'))
|
341
348
|
numpyfiles = self.get_all_numpy()
|
342
349
|
|
350
|
+
logging.info(_('Number of numpy files : {}'.format(len(numpyfiles))))
|
351
|
+
|
343
352
|
log = ''
|
344
353
|
for curnpy in numpyfiles:
|
345
|
-
|
354
|
+
|
355
|
+
# test if the shape of the numpy file is the same as the tif file
|
356
|
+
# using memmap to avoid loading the whole array in memory -> faster
|
357
|
+
arr = np.lib.format.open_memmap(curnpy, mode='r')
|
358
|
+
|
346
359
|
if arr.shape != (self._header.nbx, self._header.nby):
|
347
360
|
loclog = _('Bad shape for {} !'.format(curnpy))
|
348
361
|
log += loclog + '\n'
|
349
362
|
logging.warning(loclog)
|
350
363
|
|
364
|
+
del(arr)
|
365
|
+
|
366
|
+
logging.info(_('Hydrographs...'))
|
351
367
|
hydro = self.get_hydrographs()
|
352
368
|
nb = hydro[0].data.shape[1]
|
369
|
+
|
370
|
+
logging.info(_('Number of hydrographs : {}'.format(len(hydro))))
|
353
371
|
for curhydro in hydro:
|
354
372
|
if curhydro.data.shape[1] != nb:
|
355
373
|
loclog = _('Bad number of columns for {} !'.format(curhydro[0]._filename))
|
@@ -406,6 +424,9 @@ class Config_Manager_2D_GPU:
|
|
406
424
|
# test if it is a scenario
|
407
425
|
self._test_is_scenario(curdict)
|
408
426
|
|
427
|
+
# test if it is a results directory
|
428
|
+
self._test_is_results(curdict)
|
429
|
+
|
409
430
|
def _recursive_find_files(self, wd:Path, curdict:dict):
|
410
431
|
""" Recherche récursive des fichiers de simulation/scenario dans les répertoires dont la structure a été traduite en dictionnaire """
|
411
432
|
if len(curdict.keys())>0:
|
@@ -428,6 +449,7 @@ class Config_Manager_2D_GPU:
|
|
428
449
|
|
429
450
|
curdict[IS_SIMUL] = False
|
430
451
|
curdict[IS_SCENARIO] = False
|
452
|
+
curdict[IS_RESULTS] = False
|
431
453
|
curdict[HAS_RESULTS] = False
|
432
454
|
curdict[MISSING] = []
|
433
455
|
curdict[SUBDIRS] = []
|
@@ -454,14 +476,28 @@ class Config_Manager_2D_GPU:
|
|
454
476
|
curdict['missing'].append(GPU_2D_file_extensions.NPY.value)
|
455
477
|
ok = False
|
456
478
|
|
457
|
-
curdict[
|
479
|
+
curdict[IS_SIMUL] = ok
|
458
480
|
|
459
481
|
def _test_is_scenario(self, curdict:dict):
|
460
482
|
|
461
|
-
curdict[
|
483
|
+
curdict[IS_SCENARIO] = len(curdict[GPU_2D_file_extensions.TIF.value])>0 or \
|
462
484
|
len(curdict[GPU_2D_file_extensions.TIFF.value])>0 or \
|
463
485
|
len(curdict[GPU_2D_file_extensions.PY.value])>0
|
464
486
|
|
487
|
+
def _test_is_results(self, curdict:dict):
|
488
|
+
""" Teste si le répertoire contient des fichiers de résultats """
|
489
|
+
|
490
|
+
ok = False
|
491
|
+
|
492
|
+
# test du fichier 'metadata.json'
|
493
|
+
if GPU_2D_file_extensions.JSON.value in curdict.keys():
|
494
|
+
for curfile in curdict[GPU_2D_file_extensions.JSON.value]:
|
495
|
+
ok = curfile.name.lower() == 'metadata.json'
|
496
|
+
if ok:
|
497
|
+
break
|
498
|
+
|
499
|
+
curdict[IS_RESULTS] = ok
|
500
|
+
|
465
501
|
def find_files(self):
|
466
502
|
"""
|
467
503
|
Recehrche des fichiers de simulation/scenario dans les répertoires dont la structure a été traduite en dictionnaire
|
wolfhece/wolf_array.py
CHANGED
@@ -3327,21 +3327,40 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3327
3327
|
myops: Ops_Array
|
3328
3328
|
|
3329
3329
|
def __init__(self,
|
3330
|
-
fname=None,
|
3331
|
-
mold=None,
|
3332
|
-
masknull=True,
|
3333
|
-
crop
|
3334
|
-
whichtype=WOLF_ARRAY_FULL_SINGLE,
|
3335
|
-
preload=True,
|
3336
|
-
create=False,
|
3337
|
-
mapviewer=None,
|
3338
|
-
nullvalue=0.,
|
3339
|
-
srcheader=None,
|
3340
|
-
idx:str
|
3341
|
-
plotted:bool
|
3342
|
-
need_for_wx:bool
|
3343
|
-
mask_source:np.ndarray = None,
|
3330
|
+
fname:str = None,
|
3331
|
+
mold:"WolfArray" = None,
|
3332
|
+
masknull:bool = True,
|
3333
|
+
crop:list[list[float],list[float]]=None,
|
3334
|
+
whichtype = WOLF_ARRAY_FULL_SINGLE,
|
3335
|
+
preload:bool = True,
|
3336
|
+
create:bool = False,
|
3337
|
+
mapviewer = None,
|
3338
|
+
nullvalue:float = 0.,
|
3339
|
+
srcheader:header_wolf = None,
|
3340
|
+
idx:str = '',
|
3341
|
+
plotted:bool = False,
|
3342
|
+
need_for_wx:bool = False,
|
3343
|
+
mask_source:np.ndarray = None,
|
3344
3344
|
) -> None:
|
3345
|
+
"""
|
3346
|
+
|
3347
|
+
:param fname: filename/filepath - if provided, the file will be read on disk
|
3348
|
+
:param mold: initialize from a copy a the mold object --> must be a WolArray
|
3349
|
+
:param masknull: mask data based on the nullvalue
|
3350
|
+
:param crop: crop data based on the spatial extent [[xmin, xmax],[ymin,ymax]]
|
3351
|
+
:param whichtype: type of the numpy array (float32 as default)
|
3352
|
+
:param preload: True = load data during initialization ; False = waits for the display to be required
|
3353
|
+
:param create: True = create a new array from wxDialog
|
3354
|
+
:param mapviewer: WolfMapViewer instance to display data
|
3355
|
+
:param nullvalue: null value used to mask data
|
3356
|
+
:param srcheader: initialize dimension from header_wolf instance
|
3357
|
+
:param idx: indentity --> required by the mapviewer
|
3358
|
+
:param plotted: True = will be plotted if required by the mapviewer
|
3359
|
+
:param need_for_wx: True = a wxApp is required (if no application is underway --> Error)
|
3360
|
+
:param mask_source: mask to link to the data
|
3361
|
+
|
3362
|
+
"""
|
3363
|
+
|
3345
3364
|
|
3346
3365
|
Element_To_Draw.__init__(self, idx, plotted, mapviewer, need_for_wx)
|
3347
3366
|
header_wolf.__init__(self)
|
@@ -3431,21 +3450,45 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3431
3450
|
self.mask_data(self.nullvalue)
|
3432
3451
|
|
3433
3452
|
elif mold is not None:
|
3434
|
-
self.
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3453
|
+
if self.cropini is None:
|
3454
|
+
self.nbx = mold.nbx
|
3455
|
+
self.nby = mold.nby
|
3456
|
+
self.nbz = mold.nbz
|
3457
|
+
self.dx = mold.dx
|
3458
|
+
self.dy = mold.dy
|
3459
|
+
self.dz = mold.dz
|
3460
|
+
self.origx = mold.origx
|
3461
|
+
self.origy = mold.origy
|
3462
|
+
self.origz = mold.origz
|
3463
|
+
self.translx = mold.translx
|
3464
|
+
self.transly = mold.transly
|
3465
|
+
self.translz = mold.translz
|
3466
|
+
self.array = ma.copy(mold.array)
|
3467
|
+
if idx=='':
|
3468
|
+
self.idx = mold.idx
|
3469
|
+
else:
|
3470
|
+
imin, jmin = mold.get_ij_from_xy(self.cropini[0][0], self.cropini[1][0])
|
3471
|
+
imax, jmax = mold.get_ij_from_xy(self.cropini[0][1], self.cropini[1][1])
|
3472
|
+
|
3473
|
+
imin = int(imin)
|
3474
|
+
jmin = int(jmin)
|
3475
|
+
imax = int(imax)
|
3476
|
+
jmax = int(jmax)
|
3477
|
+
|
3478
|
+
self.nbx = imax - imin
|
3479
|
+
self.nby = jmax - jmin
|
3480
|
+
self.dx = mold.dx
|
3481
|
+
self.dy = mold.dy
|
3482
|
+
self.origx, self.origy = mold.get_xy_from_ij(imin, jmin)
|
3483
|
+
self.origx -= self.dx / 2.
|
3484
|
+
self.origy -= self.dy / 2.
|
3485
|
+
self.translx = mold.translx
|
3486
|
+
self.transly = mold.transly
|
3487
|
+
|
3488
|
+
if idx=='':
|
3489
|
+
self.idx = mold.idx
|
3490
|
+
|
3491
|
+
self.array = ma.copy(mold.array[imin:imax, jmin:jmax])
|
3449
3492
|
|
3450
3493
|
elif create:
|
3451
3494
|
assert self.wx_exists, _('Array creation required a running wx App to display the UI')
|
@@ -3459,6 +3502,32 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3459
3502
|
|
3460
3503
|
self.add_ops_sel() # Ajout d'un gestionnaire de sélection et d'opérations
|
3461
3504
|
|
3505
|
+
def crop_array(self, bbox:list[list[float],list[float]]) -> "WolfArray":
|
3506
|
+
""" Crop the data based on the bounding box """
|
3507
|
+
imin, jmin = self.get_ij_from_xy(bbox[0][0], bbox[1][0])
|
3508
|
+
imax, jmax = self.get_ij_from_xy(bbox[0][1], bbox[1][1])
|
3509
|
+
|
3510
|
+
imin = int(imin)
|
3511
|
+
jmin = int(jmin)
|
3512
|
+
imax = int(imax)
|
3513
|
+
jmax = int(jmax)
|
3514
|
+
|
3515
|
+
newheader = header_wolf()
|
3516
|
+
newheader.nbx = imax-imin
|
3517
|
+
newheader.nby = jmax-jmin
|
3518
|
+
newheader.dx = self.dx
|
3519
|
+
newheader.dy = self.dy
|
3520
|
+
newheader.origx, newheader.origy = self.get_xy_from_ij(imin, jmin)
|
3521
|
+
newheader.origx -= self.dx / 2.
|
3522
|
+
newheader.origy -= self.dy / 2.
|
3523
|
+
newheader.translx = self.translx
|
3524
|
+
newheader.transly = self.transly
|
3525
|
+
|
3526
|
+
newarray = WolfArray(srcheader=newheader)
|
3527
|
+
|
3528
|
+
newarray.array[:,:] = self.array[imin:imax, jmin:jmax]
|
3529
|
+
|
3530
|
+
return newarray
|
3462
3531
|
|
3463
3532
|
def get_centers(self, usenap:bool = True):
|
3464
3533
|
""" Get the centers of the cells """
|
@@ -4951,7 +5020,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4951
5020
|
myvect.find_minmax()
|
4952
5021
|
mypointsij = self.get_ij_infootprint_vect(myvect)
|
4953
5022
|
myvert = myvect.asnparray()
|
4954
|
-
i,j =self.
|
5023
|
+
i,j =self.convert_xy2ij_np(myvert)
|
4955
5024
|
path = mpltPath.Path(np.column_stack([i,j]))
|
4956
5025
|
inside = path.contains_points(mypointsij)
|
4957
5026
|
|
@@ -5109,6 +5178,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5109
5178
|
self.origy = float(params['parameters']["base_coord_y"])
|
5110
5179
|
|
5111
5180
|
self.nullvalue = 99999.
|
5181
|
+
elif (locpath /'.txt').exists():
|
5182
|
+
self.read_txt_header()
|
5112
5183
|
|
5113
5184
|
self.mask_data(self.nullvalue)
|
5114
5185
|
self.loaded = True
|
@@ -5135,6 +5206,9 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5135
5206
|
|
5136
5207
|
if self.filename.endswith('.tif'):
|
5137
5208
|
self.export_geotif()
|
5209
|
+
elif self.filename.endswith('.npy'):
|
5210
|
+
np.save(self.filename, self.array.data)
|
5211
|
+
self.write_txt_header()
|
5138
5212
|
else:
|
5139
5213
|
self.write_txt_header()
|
5140
5214
|
self.write_array()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wolfhece
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.32
|
4
4
|
Author-email: Stéphane Champailler <stephane.champailler@uliege.be>, Pierre Archambeau <pierre.archambeau@uliege.be>
|
5
5
|
Project-URL: Homepage, https://uee.uliege.be/hece
|
6
6
|
Project-URL: Issues, https://uee.uliege.be/hece
|
@@ -5,9 +5,9 @@ wolfhece/Lidar2002.py,sha256=sXZ6p8_EKI5l8fJswIMAABT6dqHKVexU52Tjl1uuisU,5770
|
|
5
5
|
wolfhece/ManageParams.py,sha256=Wgt5Zh7QBtyiwTAltPHunSLqt4XuVuRH76GTUrXabS4,219
|
6
6
|
wolfhece/Model1D.py,sha256=jo2gE8VSzQZR6cQvldihbdCcf3C3XD1VR0bvBQsFe7Y,414892
|
7
7
|
wolfhece/PyConfig.py,sha256=oGSL1WsLM9uinlNP4zGBLK3uHPmBfduUi7R-VtWuRFA,8034
|
8
|
-
wolfhece/PyCrosssections.py,sha256=
|
9
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
-
wolfhece/PyGui.py,sha256=
|
8
|
+
wolfhece/PyCrosssections.py,sha256=kdNv8dHKtp_gS1yj_QYvLUkvCwk82G1TMlneL6MDCjg,112279
|
9
|
+
wolfhece/PyDraw.py,sha256=GpLLs-UU9s_BvUNtqfw2DGmF1FStcQUzlzU922dcTrk,334579
|
10
|
+
wolfhece/PyGui.py,sha256=_Y7ZE6JRIh5oYsQ4y2IFBiGGq3yEVwB4Sey4xcjffaY,53702
|
11
11
|
wolfhece/PyGuiHydrology.py,sha256=wKhR-KthPRyzJ887NmsozmUpm2CIQIwO3IbYORCYjrE,7290
|
12
12
|
wolfhece/PyHydrographs.py,sha256=GKK8U0byI45H9O_e4LAOOi7Aw0Tg7Q0Lx322stPg5IQ,3453
|
13
13
|
wolfhece/PyPalette.py,sha256=nb9oPLZF-xx-yvOWvw2XVVmis6XTmYT2i7hvH3qPwAg,21932
|
@@ -15,7 +15,7 @@ wolfhece/PyParams.py,sha256=23g3xGG1EVDQEXshrZzAKBaZkTP7K3EB7vbWfpAGcEI,84639
|
|
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=cLSzuGIy3qLDyYQt5efBiR3IM1Tcz_jtTWwOcIbWFAM,39527
|
18
|
-
wolfhece/PyVertexvectors.py,sha256=
|
18
|
+
wolfhece/PyVertexvectors.py,sha256=oqTNFy52-m58-nmwLpW0aPcWKZdVBqGOHe_Z4XU3OQE,203401
|
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
|
@@ -35,7 +35,7 @@ wolfhece/ins.py,sha256=0aU1mo4tYbw64Gwzrqbh-NCTH1tukmk0mpPHjRPHZXU,12661
|
|
35
35
|
wolfhece/irm_qdf.py,sha256=0nOU_usEZuWMwYOPV9qtZoWsQTn2x2DxOuk7VlYMkbo,15419
|
36
36
|
wolfhece/ismember.py,sha256=fkLvaH9fhx-p0QrlEzqa6ySO-ios3ysjAgXVXzLgSpY,2482
|
37
37
|
wolfhece/multiprojects.py,sha256=AMwEQZqo1Twh6tSPP-4L29-Fa8cI9d6dWce7l88awws,14675
|
38
|
-
wolfhece/picc.py,sha256=
|
38
|
+
wolfhece/picc.py,sha256=WAAOMSCSjH_Inm7RHOX7YMkA3TuJnSLNCqVQXpKhXFY,7350
|
39
39
|
wolfhece/pyGui1D.py,sha256=7m8BpsdbxRVFc4bEkG4ctFG9TT4xIL8TuwBu9neA8jE,116516
|
40
40
|
wolfhece/pybridges.py,sha256=HJ1BL1HC7UrgpQ-3jKXkqPFmc-TzToL28Uex2hjHk6c,57166
|
41
41
|
wolfhece/pydike.py,sha256=G4jfSZaAHHr4VWEJqnXSvEswXvlOz1yhbhQ6uu3AqyM,1943
|
@@ -47,7 +47,7 @@ wolfhece/pywalous.py,sha256=jwp251AzGBc0VmMzOqA0IJiRRa6yQIfccRM8lVGszIY,4474
|
|
47
47
|
wolfhece/rain_SPWMI.py,sha256=YqsF-yFro3y_a6MfVRFfr-Rxi7NR1gl_i8VX7scmzes,13548
|
48
48
|
wolfhece/textpillow.py,sha256=YJxF4JzPv3G1oqenJgWVYq3OPZx9iFtrmeIfvBwbJVU,8735
|
49
49
|
wolfhece/tools_mpl.py,sha256=q8Yc4aukPPiUcEzREvZRM_em67XqXaahdoaNt0DETfE,266
|
50
|
-
wolfhece/wolf_array.py,sha256=
|
50
|
+
wolfhece/wolf_array.py,sha256=zTrv6hofObnNpNDsPPPG0eoDGhwII0XbaUi9VZFcB7s,285509
|
51
51
|
wolfhece/wolf_hist.py,sha256=JpRXvzJLUP-RkSkvth3DQWglgTMFI2ZEUDb4RYOfeeI,3284
|
52
52
|
wolfhece/wolf_texture.py,sha256=quflEvi32lWSvOPa0aDCDl-8Jv-jGtLHbR2rdx67LsI,14883
|
53
53
|
wolfhece/wolf_tiles.py,sha256=F2JsJHdAP8fIffNJdG_J26bonCIRtIwMmxKFqdSCRDA,10088
|
@@ -64,7 +64,7 @@ wolfhece/apps/check_install.py,sha256=jrKR-njqnpIh6ZJqvP6KbDUPVCfwTNQj4glQhcyzs9
|
|
64
64
|
wolfhece/apps/curvedigitizer.py,sha256=avWERHuVxPnJBOD_ibczwW_XG4vAenqWS8W1zjhBox8,4898
|
65
65
|
wolfhece/apps/isocurrent.py,sha256=4XnNWPa8mYUK7V4zdDRFrHFIXNG2AN2og3TqWKKcqjY,3811
|
66
66
|
wolfhece/apps/splashscreen.py,sha256=m9hMTqzhSUcTudApyNNjoAK9e2u5vgEkJVV79xmfM1s,2118
|
67
|
-
wolfhece/apps/version.py,sha256=
|
67
|
+
wolfhece/apps/version.py,sha256=vT9pd_afsI6ey7hOlnBO0_Aek2ZYxkqtXeuREpTZs44,388
|
68
68
|
wolfhece/apps/wolf.py,sha256=gqfm-ZaUJqNsfCzmdtemSeqLw-GVdSVix-evg5WArJI,293
|
69
69
|
wolfhece/apps/wolf2D.py,sha256=gWD9ee2-1pw_nUxjgRaJMuSe4kUT-RWhOeoTt_Lh1mM,267
|
70
70
|
wolfhece/apps/wolfcompare2Darrays.py,sha256=MucG5h4sU4jicDVCKohiCDUVUqx_RQ1qKrZKokpnxhQ,3743
|
@@ -231,7 +231,7 @@ wolfhece/rem/RasterViz.py,sha256=TDhWyMppcYBL71HfhpZuMgYKhz7faZg-MEOQJo_3Ivo,291
|
|
231
231
|
wolfhece/rem/__init__.py,sha256=S2-J5uEGK_VaMFjRUYFIdSScJjZyuXH4RmMmnG3OG7I,19
|
232
232
|
wolfhece/scenario/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
233
233
|
wolfhece/scenario/check_scenario.py,sha256=Q0_jA3PYapcbCT881YojTwKoRi_RjZpevHXhtP9VoqE,4619
|
234
|
-
wolfhece/scenario/config_manager.py,sha256
|
234
|
+
wolfhece/scenario/config_manager.py,sha256=YTn1tSMxLCcHjAWotfzfj7_1E7SS53k7xdSl7TSyLmE,62575
|
235
235
|
wolfhece/scenario/imposebc_void.py,sha256=pl7c99HQQMQT7i15fDlOOFYCdOtR5c_XIBOveOTOaLc,5273
|
236
236
|
wolfhece/scenario/update_void.py,sha256=MmiDiwWHvuk0mpXOlMeB2ImY-d1Wi3Wfmg9hrDTAraE,7176
|
237
237
|
wolfhece/shaders/fragment_shader_texture.glsl,sha256=w6h8d5mJqFaGbao0LGmjRcFFdcEQ3ICIl9JpuT71K5k,177
|
@@ -252,8 +252,8 @@ wolfhece/sounds/sonsw2.wav,sha256=pFLVt6By0_EPQNt_3KfEZ9a1uSuYTgQSX1I_Zurv9Rc,11
|
|
252
252
|
wolfhece/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
253
253
|
wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=yGbU_JsF56jsmms0gh7mxa7tbNQ_SxqhpAZxhm-mTy4,14860
|
254
254
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=wCxGRnE3kzEkWlWA6-3X8ADOFux_B0a5QWJ2GnXTgJw,4709
|
255
|
-
wolfhece-2.0.
|
256
|
-
wolfhece-2.0.
|
257
|
-
wolfhece-2.0.
|
258
|
-
wolfhece-2.0.
|
259
|
-
wolfhece-2.0.
|
255
|
+
wolfhece-2.0.32.dist-info/METADATA,sha256=HcLDc0Nb55f64UqgUm84CdYGLCGDIiVQIqOGz6X5fV8,2262
|
256
|
+
wolfhece-2.0.32.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
257
|
+
wolfhece-2.0.32.dist-info/entry_points.txt,sha256=AIu1KMswrdsqNq_2jPtrRIU4tLjuTnj2dCY-pxIlshw,276
|
258
|
+
wolfhece-2.0.32.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
259
|
+
wolfhece-2.0.32.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|