wolfhece 2.2.43__py3-none-any.whl → 2.2.44__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/ChatwWOLF.py +200 -0
- wolfhece/Model1D.py +1785 -11
- wolfhece/PyCrosssections.py +1536 -699
- wolfhece/PyDraw.py +61 -8
- wolfhece/PyVertexvectors.py +64 -22
- wolfhece/RatingCurve_xml.py +15 -1
- wolfhece/analyze_poly.py +198 -4
- wolfhece/apps/version.py +1 -1
- wolfhece/dike.py +265 -19
- wolfhece/eikonal.py +1 -0
- wolfhece/wolf_array.py +242 -29
- {wolfhece-2.2.43.dist-info → wolfhece-2.2.44.dist-info}/METADATA +2 -2
- {wolfhece-2.2.43.dist-info → wolfhece-2.2.44.dist-info}/RECORD +16 -15
- {wolfhece-2.2.43.dist-info → wolfhece-2.2.44.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.43.dist-info → wolfhece-2.2.44.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.43.dist-info → wolfhece-2.2.44.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -101,7 +101,7 @@ except ImportError as e:
|
|
101
101
|
raise ImportError("Error importing wolf_texture, xyz_file, mesh2d, PyPalette, wolfresults_2D, PyTranslate, PyVertex, RatingCurve, wolf_array, PyParams, mesh2d.bc_manager, PyVertexvectors, Results2DGPU, PyCrosssections, GraphNotebook, lazviewer, picc, wolf_zi_db, math_parser.calculator, wintab. Please check your installation.")
|
102
102
|
|
103
103
|
try:
|
104
|
-
from .dike import DikeWolf,
|
104
|
+
from .dike import DikeWolf, InjectorWolf as InjectorDike
|
105
105
|
except:
|
106
106
|
logging.warning(_("Missing package. Install wolfpydike module via pip."))
|
107
107
|
|
@@ -620,6 +620,7 @@ class draw_type(Enum):
|
|
620
620
|
DROWNING = 'drowning'
|
621
621
|
DIKE = 'dike'
|
622
622
|
PICTURECOLLECTION = 'picture_collection'
|
623
|
+
INJECTOR = 'injector'
|
623
624
|
|
624
625
|
class Colors_1to9(wx.Frame):
|
625
626
|
|
@@ -2143,6 +2144,7 @@ class WolfMapViewer(wx.Frame):
|
|
2143
2144
|
mydrownings: list[Drowning_victim_Viewer]
|
2144
2145
|
mydikes: list[DikeWolf]
|
2145
2146
|
mypicturecollections: list[PictureCollection]
|
2147
|
+
myinjectors: list[InjectorDike]
|
2146
2148
|
|
2147
2149
|
mymplfigs:list[MplFigViewer]
|
2148
2150
|
|
@@ -2179,6 +2181,7 @@ class WolfMapViewer(wx.Frame):
|
|
2179
2181
|
active_laz : Wolf_LAZ_Data
|
2180
2182
|
active_drowning: Drowning_victim_Viewer
|
2181
2183
|
active_dike : DikeWolf
|
2184
|
+
active_injector : InjectorDike
|
2182
2185
|
active_picturecollection: PictureCollection
|
2183
2186
|
active_alaro: IRM_Alaro
|
2184
2187
|
|
@@ -2622,6 +2625,7 @@ class WolfMapViewer(wx.Frame):
|
|
2622
2625
|
self.active_weir = None
|
2623
2626
|
self.active_laz = None
|
2624
2627
|
self.active_dike = None
|
2628
|
+
self.active_injector = None
|
2625
2629
|
self.active_picturecollection = None
|
2626
2630
|
self.active_qdfidf = None
|
2627
2631
|
self.active_alaro = None
|
@@ -2689,6 +2693,7 @@ class WolfMapViewer(wx.Frame):
|
|
2689
2693
|
self.myitemswmsfore = self.treelist.AppendItem(self.root, _("WMS-foreground"))
|
2690
2694
|
self.myitemsdrowning = self.treelist.AppendItem(self.root,_("Drowning"))
|
2691
2695
|
self.myitemsdike = self.treelist.AppendItem(self.root, _("Dikes"))
|
2696
|
+
self.myitemsinjector= self.treelist.AppendItem(self.root, _("Injectors"))
|
2692
2697
|
self.myitemspictcollection = self.treelist.AppendItem(self.root, _("Pictures"))
|
2693
2698
|
|
2694
2699
|
width, height = self.GetClientSize()
|
@@ -3766,7 +3771,12 @@ class WolfMapViewer(wx.Frame):
|
|
3766
3771
|
if self.menudike is None:
|
3767
3772
|
self.menudike = wx.Menu()
|
3768
3773
|
|
3769
|
-
self.menudike_launchsimu = self.menudike.Append(wx.ID_ANY, _("Launch simulation"), _("Launch simulation"))
|
3774
|
+
self.menudike_launchsimu = self.menudike.Append(wx.ID_ANY, _("Launch lumped simulation"), _("Launch lumped simulation"))
|
3775
|
+
|
3776
|
+
self.menudike.AppendSeparator()
|
3777
|
+
|
3778
|
+
self.menudike_setinjector = self.menudike.Append(wx.ID_ANY, _("Set injector"), _("Set injector"))
|
3779
|
+
self.menudike_launch2Dsimu = self.menudike.Append(wx.ID_ANY, _("Launch 2D-coupled simulation"), _("Launch 2D-coupled simulation"))
|
3770
3780
|
|
3771
3781
|
self.menudike.AppendSeparator()
|
3772
3782
|
|
@@ -4305,9 +4315,17 @@ class WolfMapViewer(wx.Frame):
|
|
4305
4315
|
LEVELS = 1
|
4306
4316
|
BREACHWIDTH = 2
|
4307
4317
|
|
4308
|
-
if itemlabel == _("Launch simulation"):
|
4318
|
+
if itemlabel == _("Launch lumped simulation"):
|
4319
|
+
|
4320
|
+
self.active_dike.run_lumped()
|
4321
|
+
|
4322
|
+
elif itemlabel == _("Set injector"):
|
4309
4323
|
|
4310
|
-
self.active_dike.
|
4324
|
+
self.active_dike.set_injector()
|
4325
|
+
|
4326
|
+
elif itemlabel == _("Launch 2D-coupled simulation"):
|
4327
|
+
|
4328
|
+
self.active_dike.run_2Dcoupled()
|
4311
4329
|
|
4312
4330
|
elif itemlabel == _("Show triangulation"):
|
4313
4331
|
|
@@ -6165,6 +6183,7 @@ class WolfMapViewer(wx.Frame):
|
|
6165
6183
|
self.mylazdata = []
|
6166
6184
|
self.mydrownings = []
|
6167
6185
|
self.mydikes = []
|
6186
|
+
self.myinjectors = []
|
6168
6187
|
self.mypicturecollections = []
|
6169
6188
|
|
6170
6189
|
self.mymplfigs = []
|
@@ -6172,7 +6191,7 @@ class WolfMapViewer(wx.Frame):
|
|
6172
6191
|
self.sim_explorers = {}
|
6173
6192
|
|
6174
6193
|
# liste des éléments modifiable dans l'arbre
|
6175
|
-
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.myimagestiles, self.mypartsystems, self.myviewers3d, self.myviewerslaz, self.mydikes, self.mydrownings]
|
6194
|
+
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.myimagestiles, self.mypartsystems, self.myviewers3d, self.myviewerslaz, self.mydikes, self.mydrownings, self.myinjectors]
|
6176
6195
|
|
6177
6196
|
self.menu_options = wx.Menu()
|
6178
6197
|
self._change_title = self.menu_options.Append(wx.ID_ANY, _('Change title'), _('Change title of the window'))
|
@@ -10743,7 +10762,7 @@ class WolfMapViewer(wx.Frame):
|
|
10743
10762
|
if ret == wx.ID_OK:
|
10744
10763
|
obj.saveas(fdlg.GetPath())
|
10745
10764
|
|
10746
|
-
if len(self.myarrays) + len(self.myvectors) + len(self.myclouds) + len(self.mytri) + len(self.myres2D) + len(self.mytiles) + len(self.myimagestiles) + len(self.mypartsystems) + len(self.mydikes) + len(self.mydrownings) == 2 or autoscale:
|
10765
|
+
if len(self.myarrays) + len(self.myvectors) + len(self.myclouds) + len(self.mytri) + len(self.myres2D) + len(self.mytiles) + len(self.myimagestiles) + len(self.mypartsystems) + len(self.mydikes) + len(self.mydrownings) + len(self.myinjectors) == 2 or autoscale:
|
10747
10766
|
# Trouve les bornes si un seul élément est présent, sinon on conserve l'état du zoom
|
10748
10767
|
self.Autoscale()
|
10749
10768
|
|
@@ -11339,6 +11358,7 @@ class WolfMapViewer(wx.Frame):
|
|
11339
11358
|
'drowning',
|
11340
11359
|
'imagestiles',
|
11341
11360
|
'dike',
|
11361
|
+
'injector',
|
11342
11362
|
'picture_collection'] = 'array',
|
11343
11363
|
filename='',
|
11344
11364
|
newobj=None,
|
@@ -12100,6 +12120,14 @@ class WolfMapViewer(wx.Frame):
|
|
12100
12120
|
self.mydikes.append(newobj)
|
12101
12121
|
self.active_dike = newobj
|
12102
12122
|
|
12123
|
+
elif which.lower() == 'injector':
|
12124
|
+
|
12125
|
+
curdict = self.myinjectors
|
12126
|
+
curtree = self.myitemsinjector
|
12127
|
+
|
12128
|
+
self.myinjectors.append(newobj)
|
12129
|
+
self.active_injector = newobj
|
12130
|
+
|
12103
12131
|
# ID chooser
|
12104
12132
|
if id == '':
|
12105
12133
|
dlg = wx.TextEntryDialog(self, 'ID ? (case insensitive)', 'Choose an identifier', '')
|
@@ -12304,7 +12332,7 @@ class WolfMapViewer(wx.Frame):
|
|
12304
12332
|
|
12305
12333
|
if drawing_type is None:
|
12306
12334
|
# return all_lists
|
12307
|
-
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D + self.mydikes + self.mydrownings + self.mypicturecollections
|
12335
|
+
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D + self.mydikes + self.mydrownings + self.myinjectors + self.mypicturecollections
|
12308
12336
|
|
12309
12337
|
if drawing_type == draw_type.ARRAYS:
|
12310
12338
|
return self.myarrays
|
@@ -12336,6 +12364,8 @@ class WolfMapViewer(wx.Frame):
|
|
12336
12364
|
return self.mydrownings
|
12337
12365
|
elif drawing_type == draw_type.DIKE:
|
12338
12366
|
return self.mydikes
|
12367
|
+
elif drawing_type == draw_type.INJECTOR:
|
12368
|
+
return self.myinjectors
|
12339
12369
|
elif drawing_type == draw_type.PICTURECOLLECTION:
|
12340
12370
|
return self.mypicturecollections
|
12341
12371
|
else:
|
@@ -12542,6 +12572,9 @@ class WolfMapViewer(wx.Frame):
|
|
12542
12572
|
elif myobj is self.active_dike:
|
12543
12573
|
self.active_dike = None
|
12544
12574
|
self.set_label_selecteditem('')
|
12575
|
+
elif myobj is self.active_injector:
|
12576
|
+
self.active_injector = None
|
12577
|
+
self.set_label_selecteditem('')
|
12545
12578
|
|
12546
12579
|
def upobj(self):
|
12547
12580
|
"""Up selected item into general tree"""
|
@@ -12674,6 +12707,8 @@ class WolfMapViewer(wx.Frame):
|
|
12674
12707
|
self.selected_object.save()
|
12675
12708
|
elif isinstance(self.selected_object, DikeWolf):
|
12676
12709
|
self.selected_object.save()
|
12710
|
+
elif isinstance(self.selected_object, InjectorDike):
|
12711
|
+
self.selected_object.save()
|
12677
12712
|
|
12678
12713
|
elif text==_('Up'):
|
12679
12714
|
self.upobj()
|
@@ -12845,6 +12880,9 @@ class WolfMapViewer(wx.Frame):
|
|
12845
12880
|
elif isinstance(self.selected_object, DikeWolf):
|
12846
12881
|
self.selected_object.save_as()
|
12847
12882
|
|
12883
|
+
elif isinstance(self.selected_object, InjectorDike):
|
12884
|
+
self.selected_object.save_as()
|
12885
|
+
|
12848
12886
|
elif isinstance(self.selected_object, Wolf_LAZ_Data):
|
12849
12887
|
filterArray = "Dump (*.dump)|*.dmp|all (*.*)|*.*"
|
12850
12888
|
fdlg = wx.FileDialog(self, "Choose file name for LAZ data :" + self.selected_object.idx, wildcard=filterArray,
|
@@ -12873,7 +12911,7 @@ class WolfMapViewer(wx.Frame):
|
|
12873
12911
|
elif text == _('Properties'):
|
12874
12912
|
|
12875
12913
|
myobj = self.selected_object
|
12876
|
-
if type(myobj) in [WolfArray, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data, Cadaster_data, hydrometry_wolfgui, Bridge, Weir, Wolf_LAZ_Data, DikeWolf, Drowning_victim_Viewer]:
|
12914
|
+
if type(myobj) in [WolfArray, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data, Cadaster_data, hydrometry_wolfgui, Bridge, Weir, Wolf_LAZ_Data, DikeWolf, Drowning_victim_Viewer, InjectorDike]:
|
12877
12915
|
myobj.show_properties()
|
12878
12916
|
|
12879
12917
|
elif isinstance(myobj, cloud_vertices):
|
@@ -14426,6 +14464,20 @@ class WolfMapViewer(wx.Frame):
|
|
14426
14464
|
logging.info(_('Activating Drowning victim event : ' + nameitem))
|
14427
14465
|
self.active_drowning = myobj
|
14428
14466
|
|
14467
|
+
elif type(myobj) == DikeWolf:
|
14468
|
+
logging.info(_('Activating DikeWolf : ' + nameitem))
|
14469
|
+
self.active_dike = myobj
|
14470
|
+
if myobj.injector is not None:
|
14471
|
+
self.active_injector = myobj.injector
|
14472
|
+
logging.info(_('Activating InjectorDike : ' + nameitem))
|
14473
|
+
|
14474
|
+
if ctrl:
|
14475
|
+
myobj.show_properties()
|
14476
|
+
|
14477
|
+
elif type(myobj) == InjectorDike:
|
14478
|
+
logging.info(_('Activating InjectorDike : ' + nameitem))
|
14479
|
+
self.active_injector = myobj
|
14480
|
+
|
14429
14481
|
if ctrl:
|
14430
14482
|
myobj.show_properties()
|
14431
14483
|
|
@@ -15974,6 +16026,7 @@ class WolfMapViewer(wx.Frame):
|
|
15974
16026
|
self.active_vertex = None
|
15975
16027
|
self.active_cloud = None
|
15976
16028
|
self.active_dike = None
|
16029
|
+
self.active_injector = None
|
15977
16030
|
|
15978
16031
|
self.active_laz = None
|
15979
16032
|
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -585,9 +585,9 @@ class Triangulation(Element_To_Draw):
|
|
585
585
|
if poly.is_valid:
|
586
586
|
polygons.append(poly)
|
587
587
|
else:
|
588
|
-
logging.
|
588
|
+
logging.debug('Invalid polygon found in triangulation: {}'.format(poly))
|
589
589
|
else:
|
590
|
-
logging.
|
590
|
+
logging.error('Triangle with {} vertices found in triangulation: {}'.format(len(curtri), curtri))
|
591
591
|
return polygons
|
592
592
|
|
593
593
|
def unuse_triangles_containing_points(self, points:list[Point]):
|
@@ -1883,6 +1883,10 @@ class vector:
|
|
1883
1883
|
inside2 = poly.contains(Point([x,y]))
|
1884
1884
|
return inside2
|
1885
1885
|
|
1886
|
+
def contains(self, x:float, y:float) -> bool:
|
1887
|
+
""" alias for isinside """
|
1888
|
+
return self.isinside(x, y)
|
1889
|
+
|
1886
1890
|
def asshapely_pol(self) -> Polygon:
|
1887
1891
|
"""
|
1888
1892
|
Conversion des coordonnées en Polygon Shapely
|
@@ -1948,7 +1952,7 @@ class vector:
|
|
1948
1952
|
|
1949
1953
|
def prepare_shapely(self, prepare_shapely:bool = True, linestring:bool = True, polygon:bool = True):
|
1950
1954
|
"""
|
1951
|
-
Conversion Linestring Shapely et rétention de l'objet afin d'éviter de multiples
|
1955
|
+
Conversion Linestring Shapely et rétention de l'objet afin d'éviter de multiples appels
|
1952
1956
|
par ex. dans une boucle.
|
1953
1957
|
|
1954
1958
|
:param prepare_shapely: Préparation de l'objet Shapely pour une utilisation optimisée
|
@@ -2073,6 +2077,15 @@ class vector:
|
|
2073
2077
|
else:
|
2074
2078
|
return myinter
|
2075
2079
|
|
2080
|
+
def intersects(self, x:float, y:float) -> bool:
|
2081
|
+
""" Check if the point (x, y) intersects with the vector. """
|
2082
|
+
point = Point(x, y)
|
2083
|
+
return self.linestring.intersects(point)
|
2084
|
+
|
2085
|
+
def aligned_with(self, x:float, y:float, tolerance:float = 1e-6) -> bool:
|
2086
|
+
""" Check if the point (x, y) is aligned with the vector. """
|
2087
|
+
return self.intersects(x, y) and self.linestring.distance(Point(x, y)) < tolerance
|
2088
|
+
|
2076
2089
|
def reset(self):
|
2077
2090
|
"""Remise à zéro"""
|
2078
2091
|
self.myvertices=[]
|
@@ -3127,34 +3140,36 @@ class vector:
|
|
3127
3140
|
|
3128
3141
|
def get_s2d(self) -> np.ndarray:
|
3129
3142
|
"""
|
3130
|
-
|
3143
|
+
Calcule et retourne des positions curvilignes 2D
|
3131
3144
|
"""
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3145
|
+
|
3146
|
+
s2d = np.zeros(self.nbvertices)
|
3147
|
+
for k in range(1, self.nbvertices):
|
3148
|
+
s2d[k] = s2d[k-1] + self.myvertices[k-1].dist2D(self.myvertices[k])
|
3135
3149
|
|
3136
3150
|
return s2d
|
3137
3151
|
|
3138
3152
|
def get_s3d(self) -> np.ndarray:
|
3139
3153
|
"""
|
3140
|
-
|
3154
|
+
Calcule et retourne des positions curvilignes 3D
|
3141
3155
|
"""
|
3156
|
+
|
3142
3157
|
s3d=np.zeros(self.nbvertices)
|
3143
3158
|
for k in range(1,self.nbvertices):
|
3144
|
-
s3d[k]=s3d[k-1]+self.myvertices[k-1].dist3D(self.myvertices[k])
|
3159
|
+
s3d[k] = s3d[k-1] + self.myvertices[k-1].dist3D(self.myvertices[k])
|
3145
3160
|
|
3146
3161
|
return s3d
|
3147
3162
|
|
3148
3163
|
def get_sz(self, cumul=True):
|
3149
3164
|
"""
|
3150
|
-
Calcule et retourne la distance horizontale cumulée ou non
|
3165
|
+
Calcule et retourne la distance horizontale cumulée ou non.
|
3151
3166
|
de chaque point vis-à-vis du premier point
|
3152
3167
|
|
3153
3168
|
Utile pour le tracé de sections en travers ou des vérifications de position
|
3154
3169
|
|
3155
|
-
:param cumul: si True, retourne la distance cumulée 2D. si False, retourne la distance 2D entre chaque point et le premier.
|
3170
|
+
:param cumul: si True, retourne la distance cumulée 2D le long du vecteur. si False, retourne la distance 2D entre chaque point et le premier.
|
3156
3171
|
"""
|
3157
|
-
z = np.asarray([
|
3172
|
+
z = np.asarray([vert.z for vert in self.myvertices])
|
3158
3173
|
|
3159
3174
|
nb = len(z)
|
3160
3175
|
s = np.zeros(nb)
|
@@ -3175,6 +3190,11 @@ class vector:
|
|
3175
3190
|
for i in range(nb):
|
3176
3191
|
s[i] = self.myvertices[0].dist2D(self.myvertices[i])
|
3177
3192
|
|
3193
|
+
if self.add_sdatum:
|
3194
|
+
s += self.sdatum
|
3195
|
+
if self.add_zdatum:
|
3196
|
+
z += self.zdatum
|
3197
|
+
|
3178
3198
|
return s,z
|
3179
3199
|
|
3180
3200
|
def update_lengths(self):
|
@@ -3224,6 +3244,9 @@ class vector:
|
|
3224
3244
|
cums = np.cumsum(lengthparts)
|
3225
3245
|
|
3226
3246
|
if adim:
|
3247
|
+
if length == 0.:
|
3248
|
+
logging.warning(_('Length of vector {} is zero, cannot compute segments').format(self.myname))
|
3249
|
+
|
3227
3250
|
cums = cums.copy()/length
|
3228
3251
|
cums[-1]=1.
|
3229
3252
|
lengthparts = lengthparts.copy()/length
|
@@ -3319,9 +3342,16 @@ class vector:
|
|
3319
3342
|
- en 3D
|
3320
3343
|
- en adimensionnel
|
3321
3344
|
"""
|
3322
|
-
k,cums,lengthparts=self.get_segment(s,is3D,adim,frombegin)
|
3323
3345
|
|
3324
|
-
|
3346
|
+
if self.length2D is None or self.length3D is None:
|
3347
|
+
self.update_lengths()
|
3348
|
+
|
3349
|
+
if self.length2D == 0.:
|
3350
|
+
pond = 0.
|
3351
|
+
k = 0
|
3352
|
+
else:
|
3353
|
+
k,cums,lengthparts=self.get_segment(s,is3D,adim,frombegin)
|
3354
|
+
pond = (cums-s)/lengthparts[k]
|
3325
3355
|
|
3326
3356
|
return wolfvertex(self.myvertices[k].x*pond+self.myvertices[k+1].x*(1.-pond),
|
3327
3357
|
self.myvertices[k].y*pond+self.myvertices[k+1].y*(1.-pond),
|
@@ -3333,6 +3363,7 @@ class vector:
|
|
3333
3363
|
Nom similaire à la même opération dans Shapely mais qui ne gère, elle, que le 2D
|
3334
3364
|
"""
|
3335
3365
|
if s1==s2:
|
3366
|
+
logging.debug(_('Substring with same start and end abscissa: s1={} s2={}').format(s1, s2))
|
3336
3367
|
s2+=eps
|
3337
3368
|
|
3338
3369
|
k1,cums1,lengthparts1=self.get_segment(s1,is3D,adim,True)
|
@@ -3516,10 +3547,15 @@ class vector:
|
|
3516
3547
|
copied_vector.myvertices = copy.deepcopy(self.myvertices)
|
3517
3548
|
# FIXME : deepcopy of properties is not working
|
3518
3549
|
# copied_vector.myprop = copy.deepcopy(self.myprop)
|
3519
|
-
|
3550
|
+
|
3520
3551
|
copied_vector.closed = self.closed
|
3552
|
+
|
3553
|
+
copied_vector.zdatum = self.zdatum
|
3521
3554
|
copied_vector.add_zdatum = self.add_zdatum
|
3522
3555
|
|
3556
|
+
copied_vector.sdatum = self.sdatum
|
3557
|
+
copied_vector.add_sdatum = self.add_sdatum
|
3558
|
+
|
3523
3559
|
return copied_vector
|
3524
3560
|
|
3525
3561
|
def deepcopy(self, name: str = None, parentzone = None) -> 'vector':
|
@@ -4014,7 +4050,7 @@ class vector:
|
|
4014
4050
|
inside = [self.polygon.contains(Point(curxy)) for curxy in xy]
|
4015
4051
|
|
4016
4052
|
return inside
|
4017
|
-
|
4053
|
+
|
4018
4054
|
def get_first_point_inside(self, xy: cloud_vertices | np.ndarray):
|
4019
4055
|
"""
|
4020
4056
|
Returns the first point (x, y) inside the polygon.
|
@@ -4025,7 +4061,7 @@ class vector:
|
|
4025
4061
|
:rtype: tuple[float, float] | None
|
4026
4062
|
"""
|
4027
4063
|
self.prepare_shapely(True)
|
4028
|
-
|
4064
|
+
|
4029
4065
|
if isinstance(xy, cloud_vertices):
|
4030
4066
|
xy = xy.get_xyz()[:, 0:2]
|
4031
4067
|
|
@@ -4090,7 +4126,7 @@ class vector:
|
|
4090
4126
|
def area(self):
|
4091
4127
|
""" Alias for surface """
|
4092
4128
|
return self.surface
|
4093
|
-
|
4129
|
+
|
4094
4130
|
def interpolate_coordinates(self):
|
4095
4131
|
"""
|
4096
4132
|
Interpole les valeurs Z des vertices sur base des seules valeurs connues,
|
@@ -4117,6 +4153,12 @@ class vector:
|
|
4117
4153
|
self.update_lengths()
|
4118
4154
|
self._reset_listogl()
|
4119
4155
|
|
4156
|
+
def __del__(self):
|
4157
|
+
""" Destructor """
|
4158
|
+
self._reset_listogl()
|
4159
|
+
self.reset_linestring()
|
4160
|
+
|
4161
|
+
|
4120
4162
|
class zone:
|
4121
4163
|
"""
|
4122
4164
|
Objet de gestion d'informations vectorielles
|
@@ -6824,10 +6866,10 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
6824
6866
|
|
6825
6867
|
logging.info(_('Importing shapefile {}'.format(fn)))
|
6826
6868
|
content = gpd.read_file(fn, bbox=bbox)
|
6827
|
-
|
6828
|
-
self.import_GeoDataFrame(content=content, colname=colname)
|
6829
|
-
|
6830
|
-
|
6869
|
+
|
6870
|
+
self.import_GeoDataFrame(content=content, colname=colname)
|
6871
|
+
|
6872
|
+
|
6831
6873
|
def import_GeoDataFrame(self, content:gpd.GeoDataFrame,
|
6832
6874
|
bbox:Polygon = None, colname:str = None):
|
6833
6875
|
"""
|
wolfhece/RatingCurve_xml.py
CHANGED
@@ -343,8 +343,13 @@ class StationCurvesGaugings():
|
|
343
343
|
name=m['KISTERSRatingcurve']['Station']['@Name']
|
344
344
|
|
345
345
|
periods = m['KISTERSRatingcurve']['Station']['Parameter']['Periods']['Period']
|
346
|
+
if not isinstance(periods, list):
|
347
|
+
periods = [periods]
|
346
348
|
|
347
349
|
rc_list = m['KISTERSRatingcurve']['Station']['Parameter']['Rc']
|
350
|
+
if isinstance(rc_list, dict):
|
351
|
+
rc_list = [rc_list]
|
352
|
+
|
348
353
|
rc_names = [cur_rc['@Name'] for cur_rc in rc_list]
|
349
354
|
|
350
355
|
for j in range(len(rc_names)-1):
|
@@ -446,6 +451,15 @@ class StationCurvesGaugings():
|
|
446
451
|
return
|
447
452
|
|
448
453
|
doc=pd.read_excel(fichier_xls)
|
454
|
+
|
455
|
+
if doc.iloc[0,0] == 'Date/Heure':
|
456
|
+
# format du fichier Excel avec les colonnes Date/Heure, Hauteur, Débit
|
457
|
+
doc.columns = ['Date/Heure', 'W [m]', 'Q [m³/s]']
|
458
|
+
# pop the first line
|
459
|
+
doc = doc.iloc[1:]
|
460
|
+
# reindex the DataFrame
|
461
|
+
doc.reset_index(drop=True, inplace=True)
|
462
|
+
|
449
463
|
for i in range (len(doc[doc.columns[0]])):
|
450
464
|
add_jaugeage=Gauging(doc[doc.columns[0]][i], doc[doc.columns[1]][i], doc[doc.columns[2]][i])
|
451
465
|
self.gaugings.append(add_jaugeage)
|
@@ -702,7 +716,7 @@ class StationsCurvesGaugings():
|
|
702
716
|
self.stations[newstation.code.lower()] = newstation
|
703
717
|
|
704
718
|
for r in fichiers_excel:
|
705
|
-
station_id = r.split('_')[
|
719
|
+
station_id = r.split('_')[-2].split('\\')[-1]
|
706
720
|
if station_id in self.stations.keys():
|
707
721
|
self.stations[station_id]._read_gaugings(r)
|
708
722
|
else:
|