wolfhece 2.0.16__py3-none-any.whl → 2.0.18__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/CpGrid.py +10 -13
- wolfhece/PyCrosssections.py +18 -13
- wolfhece/PyHydrographs.py +2 -2
- wolfhece/PyParams.py +15 -27
- wolfhece/PyPictures.py +48 -45
- wolfhece/PyVertexvectors.py +14 -19
- wolfhece/apps/curvedigitizer.py +4 -1
- wolfhece/apps/wolfcompare2Darrays.py +11 -7
- wolfhece/clientserver/clientserver.py +62 -0
- wolfhece/friction_law.py +39 -34
- wolfhece/ftp/downloader.py +8 -7
- wolfhece/gpuview.py +14 -13
- wolfhece/hydrology/Catchment.py +2 -2
- wolfhece/hydrology/PyWatershed.py +2 -2
- wolfhece/hydrology/SubBasin.py +13 -11
- wolfhece/hydrometry/kiwis_gui.py +9 -9
- wolfhece/irm_qdf.py +12 -10
- wolfhece/mar/Interface_MAR_WOLF_objet.py +260 -161
- wolfhece/opengl/py3d.py +231 -16
- wolfhece/pyshields.py +4 -4
- wolfhece/pythonfortran/example_makendarray.py +46 -41
- wolfhece/pythonfortran/example_numpy_memory.py +87 -83
- wolfhece/pythonfortran/tools.py +1 -1
- wolfhece/scenario/imposebc_void.py +2 -3
- wolfhece/scenario/update_void.py +6 -6
- wolfhece/wolf_array.py +17 -16
- wolfhece/wolfresults_2D.py +2 -4
- {wolfhece-2.0.16.dist-info → wolfhece-2.0.18.dist-info}/METADATA +7 -1
- {wolfhece-2.0.16.dist-info → wolfhece-2.0.18.dist-info}/RECORD +33 -38
- wolfhece/apps/wolfBernoulli.py +0 -18
- wolfhece/bernoulli/ModelJockgrim.py +0 -226
- wolfhece/bernoulli/NetworkOpenGL.py +0 -6461
- wolfhece/bernoulli/ReadNeupotzData.py +0 -223
- wolfhece/bernoulli/opti_results_interactive_plot.py +0 -212
- wolfhece/debug.py +0 -8
- /wolfhece/{bernoulli → clientserver}/__init__.py +0 -0
- {wolfhece-2.0.16.dist-info → wolfhece-2.0.18.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.16.dist-info → wolfhece-2.0.18.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.16.dist-info → wolfhece-2.0.18.dist-info}/top_level.txt +0 -0
wolfhece/CpGrid.py
CHANGED
@@ -4,19 +4,16 @@ import wx.grid
|
|
4
4
|
from .PyTranslate import _
|
5
5
|
|
6
6
|
class CpGrid(wx.grid.Grid):
|
7
|
-
"""
|
8
|
-
like copy, paste, and delete functionality.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
restored with Ctrl+z, or pasted with Ctrl+v.
|
18
|
-
Delete or backspace key will also perform this action.
|
19
|
-
Ctrl+z - Undo the last paste or delete action.
|
7
|
+
"""
|
8
|
+
A Full Copy and Paste enabled grid class which implements Excel like copy, paste, and delete functionality.
|
9
|
+
|
10
|
+
- Ctrl+c : Copy range of selected cells.
|
11
|
+
- Ctrl+v : Paste copy selection at point of currently selected cell.
|
12
|
+
- If paste selection is larger than copy selection, copy selection will be replicated to fill paste region if it is a modulo number of copy rows and/or columns, otherwise just the copy selection will be pasted.
|
13
|
+
- Ctrl+x : Delete current selection.
|
14
|
+
- Deleted selection can be restored with Ctrl+z, or pasted with Ctrl+v.
|
15
|
+
- Delete or backspace key will also perform this action.
|
16
|
+
- Ctrl+z : Undo the last paste or delete action.
|
20
17
|
|
21
18
|
"""
|
22
19
|
|
wolfhece/PyCrosssections.py
CHANGED
@@ -393,7 +393,7 @@ class profile(vector):
|
|
393
393
|
self.myvertices[-1].y-self.myvertices[0].y])
|
394
394
|
self.orient = self.orient /np.linalg.norm(self.orient)
|
395
395
|
|
396
|
-
def get_xy_from_s(self,s) ->
|
396
|
+
def get_xy_from_s(self,s) -> tuple[float, float]:
|
397
397
|
"""
|
398
398
|
Récupération d'un tuple (x,y) sur base d'une distance 2D 's' orientée dans l'axe de la section
|
399
399
|
"""
|
@@ -672,7 +672,7 @@ class profile(vector):
|
|
672
672
|
|
673
673
|
return length
|
674
674
|
|
675
|
-
def get_sz(self, cumul=True) ->
|
675
|
+
def get_sz(self, cumul=True) -> tuple[np.ndarray, np.ndarray]:
|
676
676
|
"""
|
677
677
|
Retourne 2 vecteurs avec la position curvi 2D et l'altitude des points
|
678
678
|
"""
|
@@ -729,7 +729,7 @@ class profile(vector):
|
|
729
729
|
curvert = wolfvertex(xy[i,0],xy[i,1],sz[i,1])
|
730
730
|
self.add_vertex(curvert)
|
731
731
|
|
732
|
-
def get_sz_banksbed(self, cumul=True, force:bool=False) ->
|
732
|
+
def get_sz_banksbed(self, cumul=True, force:bool=False) -> tuple[float, float, float, float, float, float]:
|
733
733
|
"""
|
734
734
|
Retourne les positions des points de référence mais avec la coordonnée curvi 2D
|
735
735
|
- (sleft, sbed, sright, zleft, zbed, zright)
|
@@ -791,10 +791,10 @@ class profile(vector):
|
|
791
791
|
|
792
792
|
return sleft,sbed,sright,zleft,zbed,zright
|
793
793
|
|
794
|
-
def get_s3d_banksbed(self, force:bool=False)->
|
794
|
+
def get_s3d_banksbed(self, force:bool=False)-> tuple[float, float, float]:
|
795
795
|
"""
|
796
796
|
Retourne les coordonnée curvi 3D des points de référence
|
797
|
-
|
797
|
+
- (sleft, sbed, sright)
|
798
798
|
"""
|
799
799
|
|
800
800
|
if self.prepared and not force:
|
@@ -1678,11 +1678,11 @@ class crosssections(Element_To_Draw):
|
|
1678
1678
|
|
1679
1679
|
L'objet stocke ses informations dans un dictionnaire : self.myprofiles
|
1680
1680
|
Les clés de chaque entrée sont:
|
1681
|
-
['index'] : integer
|
1682
|
-
['left'] : wolfvertex
|
1683
|
-
['bed'] : wolfvertex
|
1684
|
-
['right'] : wolfvertex
|
1685
|
-
['cs'] : profile (surcharge de vector)
|
1681
|
+
- ['index'] : integer
|
1682
|
+
- ['left'] : wolfvertex
|
1683
|
+
- ['bed'] : wolfvertex
|
1684
|
+
- ['right'] : wolfvertex
|
1685
|
+
- ['cs'] : profile (surcharge de vector)
|
1686
1686
|
|
1687
1687
|
Pour le moment, il est possible de lire les fichiers et d'effectuer cerrains traitements (tri selon vecteur, export gltf...).
|
1688
1688
|
|
@@ -1694,6 +1694,7 @@ class crosssections(Element_To_Draw):
|
|
1694
1694
|
- cloud_all
|
1695
1695
|
|
1696
1696
|
@remark !! La classe n'est pas encore prévue pour créer des sections en travers!!
|
1697
|
+
|
1697
1698
|
"""
|
1698
1699
|
|
1699
1700
|
myprofiles:dict
|
@@ -2419,8 +2420,10 @@ class crosssections(Element_To_Draw):
|
|
2419
2420
|
self.multils = self.asshapely_ls()
|
2420
2421
|
|
2421
2422
|
def sort_along(self,vecsupport:LineString,name:str,downfirst=True):
|
2422
|
-
"""
|
2423
|
-
|
2423
|
+
"""
|
2424
|
+
Sélectionne les sections qui intersectent un vecteur support
|
2425
|
+
et les trie selon l'abscisse curviligne
|
2426
|
+
"""
|
2424
2427
|
|
2425
2428
|
curdict = self.sorted[name]={}
|
2426
2429
|
curdict['support'] = vecsupport
|
@@ -2989,7 +2992,9 @@ class Interpolator():
|
|
2989
2992
|
return xy,z
|
2990
2993
|
|
2991
2994
|
class Interpolators():
|
2992
|
-
"""
|
2995
|
+
"""
|
2996
|
+
Classe de gestion des interpolations sur sections en travers
|
2997
|
+
"""
|
2993
2998
|
|
2994
2999
|
def __init__(self, banks:Zones, cs:crosssections, ds=1.) -> None:
|
2995
3000
|
"""
|
wolfhece/PyHydrographs.py
CHANGED
wolfhece/PyParams.py
CHANGED
@@ -110,10 +110,9 @@ class Wolf_Param(wx.Frame):
|
|
110
110
|
**FR**
|
111
111
|
Gestion des paramètres au format WOLF.
|
112
112
|
|
113
|
-
Fichier texte
|
114
|
-
-------------
|
113
|
+
**Fichier texte**
|
115
114
|
|
116
|
-
Les fichiers '
|
115
|
+
Les fichiers '.param' sont des fichiers texte contenant des paramètres de type nom=valeur et compatibles avec les codes Fortran.
|
117
116
|
L'extension '.param.default' est utilisée pour stocker les paramètres par défaut.
|
118
117
|
|
119
118
|
Une autre extension est possible mais un fichier '.default' sera créé automatiquement si ce fichier n'existe pas.
|
@@ -124,8 +123,7 @@ class Wolf_Param(wx.Frame):
|
|
124
123
|
|
125
124
|
Les lignes débutant par '%' sont des commentaires. Il est possible d'ajouter du code JSON dans un commentaire. Pour cela, il faut ajouter '%json' au début de la ligne suivi d'un dictionnaire (e.g. %json{"Values":{'key1':1, 'key2':2}, "Full_Comment":"fullcomment"} ).
|
126
125
|
|
127
|
-
Organisation Python
|
128
|
-
-------------------
|
126
|
+
**Organisation Python**
|
129
127
|
|
130
128
|
L'objet Python est basé sur des dictionnaires Python. Un dictionnaire par groupe de paramètres.
|
131
129
|
|
@@ -138,14 +136,12 @@ class Wolf_Param(wx.Frame):
|
|
138
136
|
- comment : commentaire du paramètre (str) -- helpful to understand the parameter
|
139
137
|
- added_json : dictionnaire contenant des informations supplémentaires (optionnel) -- permet de stocker des informations supplémentaires sur le paramètre (ex : valeurs possibles, commentaires étendus, ...)
|
140
138
|
|
141
|
-
Dictionnaires
|
142
|
-
-------------
|
139
|
+
**Dictionnaires**
|
143
140
|
|
144
141
|
Il existe un dictionnaire de valeurs par défaut "myparams_default". Pour l'interaction Python-Fortran, c'est le Fortran qui écrit ces paramètres.
|
145
142
|
Il existe un dictionnaire de paramètres actifs "myparams". Il est utilisé pour stocker les paramètres modifiés par l'utilisateur. Normalement, seuls les paramètres modifiés par l'utilisateur sont stockés dans ce dictionnaire et sont écrits sur disque.
|
146
143
|
|
147
|
-
Groupe/Paramètre incrémentable
|
148
|
-
------------------------------
|
144
|
+
**Groupe/Paramètre incrémentable**
|
149
145
|
|
150
146
|
Il est également possible de définir des groupes ou des paramètres incrémentables.
|
151
147
|
Pour cela, dans le nom du groupe/paramètre, il faut ajouter, à l'emplacement souhaité du **numéro** du groupe/paramètre, des informations entre '$...$' :
|
@@ -160,14 +156,12 @@ class Wolf_Param(wx.Frame):
|
|
160
156
|
|
161
157
|
Les informations génériques sont stockées dans les dictionnaires "myIncGroup" et "myIncParam".
|
162
158
|
|
163
|
-
UI
|
164
|
-
--
|
159
|
+
**UI**
|
165
160
|
|
166
161
|
Une interface graphique est disponible pour modifier les paramètres. Elle est basée sur "wxPython" et la classe "wxPropertyGrid".
|
167
162
|
L'attribut wx_exists permet de savoir si wxPython est en cours d'excution ou non.
|
168
163
|
|
169
|
-
Accès aux données
|
170
|
-
-----------------
|
164
|
+
**Accès aux données**
|
171
165
|
|
172
166
|
Les paramètres sont accessibles via la procédure __getitem__ en fournissant un tuple (groupname, paramname).
|
173
167
|
Il est possible de modifier un paramètre via la procédure __setitem__.
|
@@ -186,10 +180,9 @@ class Wolf_Param(wx.Frame):
|
|
186
180
|
**EN**
|
187
181
|
Management of parameters in WOLF format.
|
188
182
|
|
189
|
-
Text File
|
190
|
-
----------
|
183
|
+
**Text File**
|
191
184
|
|
192
|
-
'
|
185
|
+
'.param' files are text files containing parameters in the name=value format and compatible with Fortran codes.
|
193
186
|
The '.param.default' extension is used to store default parameters.
|
194
187
|
|
195
188
|
Another extension is possible, but a '.default' file will be automatically created if this file does not exist.
|
@@ -200,8 +193,7 @@ class Wolf_Param(wx.Frame):
|
|
200
193
|
|
201
194
|
Lines starting with '%' are comments. It is possible to add JSON code in a comment. To do this, add '%json' at the beginning of the line followed by a dictionary (e.g., %json{"Values":{'key1':1, 'key2':2}, "Full_Comment":"fullcomment"}).
|
202
195
|
|
203
|
-
Python Organization
|
204
|
-
-------------------
|
196
|
+
**Python Organization**
|
205
197
|
|
206
198
|
The Python object is based on Python dictionaries. One dictionary per parameter group.
|
207
199
|
|
@@ -214,14 +206,12 @@ class Wolf_Param(wx.Frame):
|
|
214
206
|
- comment: parameter comment (str) -- helpful to understand the parameter
|
215
207
|
- added_json: dictionary containing additional information (optional) -- used to store additional information about the parameter (e.g., possible values, extended comments, ...)
|
216
208
|
|
217
|
-
Dictionaries
|
218
|
-
-------------
|
209
|
+
**Dictionaries**
|
219
210
|
|
220
211
|
There is a default values dictionary "myparams_default." For Python-Fortran interaction, Fortran writes these parameters.
|
221
212
|
There is an active parameters dictionary "myparams." It is used to store parameters modified by the user. Normally, only parameters modified by the user are stored in this dictionary and written to disk.
|
222
213
|
|
223
|
-
Incrementable Group/Parameter
|
224
|
-
------------------------------
|
214
|
+
**Incrementable Group/Parameter**
|
225
215
|
|
226
216
|
It is also possible to define incrementable groups or parameters.
|
227
217
|
To do this, in the group/parameter name, add information between '$...$' at the desired **number** location of the group/parameter:
|
@@ -236,14 +226,12 @@ class Wolf_Param(wx.Frame):
|
|
236
226
|
|
237
227
|
Generic information is stored in the "myIncGroup" and "myIncParam" dictionaries.
|
238
228
|
|
239
|
-
UI
|
240
|
-
--
|
229
|
+
**UI**
|
241
230
|
|
242
231
|
A graphical interface is available to modify parameters. It is based on "wxPython" and the "wxPropertyGrid" class.
|
243
232
|
The wx_exists attribute indicates whether wxPython is currently running or not.
|
244
233
|
|
245
|
-
Data Access
|
246
|
-
-----------------
|
234
|
+
**Data Access**
|
247
235
|
|
248
236
|
Parameters are accessible via the __getitem__ method by providing a tuple (groupname, paramname).
|
249
237
|
It is possible to modify a parameter via the __setitem__ method.
|
@@ -258,7 +246,7 @@ class Wolf_Param(wx.Frame):
|
|
258
246
|
- for an incrementable parameter, by providing the necessary data in a string $n(refname,min,max)$ or $n(groupname,refname,min,max)$
|
259
247
|
- if the targeted group does not exist, it will be created if all information is available.
|
260
248
|
- only add an incrementable parameter via the add_IncParam method.
|
261
|
-
|
249
|
+
|
262
250
|
"""
|
263
251
|
|
264
252
|
# Définition des propriétés
|
wolfhece/PyPictures.py
CHANGED
@@ -19,48 +19,51 @@ class Picture(wx.Frame):
|
|
19
19
|
def __init__(self, *args, **kw):
|
20
20
|
super().__init__(*args, **kw)
|
21
21
|
|
22
|
-
|
23
|
-
# Spatial Reference System
|
24
|
-
inputEPSG = 4326 #WGS84
|
25
|
-
outputEPSG = 31370 #Lambert72
|
26
|
-
|
27
|
-
# create coordinate transformation
|
28
|
-
inSpatialRef = osr.SpatialReference()
|
29
|
-
inSpatialRef.ImportFromEPSG(inputEPSG)
|
30
|
-
|
31
|
-
outSpatialRef = osr.SpatialReference()
|
32
|
-
outSpatialRef.ImportFromEPSG(outputEPSG)
|
33
|
-
|
34
|
-
coordTransform = osr.CoordinateTransformation(inSpatialRef, outSpatialRef)
|
35
|
-
|
36
|
-
dir = path.normpath(r'D:\OneDrive\OneDrive - Universite de Liege\Crues\2021-07 Vesdre\CSC - Convention - ARNE\3 noeuds critiques\tronçon 34')
|
37
|
-
|
38
|
-
for curfile in listdir(dir):
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
22
|
+
def main():
|
23
|
+
# Spatial Reference System
|
24
|
+
inputEPSG = 4326 #WGS84
|
25
|
+
outputEPSG = 31370 #Lambert72
|
26
|
+
|
27
|
+
# create coordinate transformation
|
28
|
+
inSpatialRef = osr.SpatialReference()
|
29
|
+
inSpatialRef.ImportFromEPSG(inputEPSG)
|
30
|
+
|
31
|
+
outSpatialRef = osr.SpatialReference()
|
32
|
+
outSpatialRef.ImportFromEPSG(outputEPSG)
|
33
|
+
|
34
|
+
coordTransform = osr.CoordinateTransformation(inSpatialRef, outSpatialRef)
|
35
|
+
|
36
|
+
dir = path.normpath(r'D:\OneDrive\OneDrive - Universite de Liege\Crues\2021-07 Vesdre\CSC - Convention - ARNE\3 noeuds critiques\tronçon 34')
|
37
|
+
|
38
|
+
for curfile in listdir(dir):
|
39
|
+
filename,fileextent = path.splitext(curfile)
|
40
|
+
if fileextent.lower()=='.jpg':
|
41
|
+
img = Image(path.join(dir,curfile))
|
42
|
+
|
43
|
+
if img.get('Lambert72X'):
|
44
|
+
x = img.get('Lambert72X')
|
45
|
+
y = img.get('Lambert72Y')
|
46
|
+
|
47
|
+
elif img.get('gps_latitude'):
|
48
|
+
lat=img.gps_latitude
|
49
|
+
lon=img.gps_longitude
|
50
|
+
alt=img.gps_altitude
|
51
|
+
|
52
|
+
# create a geometry from coordinates
|
53
|
+
point = ogr.Geometry(ogr.wkbPoint)
|
54
|
+
if len(lat)==3:
|
55
|
+
lat = lat[0]+lat[1]/60+lat[2]/(60*60)
|
56
|
+
lon = lon[0]+lon[1]/60+lon[2]/(60*60)
|
57
|
+
point.AddPoint(lat, lon)
|
58
|
+
# transform point
|
59
|
+
point.Transform(coordTransform)
|
60
|
+
# print point in EPSG 31370
|
61
|
+
print(point.GetX(), point.GetY())
|
62
|
+
img.set('Lambert72X',point.GetX())
|
63
|
+
img.set('Lambert72Y',point.GetY())
|
64
|
+
|
65
|
+
with open(path.join(dir,'modified_image.jpg'), 'wb') as new_image_file:
|
66
|
+
new_image_file.write(img.get_file())
|
67
|
+
|
68
|
+
if __name__ == '__main__':
|
69
|
+
main()
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -2928,12 +2928,10 @@ class zone:
|
|
2928
2928
|
|
2929
2929
|
Retourne un dictionnaire contenant les valeurs pour chaque polygone
|
2930
2930
|
|
2931
|
-
*****
|
2932
2931
|
ATTENTION :
|
2933
2932
|
Il est possible de choisir comme clé soit l'index du vecteur dans la zone, soit non nom
|
2934
2933
|
Si le nom est choisi, cela peut aboutir à une perte d'information car il n'y a pas de certitude que les noms de vecteur soient uniques
|
2935
2934
|
--> il est nécessaire que l'utilisateur soit conscient de cette possibilité
|
2936
|
-
*****
|
2937
2935
|
|
2938
2936
|
Les valeurs de chaque entrée du dict peuvent contenir une ou plusieurs listes en fonction du retour de la fonction de l'objet matriciel appelé
|
2939
2937
|
"""
|
@@ -3006,15 +3004,13 @@ class zone:
|
|
3006
3004
|
def plot_linked_polygons(self, fig, ax, linked_arrays:dict, linked_vec:dict=None, linestyle='-', onlymedian=False, withtopography = True, ds:float = None):
|
3007
3005
|
"""
|
3008
3006
|
Création d'un graphique sur base des polygones
|
3007
|
+
|
3009
3008
|
Chaque polygone se positionnera sur base de la valeur Z de ses vertices
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3009
|
+
- façon conventionnelle de définir une longueur
|
3010
|
+
- ceci est normalement fait lors de l'appel à 'create_polygon_from_parallel'
|
3011
|
+
- si les polygones sont créés manuellement, il faut donc prendre soin de fournir l'information adhoc ou alors utiliser l'rgument 'ds'
|
3013
3012
|
|
3014
|
-
|
3015
|
-
ATTENTION :
|
3016
|
-
Les coordonnées Z ne sont sauvegardées sur disque que si le fichier est 3D, autrement dit au format '.vecz'
|
3017
|
-
***
|
3013
|
+
ATTENTION : Les coordonnées Z ne sont sauvegardées sur disque que si le fichier est 3D, autrement dit au format '.vecz'
|
3018
3014
|
|
3019
3015
|
"""
|
3020
3016
|
colors=['red','blue','green','darkviolet','fuchsia','lime']
|
@@ -3202,19 +3198,18 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3202
3198
|
def __init__(self, filename='', ox:float=0., oy:float=0., tx:float=0., ty:float=0., parent=None, is2D=True, idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False) -> None:
|
3203
3199
|
"""
|
3204
3200
|
parent : soit une instance 'WolfMapViewer', soit une instance 'Ops_Array'
|
3205
|
-
|
3206
|
-
et obtenir diverses informations ou lancer des actions
|
3201
|
+
--> est utile pour transférer la propriété 'active_vector' et obtenir diverses informations ou lancer des actions
|
3207
3202
|
|
3208
|
-
wx_exists : si True --> permet l'affichage de la structure via WX car une app WX existe
|
3209
|
-
et est en cours d'exécution
|
3203
|
+
wx_exists : si True --> permet l'affichage de la structure via WX car une app WX existe et est en cours d'exécution
|
3210
3204
|
|
3211
3205
|
Si wx_exists alors on cherche une instance WolfMapViewer depuis le 'parent' --> set_mapviewer()
|
3212
3206
|
Dans ce cas, le parent doit posséder une routine du type 'get_mapviewer()'
|
3213
3207
|
|
3214
3208
|
Exemple :
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3209
|
+
|
3210
|
+
def get_mapviewer(self):
|
3211
|
+
# Retourne une instance WolfMapViewer
|
3212
|
+
return self.mapviewer
|
3218
3213
|
"""
|
3219
3214
|
|
3220
3215
|
Element_To_Draw.__init__(self, idx, plotted, mapviewer, need_for_wx)
|
@@ -4220,9 +4215,9 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4220
4215
|
"""
|
4221
4216
|
Récupération des valeurs sous toutes les matrices liées pour le vecteur actif
|
4222
4217
|
|
4223
|
-
Crée une nouvelle zone contenant une copie du vecteur
|
4224
|
-
|
4225
|
-
|
4218
|
+
Crée une nouvelle zone contenant une copie du vecteur.
|
4219
|
+
|
4220
|
+
Le nombre de vertices est adapté pour correspondre au mieux à la matrice de liée et ne pas perdre, si possible, d'information.
|
4226
4221
|
"""
|
4227
4222
|
if self.parent is not None:
|
4228
4223
|
if self.verify_activevec():
|
wolfhece/apps/curvedigitizer.py
CHANGED
@@ -11,6 +11,7 @@ import matplotlib.image as mpimg
|
|
11
11
|
def main():
|
12
12
|
"""
|
13
13
|
Main function of curve digitizer
|
14
|
+
|
14
15
|
"""
|
15
16
|
plt.ion()
|
16
17
|
ex = wx.App()
|
@@ -110,7 +111,9 @@ def getReferenceLength(index):
|
|
110
111
|
Get the reference length in the requested direction
|
111
112
|
|
112
113
|
USAGE: factor = getReferenceLength(index)
|
113
|
-
|
114
|
+
|
115
|
+
:param index : 0 for x-direction or 1 for y-direction
|
116
|
+
|
114
117
|
"""
|
115
118
|
|
116
119
|
# define a 'direction' string
|
@@ -16,10 +16,11 @@ except:
|
|
16
16
|
from wolfhece.wolf_array import WolfArray
|
17
17
|
|
18
18
|
def main(mydir:Path=None, ListArrays:list[WolfArray]=None):
|
19
|
-
"""
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
"""
|
20
|
+
Comparaison de 2 cartes WOLF
|
21
|
+
|
22
|
+
:param mydir : répertoire contenant 2 matrices WOLF (ref.bin et comp.bin) et leurs fichiers accompagant
|
23
|
+
:param ListArrays : liste de 2 objets WolfArray
|
23
24
|
"""
|
24
25
|
if mydir is not None:
|
25
26
|
assert isinstance(mydir,Path), _('mydir must be a Path object')
|
@@ -32,7 +33,7 @@ def main(mydir:Path=None, ListArrays:list[WolfArray]=None):
|
|
32
33
|
assert isinstance(ListArrays,list), _('ListArrays must be a list')
|
33
34
|
assert len(ListArrays)==2, _('ListArrays must contain 2 WolfArray objects')
|
34
35
|
assert isinstance(ListArrays[0],WolfArray), _('ListArrays must contain 2 WolfArray objects')
|
35
|
-
assert isinstance(ListArrays[1],WolfArray), _('ListArrays must contain 2 WolfArray objects')
|
36
|
+
assert isinstance(ListArrays[1],WolfArray), _('ListArrays must contain 2 WolfArray objects')
|
36
37
|
|
37
38
|
#Déclaration de l'App WX
|
38
39
|
ex = wx.App()
|
@@ -76,13 +77,16 @@ def main(mydir:Path=None, ListArrays:list[WolfArray]=None):
|
|
76
77
|
ex.MainLoop()
|
77
78
|
|
78
79
|
if __name__=='__main__':
|
79
|
-
"""
|
80
|
+
"""
|
81
|
+
Gestion de l'éxécution du module en tant que code principal
|
82
|
+
|
83
|
+
"""
|
80
84
|
# total arguments
|
81
85
|
n = len(sys.argv)
|
82
86
|
# arguments
|
83
87
|
print("Total arguments passed:", n)
|
84
88
|
assert n in [2,3], _('Usage : wolfcompare <directory> or wolfcompare <file1> <file2>')
|
85
|
-
|
89
|
+
|
86
90
|
if n==2:
|
87
91
|
mydir = Path(sys.argv[1])
|
88
92
|
if mydir.exists():
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import wx
|
2
|
+
import numpy as np
|
3
|
+
import socket
|
4
|
+
|
5
|
+
class Server(wx.Frame):
|
6
|
+
|
7
|
+
def __init__(self, parent, title):
|
8
|
+
super(Server, self).__init__(parent, title=title, size=(300, 200))
|
9
|
+
self.panel = wx.Panel(self)
|
10
|
+
self.text_ctrl = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE)
|
11
|
+
self.button = wx.Button(self.panel, label="Send Matrix")
|
12
|
+
self.button.Bind(wx.EVT_BUTTON, self.on_send_matrix)
|
13
|
+
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
14
|
+
self.sizer.Add(self.text_ctrl, proportion=1, flag=wx.EXPAND)
|
15
|
+
self.sizer.Add(self.button, proportion=0, flag=wx.EXPAND)
|
16
|
+
self.panel.SetSizer(self.sizer)
|
17
|
+
self.Show()
|
18
|
+
|
19
|
+
def on_send_matrix(self, event):
|
20
|
+
matrix = np.random.rand(3, 3) # Example of a random matrix
|
21
|
+
self.text_ctrl.SetValue(str(matrix))
|
22
|
+
|
23
|
+
# Send matrix to client
|
24
|
+
host = '192.168.0.100' # Replace with the IP address of the client PC
|
25
|
+
port = 12345 # Choose a suitable port number
|
26
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
27
|
+
s.connect((host, port))
|
28
|
+
s.sendall(str(matrix).encode())
|
29
|
+
|
30
|
+
class Client(wx.Frame):
|
31
|
+
def __init__(self, parent, title):
|
32
|
+
super(Client, self).__init__(parent, title=title, size=(300, 200))
|
33
|
+
self.panel = wx.Panel(self)
|
34
|
+
self.text_ctrl = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE)
|
35
|
+
self.button = wx.Button(self.panel, label="Receive Matrix")
|
36
|
+
self.button.Bind(wx.EVT_BUTTON, self.on_receive_matrix)
|
37
|
+
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
38
|
+
self.sizer.Add(self.text_ctrl, proportion=1, flag=wx.EXPAND)
|
39
|
+
self.sizer.Add(self.button, proportion=0, flag=wx.EXPAND)
|
40
|
+
self.panel.SetSizer(self.sizer)
|
41
|
+
self.Show()
|
42
|
+
|
43
|
+
def on_receive_matrix(self, event):
|
44
|
+
host = '192.168.0.100' # Replace with the IP address of the server PC
|
45
|
+
port = 12345 # Choose the same port number used by the server
|
46
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
47
|
+
s.connect((host, port))
|
48
|
+
matrix_str = s.recv(1024).decode()
|
49
|
+
try:
|
50
|
+
matrix = np.array(eval(matrix_str))
|
51
|
+
self.text_ctrl.SetValue(str(matrix))
|
52
|
+
except:
|
53
|
+
self.text_ctrl.SetValue("Invalid matrix format")
|
54
|
+
|
55
|
+
def main():
|
56
|
+
app = wx.App()
|
57
|
+
Server(None, "Server")
|
58
|
+
Client(None, "Client")
|
59
|
+
app.MainLoop()
|
60
|
+
|
61
|
+
if __name__ == '__main__':
|
62
|
+
main()
|
wolfhece/friction_law.py
CHANGED
@@ -2,21 +2,23 @@ import math
|
|
2
2
|
|
3
3
|
def f_barr_bathurst(k_sur_D,reynolds):
|
4
4
|
"""
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
Evaluation du coefficient de frottement par Barr-Bathurst
|
6
|
+
:param k_sur_D : rugosité relative [-]
|
7
|
+
:param reynolds : nombre de Reynolds [-] au sens des conduites circulaires --> ATTENTION quand cette fonction est utilisée pour des écoulements à surface libre : Re_prim = 4*Re
|
8
|
+
|
9
|
+
@author Louis Goffin
|
10
|
+
@author Pierre Archambeau
|
11
|
+
|
12
|
+
source : TFE O. Machiels - "P:\Documentations\TFE\2008 - O. Machiels"
|
13
|
+
|
14
|
+
La formule habituelle de Barr s'écrit en canalisation (p24 du TFE): \f$ \frac{1}{{\sqrt f }} = - 2\log \left[ {\frac{{4,518\log \left( {\frac{{{Re} }}{7}} \right)}}{{{Re} \left( {1 + \frac{{{{{Re} }^{0,52}}{{\left( {\frac{k}{D}} \right)}^{0,7}}}}{{29}}} \right)}} + \frac{k}{{3,7D}}} \right] \f$
|
15
|
+
|
16
|
+
Elle est étendue aux macro-rugosités via l'adjonction de la formule de Bathurst (!établie en surface libre!) (p27) : \f$ \sqrt {\frac{1}{f}} = - 1,987\log \frac{{{D_{84}}}}{{5,15h}} \f$
|
17
|
+
|
18
|
+
La jonction entre les 2 suit un polynôme : \f$ {\frac{1}{{\sqrt f }} = 1469,76{{\left( {\frac{k}{h}} \right)}^3} - 382,83{{\left( {\frac{k}{h}} \right)}^2} + 9,89\left( {\frac{k}{h}} \right) + 5,22\quad pour\quad 0,05 < \frac{k}{h} < 0,15} \f$
|
19
|
+
|
20
|
+
@remark Les bornes de validité des lois sont exprimées en k_sur_h, c'est-à-dire en 4*k_sur_D
|
21
|
+
|
20
22
|
"""
|
21
23
|
k_sur_h = 4.0*k_sur_D
|
22
24
|
|
@@ -43,19 +45,21 @@ def f_barr_bathurst(k_sur_D,reynolds):
|
|
43
45
|
|
44
46
|
def f_colebrook(k_sur_D,reynolds):
|
45
47
|
"""
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
48
|
+
Evaluation du coefficient de frottement par Colebrook
|
49
|
+
|
50
|
+
:param k_sur_D : rugosité relative [-]
|
51
|
+
:param reynolds : nombre de Reynolds [-] au sens des conduites circulaires --> ATTENTION quand cette fonction est utilisée pour des écoulements à surface libre : Re_prim = 4*Re
|
52
|
+
|
53
|
+
@author Pierre Archambeau
|
54
|
+
|
55
|
+
Formule implicite de Colebrook : \f$ \sqrt {\frac{1}{f}} = - 2\log \left[ {\frac{k}{{3,7D}} + \frac{{2,51}}{{Re \sqrt f }}} \right] = - 2\log \left[ {\frac{k}{{14,8{R_h}}} + \frac{{2,51}}{{Re \sqrt f }}} \right] \f$
|
56
|
+
|
57
|
+
Frottement laminaire en section circulaire \f$ \frac{64}{Re} \f$
|
58
|
+
|
59
|
+
Transition par combinaison linéaire entre \f$ 800<Re<1000 \f$
|
60
|
+
|
61
|
+
@remark Une transition est assurée entre laminaire et turbulent afin de pouvoir utiliser cette fonction dans des procédures itératives
|
62
|
+
du type Newton-Raphson qui supportent très mal les fonctions discontinues
|
59
63
|
|
60
64
|
"""
|
61
65
|
|
@@ -81,12 +85,13 @@ def f_colebrook(k_sur_D,reynolds):
|
|
81
85
|
|
82
86
|
def f_colebrook_pure(k_sur_D,reynolds):
|
83
87
|
"""
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
Evaluation du coefficient de frottement par Colebrook - pas de test si laminaire
|
89
|
+
:param k_sur_D : rugosité relative [-]
|
90
|
+
:param reynolds : nombre de Reynolds [-] au sens des conduites circulaires --> ATTENTION quand cette fonction est utilisée pour des écoulements à surface libre : Re_prim = 4*Re
|
91
|
+
|
92
|
+
@author Pierre Archambeau
|
93
|
+
|
94
|
+
Formule implicite de Colebrook : \f$ \sqrt {\frac{1}{f}} = - 2\log \left[ {\frac{k}{{3,7D}} + \frac{{2,51}}{{Re \sqrt f }}} \right] = - 2\log \left[ {\frac{k}{{14,8{R_h}}} + \frac{{2,51}}{{Re \sqrt f }}} \right] \f$
|
90
95
|
"""
|
91
96
|
|
92
97
|
# !TURBULENT
|