wolfhece 2.0.17__py3-none-any.whl → 2.0.19__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/PyDraw.py +80 -8
- wolfhece/PyHydrographs.py +2 -2
- wolfhece/PyParams.py +113 -35
- wolfhece/PyPictures.py +48 -45
- wolfhece/PyVertex.py +149 -18
- wolfhece/PyVertexvectors.py +40 -33
- 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/lazviewer/laz_viewer.py +4 -1
- wolfhece/mar/Interface_MAR_WOLF_objet.py +260 -161
- wolfhece/opengl/py3d.py +4 -4
- 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 +47 -18
- wolfhece/wolfresults_2D.py +2 -4
- {wolfhece-2.0.17.dist-info → wolfhece-2.0.19.dist-info}/METADATA +7 -1
- {wolfhece-2.0.17.dist-info → wolfhece-2.0.19.dist-info}/RECORD +36 -41
- 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.17.dist-info → wolfhece-2.0.19.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.17.dist-info → wolfhece-2.0.19.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.17.dist-info → wolfhece-2.0.19.dist-info}/top_level.txt +0 -0
@@ -2,60 +2,65 @@ import numpy as np
|
|
2
2
|
import ctypes as ct
|
3
3
|
from tools import make_nd_array
|
4
4
|
|
5
|
-
"""
|
6
|
-
Création d'un matrice numpy depui un buffer/adresse mémoire
|
7
|
-
"""
|
8
5
|
|
9
|
-
|
6
|
+
def main():
|
7
|
+
"""
|
8
|
+
Création d'un matrice numpy depui un buffer/adresse mémoire
|
9
|
+
"""
|
10
10
|
|
11
|
-
|
12
|
-
# see : https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ctypes.html
|
13
|
-
q = make_nd_array(a.ctypes.data, a.shape)
|
11
|
+
a = np.zeros((10,10))
|
14
12
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
addr_p = list(p.contents._b_base_._objects.values())[0].value
|
19
|
-
# mais il y a plus simple ...
|
20
|
-
addr_p_2 = ct.addressof(p.contents)
|
13
|
+
# a.ctypes.data => int, buffer's memory address
|
14
|
+
# see : https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ctypes.html
|
15
|
+
q = make_nd_array(a.ctypes.data, a.shape)
|
21
16
|
|
22
|
-
|
17
|
+
# récupération de la structure ct.pointer pointant vers l'espace de stockage de l'objet numpy "a"'
|
18
|
+
p = a.ctypes.data_as(ct.POINTER(ct.c_double))
|
19
|
+
# récupération de l'adresse mémoire dans la structure ctypes.pointer
|
20
|
+
addr_p = list(p.contents._b_base_._objects.values())[0].value
|
21
|
+
# mais il y a plus simple ...
|
22
|
+
addr_p_2 = ct.addressof(p.contents)
|
23
23
|
|
24
|
-
|
25
|
-
print(addr_p, a.ctypes.data)
|
26
|
-
assert a.ctypes.data == addr_p, 'Not the same address'
|
24
|
+
assert addr_p == addr_p_2
|
27
25
|
|
28
|
-
|
29
|
-
|
26
|
+
# comparaison avec l'adresse mémoire du buffer de a
|
27
|
+
print(addr_p, a.ctypes.data)
|
28
|
+
assert a.ctypes.data == addr_p, 'Not the same address'
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
g=make_nd_array(addr_p, [10,10], dtype=np.float64, own_data=True , readonly=False, order='F')
|
30
|
+
c=make_nd_array(addr_p, [10,10], dtype=np.float64, own_data=False, readonly=False, order='F')
|
31
|
+
d=make_nd_array(addr_p, [10,10], dtype=np.float64, own_data=True , readonly=False, order='F')
|
34
32
|
|
35
|
-
|
36
|
-
|
33
|
+
e=make_nd_array(addr_p, [10,10], dtype=np.float64, own_data=False, readonly=True, order='F')
|
34
|
+
f=make_nd_array(addr_p, [10,10], dtype=np.float64, own_data=True , readonly=True, order='F')
|
35
|
+
g=make_nd_array(addr_p, [10,10], dtype=np.float64, own_data=True , readonly=False, order='F')
|
37
36
|
|
38
|
-
assert
|
39
|
-
assert
|
40
|
-
assert g.flags.writeable == True, 'Array "g" is in read only mode'
|
37
|
+
assert c.ctypes.data == a.ctypes.data, 'Not the same address'
|
38
|
+
assert d.ctypes.data != a.ctypes.data, 'Same address'
|
41
39
|
|
40
|
+
assert e.flags.writeable == False, 'Array "e" is in read/write mode'
|
41
|
+
assert f.flags.writeable == False, 'Array "f" is in read/write mode'
|
42
|
+
assert g.flags.writeable == True, 'Array "g" is in read only mode'
|
42
43
|
|
43
|
-
# Initialisation d'une Numpy array as 'C' order or 'F' order
|
44
|
-
a = np.zeros((10,10), dtype=np.float64, order='C') # default order == 'C'
|
45
|
-
a[:,1:]=3.
|
46
44
|
|
47
|
-
|
48
|
-
|
45
|
+
# Initialisation d'une Numpy array as 'C' order or 'F' order
|
46
|
+
a = np.zeros((10,10), dtype=np.float64, order='C') # default order == 'C'
|
47
|
+
a[:,1:]=3.
|
49
48
|
|
50
|
-
|
51
|
-
|
49
|
+
h=make_nd_array(a.ctypes.data, [10,1], dtype=np.float64, own_data=True , readonly=False, order='F') # première ligne
|
50
|
+
# h = [0,3,3,3,3,3,3,3,3,3,3]
|
52
51
|
|
53
|
-
|
54
|
-
|
52
|
+
assert h.shape==(10,1)
|
53
|
+
assert (h == np.asarray([[0.],[3.],[3.],[3.],[3.],[3.],[3.],[3.],[3.],[3.]])).all()
|
55
54
|
|
56
|
-
|
57
|
-
|
55
|
+
a = np.zeros((10,10), dtype=np.float64, order='F')
|
56
|
+
a[:,1:]=3.
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
i=make_nd_array(a.ctypes.data, [10,1], dtype=np.float64, own_data=True , readonly=False, order='F') # première colonne
|
59
|
+
# i = [0,0,0,0,0,0,0,0,0,0]
|
60
|
+
|
61
|
+
assert i.shape==(10,1)
|
62
|
+
assert (i == np.asarray([0.,0.,0.,0.,0.,0.,0.,0.,0.,0.])).all()
|
63
|
+
assert (i == np.asarray([[0.],[0.],[0.],[0.],[0.],[0.],[0.],[0.],[0.],[0.]])).all()
|
64
|
+
|
65
|
+
if __name__ == '__main__':
|
66
|
+
main()
|
@@ -2,117 +2,121 @@ import numpy as np
|
|
2
2
|
import ctypes as ct
|
3
3
|
from tools import make_nd_array
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def main():
|
6
|
+
"""
|
7
|
+
Les matrices Numpy gardent-elles le même espace mémoire (buffer) lors des opérations méthématiques ??
|
8
|
+
Une tentative d'analyse sur base de quelques exemples simples ...
|
8
9
|
|
9
|
-
ATTENTION notammment à :
|
10
|
-
|
11
|
-
|
10
|
+
ATTENTION notammment à :
|
11
|
+
- la diférence de comportement entre "a += 3" et "a = a + 3"
|
12
|
+
- la diférence de comportement entre "a[:,:] = a[:,:] + 3" et "a = a + 3"
|
12
13
|
|
13
|
-
Lire : https://numpy.org/doc/stable/reference/ufuncs.html
|
14
|
-
"""
|
15
|
-
a = np.zeros((10,10))
|
16
|
-
b = a # b is an alias --> share memory
|
17
|
-
c = a.copy() # c is a copy --> not share memory
|
14
|
+
Lire : https://numpy.org/doc/stable/reference/ufuncs.html
|
15
|
+
"""
|
16
|
+
a = np.zeros((10,10))
|
17
|
+
b = a # b is an alias --> share memory
|
18
|
+
c = a.copy() # c is a copy --> not share memory
|
18
19
|
|
19
|
-
id_a = id(a) # memory address
|
20
|
-
id_b = id(b) # memory address
|
21
|
-
id_c = id(c) # memory address
|
20
|
+
id_a = id(a) # memory address
|
21
|
+
id_b = id(b) # memory address
|
22
|
+
id_c = id(c) # memory address
|
22
23
|
|
23
|
-
if id(b) == id(a):
|
24
|
-
|
24
|
+
if id(b) == id(a):
|
25
|
+
print('1) a vs b - egalize -- Same memory address')
|
25
26
|
|
26
|
-
if id(c) != id(a):
|
27
|
-
|
27
|
+
if id(c) != id(a):
|
28
|
+
print('2) a vs c - egalize copy -- Not the same memory address')
|
28
29
|
|
29
|
-
c+=4
|
30
|
-
a=c.copy()
|
31
|
-
if id_a != id(c):
|
32
|
-
|
30
|
+
c+=4
|
31
|
+
a=c.copy()
|
32
|
+
if id_a != id(c):
|
33
|
+
print('3) a vs a (from c) - egalize copy -- Not the same memory address')
|
33
34
|
|
34
|
-
# reset
|
35
|
-
a=b
|
35
|
+
# reset
|
36
|
+
a=b
|
36
37
|
|
37
|
-
a += 3
|
38
|
-
id_newa = id(a) # memory address
|
39
|
-
if id_newa == id_a:
|
40
|
-
|
38
|
+
a += 3
|
39
|
+
id_newa = id(a) # memory address
|
40
|
+
if id_newa == id_a:
|
41
|
+
print('4) a vs a - += 3 -- Same memory address')
|
41
42
|
|
42
|
-
a[:,:] = a[:,:] + 3
|
43
|
-
id_newa = id(a) # memory address
|
43
|
+
a[:,:] = a[:,:] + 3
|
44
|
+
id_newa = id(a) # memory address
|
44
45
|
|
45
|
-
if id_newa == id_a:
|
46
|
-
|
46
|
+
if id_newa == id_a:
|
47
|
+
print('5) a vs a - [:,:] + 3 -- Same memory address')
|
47
48
|
|
48
|
-
a = a + 3
|
49
|
-
id_newa2 = id(a) # memory address
|
50
|
-
if id_newa2 != id_a:
|
51
|
-
|
49
|
+
a = a + 3
|
50
|
+
id_newa2 = id(a) # memory address
|
51
|
+
if id_newa2 != id_a:
|
52
|
+
print('6) a vs new_a_2 - = +3 -- Not the same memory address')
|
52
53
|
|
53
|
-
b = a + 3
|
54
|
-
if id(b) != id(a):
|
55
|
-
|
54
|
+
b = a + 3
|
55
|
+
if id(b) != id(a):
|
56
|
+
print('7) a vs b - addition -- Not the same memory address')
|
56
57
|
|
57
|
-
# Adresse mémoire
|
58
|
+
# Adresse mémoire
|
58
59
|
|
59
|
-
a = np.zeros((10,10), dtype=np.float64)
|
60
|
-
mem_a = a.ctypes.data
|
61
|
-
a[:,1:]=3.
|
62
|
-
assert mem_a == a.ctypes.data
|
60
|
+
a = np.zeros((10,10), dtype=np.float64)
|
61
|
+
mem_a = a.ctypes.data
|
62
|
+
a[:,1:]=3.
|
63
|
+
assert mem_a == a.ctypes.data
|
63
64
|
|
64
65
|
|
65
|
-
# Créez deux matrices numpy distinctes avec des buffers mémoire séparés
|
66
|
-
matrix1 = np.array([[1, 2], [3, 4]])
|
67
|
-
matrix2 = np.array([[5, 6], [7, 8]])
|
66
|
+
# Créez deux matrices numpy distinctes avec des buffers mémoire séparés
|
67
|
+
matrix1 = np.array([[1, 2], [3, 4]])
|
68
|
+
matrix2 = np.array([[5, 6], [7, 8]])
|
68
69
|
|
69
|
-
buf_m1 = matrix1.ctypes.data
|
70
|
-
buf_m2 = matrix2.ctypes.data
|
70
|
+
buf_m1 = matrix1.ctypes.data
|
71
|
+
buf_m2 = matrix2.ctypes.data
|
71
72
|
|
72
|
-
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 ne sont pas affectés)
|
73
|
-
matrix2[:] = matrix1
|
73
|
+
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 ne sont pas affectés)
|
74
|
+
matrix2[:] = matrix1
|
74
75
|
|
75
|
-
assert buf_m1 == matrix1.ctypes.data
|
76
|
-
assert buf_m2 == matrix2.ctypes.data
|
77
|
-
assert (matrix1 ==matrix2).all()
|
76
|
+
assert buf_m1 == matrix1.ctypes.data
|
77
|
+
assert buf_m2 == matrix2.ctypes.data
|
78
|
+
assert (matrix1 ==matrix2).all()
|
78
79
|
|
79
|
-
matrix1 = np.array([[1, 2], [3, 4]])
|
80
|
-
matrix2 = np.array([[5, 6], [7, 8]])
|
80
|
+
matrix1 = np.array([[1, 2], [3, 4]])
|
81
|
+
matrix2 = np.array([[5, 6], [7, 8]])
|
81
82
|
|
82
|
-
buf_m1 = matrix1.ctypes.data
|
83
|
-
buf_m2 = matrix2.ctypes.data
|
83
|
+
buf_m1 = matrix1.ctypes.data
|
84
|
+
buf_m2 = matrix2.ctypes.data
|
84
85
|
|
85
|
-
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 ne sont pas affectés)
|
86
|
-
matrix2[:] = matrix1.copy()
|
86
|
+
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 ne sont pas affectés)
|
87
|
+
matrix2[:] = matrix1.copy()
|
87
88
|
|
88
|
-
assert buf_m1 == matrix1.ctypes.data
|
89
|
-
assert buf_m2 == matrix2.ctypes.data
|
90
|
-
assert (matrix1 ==matrix2).all()
|
89
|
+
assert buf_m1 == matrix1.ctypes.data
|
90
|
+
assert buf_m2 == matrix2.ctypes.data
|
91
|
+
assert (matrix1 ==matrix2).all()
|
91
92
|
|
92
|
-
matrix1 = np.array([[1, 2], [3, 4]])
|
93
|
-
matrix2 = np.array([[5, 6], [7, 8]])
|
93
|
+
matrix1 = np.array([[1, 2], [3, 4]])
|
94
|
+
matrix2 = np.array([[5, 6], [7, 8]])
|
94
95
|
|
95
|
-
buf_m1 = matrix1.ctypes.data
|
96
|
-
buf_m2 = matrix2.ctypes.data
|
96
|
+
buf_m1 = matrix1.ctypes.data
|
97
|
+
buf_m2 = matrix2.ctypes.data
|
97
98
|
|
98
|
-
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 SONT affectés)
|
99
|
-
matrix2 = matrix1.copy()
|
99
|
+
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 SONT affectés)
|
100
|
+
matrix2 = matrix1.copy()
|
100
101
|
|
101
|
-
assert buf_m1 == matrix1.ctypes.data
|
102
|
-
assert buf_m2 != matrix2.ctypes.data
|
103
|
-
assert matrix2.ctypes.data != matrix1.ctypes.data
|
104
|
-
assert (matrix1 ==matrix2).all()
|
102
|
+
assert buf_m1 == matrix1.ctypes.data
|
103
|
+
assert buf_m2 != matrix2.ctypes.data
|
104
|
+
assert matrix2.ctypes.data != matrix1.ctypes.data
|
105
|
+
assert (matrix1 ==matrix2).all()
|
105
106
|
|
106
|
-
matrix1 = np.array([[1, 2], [3, 4]])
|
107
|
-
matrix2 = np.array([[5, 6], [7, 8]])
|
107
|
+
matrix1 = np.array([[1, 2], [3, 4]])
|
108
|
+
matrix2 = np.array([[5, 6], [7, 8]])
|
108
109
|
|
109
|
-
buf_m1 = matrix1.ctypes.data
|
110
|
-
buf_m2 = matrix2.ctypes.data
|
110
|
+
buf_m1 = matrix1.ctypes.data
|
111
|
+
buf_m2 = matrix2.ctypes.data
|
111
112
|
|
112
|
-
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 SONT affectés)
|
113
|
-
matrix2 = matrix1
|
113
|
+
# Copiez le contenu de matrix1 dans matrix2 (les buffers de matrix2 SONT affectés)
|
114
|
+
matrix2 = matrix1
|
114
115
|
|
115
|
-
assert buf_m1 == matrix1.ctypes.data
|
116
|
-
assert buf_m2 != matrix2.ctypes.data
|
117
|
-
assert matrix2.ctypes.data == matrix1.ctypes.data
|
118
|
-
assert (matrix1 ==matrix2).all()
|
116
|
+
assert buf_m1 == matrix1.ctypes.data
|
117
|
+
assert buf_m2 != matrix2.ctypes.data
|
118
|
+
assert matrix2.ctypes.data == matrix1.ctypes.data
|
119
|
+
assert (matrix1 ==matrix2).all()
|
120
|
+
|
121
|
+
if __name__ == "__main__":
|
122
|
+
main()
|
wolfhece/pythonfortran/tools.py
CHANGED
@@ -24,7 +24,7 @@ class Impose_Boundary_Conditions:
|
|
24
24
|
def impose_bc(self, simul:SimpleSimulation):
|
25
25
|
"""
|
26
26
|
FR
|
27
|
-
|
27
|
+
|
28
28
|
Cette fonction doit être particularisée afin d'appliquer des conditions aux limites à la simulation.
|
29
29
|
L'instance de simulation est passée en argument et ne doit pas être créee/modifiée.
|
30
30
|
|
@@ -37,7 +37,7 @@ class Impose_Boundary_Conditions:
|
|
37
37
|
Les directions sont soit "LEFT" ou "BOTTOM". L'énumération d'une cellule (i,j) permet donc d'imposer la condition sur le bord gauche de la cellule (i-1/2,j) et sur le bord bas de la cellule (i,j-1/2).
|
38
38
|
|
39
39
|
EN
|
40
|
-
|
40
|
+
|
41
41
|
This function must be specialized in order to apply boundary conditions to the simulation.
|
42
42
|
The simulation is passed as an argument and must not be created/modified.
|
43
43
|
|
@@ -50,7 +50,6 @@ class Impose_Boundary_Conditions:
|
|
50
50
|
The directions are either "LEFT" or "BOTTOM." Enumerating a cell (i, j) thus imposes the condition on the left edge of cell (i-1/2, j) and on the bottom edge of cell (i, j-1/2).
|
51
51
|
|
52
52
|
Exemple :
|
53
|
-
-------
|
54
53
|
|
55
54
|
# Weak Normal Froude condition (value 0.3) on the left edge of the cell (3,997) -> (3,1002)
|
56
55
|
for j in range(997,1003):
|
wolfhece/scenario/update_void.py
CHANGED
@@ -19,7 +19,7 @@ class Update_Sim:
|
|
19
19
|
def update_topobathy(self, topobahty:WolfArray):
|
20
20
|
"""
|
21
21
|
FR
|
22
|
-
|
22
|
+
|
23
23
|
Cette fonction doit être particularisée afin d'appliquer des modifications
|
24
24
|
à la topographie du lit majeur ou à la bathymétrie du lit mineur.
|
25
25
|
|
@@ -33,7 +33,7 @@ class Update_Sim:
|
|
33
33
|
Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'esace alloué.
|
34
34
|
|
35
35
|
EN
|
36
|
-
|
36
|
+
|
37
37
|
This function must be customized to apply modifications to the topography of the main bed or the bathymetry of the minor bed.
|
38
38
|
|
39
39
|
The basic information is located in the 'topobahty' parameter ('WolfArray' class).
|
@@ -50,7 +50,7 @@ class Update_Sim:
|
|
50
50
|
def update_manning(self, manning:WolfArray):
|
51
51
|
"""
|
52
52
|
FR
|
53
|
-
|
53
|
+
|
54
54
|
Cette fonction doit être particularisée afin d'appliquer des modifications
|
55
55
|
à la distribution du coefficient de Manning.
|
56
56
|
|
@@ -64,7 +64,7 @@ class Update_Sim:
|
|
64
64
|
Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'esace alloué.
|
65
65
|
|
66
66
|
EN
|
67
|
-
|
67
|
+
|
68
68
|
This function must be customized to apply modifications to the Manning roughness parameter.
|
69
69
|
|
70
70
|
The basic information is located in the 'manning' parameter ('WolfArray' class).
|
@@ -81,7 +81,7 @@ class Update_Sim:
|
|
81
81
|
def update_infiltration(self, infiltration_zones:WolfArray):
|
82
82
|
"""
|
83
83
|
FR
|
84
|
-
|
84
|
+
|
85
85
|
Cette fonction doit être particularisée afin d'appliquer des modifications
|
86
86
|
à la distribution des zones d'infiltration (matrice en Int32)
|
87
87
|
|
@@ -95,7 +95,7 @@ class Update_Sim:
|
|
95
95
|
Il n'est pas permis de remplacer la matrice (création d'une nouvelle matrice et/ou pointage d'una autre matrice). Toutes les operations doivent se faire dans l'esace alloué.
|
96
96
|
|
97
97
|
EN
|
98
|
-
|
98
|
+
|
99
99
|
This function must be customized to apply modifications to the Infiltration zones parameter.
|
100
100
|
|
101
101
|
The basic information is located in the 'infiltration_zones' parameter ('WolfArray' class).
|
wolfhece/wolf_array.py
CHANGED
@@ -3773,28 +3773,47 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3773
3773
|
else:
|
3774
3774
|
self.add_ops_sel()
|
3775
3775
|
|
3776
|
-
def compare_cloud(self,mycloud:cloud_vertices):
|
3776
|
+
def compare_cloud(self, mycloud:cloud_vertices, delta:list[float] = [.15, .5, 1.]):
|
3777
3777
|
"""
|
3778
3778
|
Graphique de comparaison des valeurs d'un nuage de points et des valeurs de la matrice sous les mêmes positions
|
3779
|
+
|
3780
|
+
:param mycloud: cloud_vertices
|
3781
|
+
:param delta: list of tolerance for the comparison
|
3782
|
+
|
3779
3783
|
"""
|
3784
|
+
|
3785
|
+
# Get the values of the cloud
|
3780
3786
|
xyz_cloud = mycloud.get_xyz()
|
3787
|
+
# Get values of the array at the same positions
|
3781
3788
|
zarray = np.array([self.get_value(curxy[0],curxy[1]) for curxy in xyz_cloud])
|
3782
3789
|
|
3790
|
+
# count the number of points outside the array
|
3783
3791
|
nbout = np.count_nonzero(zarray==-99999)
|
3784
3792
|
|
3793
|
+
# Get the values of the cloud that are not outside the array
|
3794
|
+
# Separate XY and Z values (cloud and array)
|
3795
|
+
# - z values
|
3785
3796
|
z_cloud = xyz_cloud[zarray!=-99999][:,2]
|
3797
|
+
# - xy values
|
3786
3798
|
xy_cloud = xyz_cloud[zarray!=-99999][:,:2]
|
3799
|
+
|
3800
|
+
# - array values
|
3787
3801
|
zarray = zarray[zarray!=-99999]
|
3788
3802
|
|
3803
|
+
# concatenate all z values
|
3789
3804
|
zall = np.concatenate([z_cloud,zarray])
|
3805
|
+
# find the min and max values
|
3790
3806
|
zmin = np.min(zall)
|
3791
3807
|
zmax = np.max(zall)
|
3792
3808
|
|
3809
|
+
# compute differences
|
3793
3810
|
diffz = zarray-z_cloud
|
3811
|
+
# choose a colormap
|
3794
3812
|
cmap = plt.cm.get_cmap('RdYlBu')
|
3795
3813
|
mindiff = np.min(diffz)
|
3796
3814
|
maxdiff = np.max(diffz)
|
3797
3815
|
|
3816
|
+
# Plot the differences [0] and the position [1]
|
3798
3817
|
fig,ax = plt.subplots(2,1)
|
3799
3818
|
ax[0].set_title(_('Comparison Z - ') + str(nbout) + _(' outside points on ') + str(len(xyz_cloud)))
|
3800
3819
|
sc0 = ax[0].scatter(z_cloud,zarray,s=10,c=diffz,cmap = cmap, vmin=mindiff, vmax=maxdiff)
|
@@ -3802,7 +3821,16 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3802
3821
|
ax[0].set_ylabel(_('Array values'))
|
3803
3822
|
ax[0].set_xlim([zmin,zmax])
|
3804
3823
|
ax[0].set_ylim([zmin,zmax])
|
3805
|
-
|
3824
|
+
|
3825
|
+
ax[0].plot([zmin,zmax],[zmin,zmax], color='black')
|
3826
|
+
|
3827
|
+
if delta is not None:
|
3828
|
+
if isinstance(delta, list):
|
3829
|
+
for idx, curdelta in enumerate(delta):
|
3830
|
+
curdelta = abs(float(curdelta))
|
3831
|
+
ax[0].plot([zmin,zmax],[zmin+delta,zmax+delta], 'k--', alpha=1.-1./(idx+1))
|
3832
|
+
ax[0].plot([zmin,zmax],[zmin-delta,zmax-delta], 'k--', alpha=1.-1./(idx+1))
|
3833
|
+
|
3806
3834
|
ax[0].axis('equal')
|
3807
3835
|
|
3808
3836
|
sc1 = ax[1].scatter(xy_cloud[:,0],xy_cloud[:,1],s=10,c=diffz,cmap = cmap, vmin=mindiff, vmax=maxdiff)
|
@@ -4825,8 +4853,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4825
4853
|
"""
|
4826
4854
|
Return the coordinates inside a polygon
|
4827
4855
|
|
4828
|
-
:param myvect
|
4829
|
-
:param usemask
|
4856
|
+
:param myvect : target vector
|
4857
|
+
:param usemask : limit potential nodes to unmaksed nodes
|
4830
4858
|
"""
|
4831
4859
|
|
4832
4860
|
myvect.find_minmax()
|
@@ -4848,8 +4876,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4848
4876
|
"""
|
4849
4877
|
Return the coordinates along a polyline
|
4850
4878
|
|
4851
|
-
:param myvect
|
4852
|
-
:param usemask
|
4879
|
+
:param myvect : target vector
|
4880
|
+
:param usemask : limit potential nodes to unmaksed nodes
|
4853
4881
|
"""
|
4854
4882
|
|
4855
4883
|
allij = self.get_ij_under_polyline(myvect, usemask)
|
@@ -4861,8 +4889,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4861
4889
|
"""
|
4862
4890
|
Return the indices inside a polygon
|
4863
4891
|
|
4864
|
-
:param myvect
|
4865
|
-
:param usemask
|
4892
|
+
:param myvect : target vector
|
4893
|
+
:param usemask : limit potential nodes to unmaksed nodes
|
4866
4894
|
"""
|
4867
4895
|
|
4868
4896
|
myvect.find_minmax()
|
@@ -4905,8 +4933,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4905
4933
|
"""
|
4906
4934
|
Récupération des valeurs contenues dans un polygone
|
4907
4935
|
|
4908
|
-
usemask (optional) restreint les éléments aux éléments non masqués de la matrice
|
4909
|
-
getxy (optional) retourne en plus les coordonnées des points
|
4936
|
+
:param usemask : (optional) restreint les éléments aux éléments non masqués de la matrice
|
4937
|
+
:param getxy : (optional) retourne en plus les coordonnées des points
|
4910
4938
|
"""
|
4911
4939
|
mypoints = self.get_xy_inside_polygon(myvect, usemask)
|
4912
4940
|
myvalues = np.asarray([self.get_value(cur[0], cur[1]) for cur in mypoints])
|
@@ -4920,8 +4948,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4920
4948
|
"""
|
4921
4949
|
Récupération des valeurs contenues sous une polyligne
|
4922
4950
|
|
4923
|
-
usemask (optional) restreint les éléments aux éléments non masqués de la matrice
|
4924
|
-
getxy (optional) retourne en plus les coordonnées des points
|
4951
|
+
:param usemask : (optional) restreint les éléments aux éléments non masqués de la matrice
|
4952
|
+
:param getxy : (optional) retourne en plus les coordonnées des points
|
4925
4953
|
"""
|
4926
4954
|
mypoints = self.get_xy_under_polyline(myvect, usemask)
|
4927
4955
|
|
@@ -4936,8 +4964,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4936
4964
|
"""
|
4937
4965
|
Récupération de toutes les valeurs contenues dans un polygone
|
4938
4966
|
|
4939
|
-
usemask (optional) restreint les éléments aux éléments non masqués de la matrice
|
4940
|
-
getxy (optional) retourne en plus les coordonnées des points
|
4967
|
+
:param usemask : (optional) restreint les éléments aux éléments non masqués de la matrice
|
4968
|
+
:param getxy : (optional) retourne en plus les coordonnées des points
|
4941
4969
|
|
4942
4970
|
ICI on retourne le résultat de get_values_insidepoly, car une seule matrice, mais une autre classe pourrait vouloir faure autre chose
|
4943
4971
|
C'est le cas notamment de Wolfresults_2D
|
@@ -4949,8 +4977,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4949
4977
|
"""
|
4950
4978
|
Récupération de toutes les valeurs sous la polyligne
|
4951
4979
|
|
4952
|
-
usemask (optional) restreint les éléments aux éléments non masqués de la matrice
|
4953
|
-
getxy (optional) retourne en plus les coordonnées des points
|
4980
|
+
:param usemask : (optional) restreint les éléments aux éléments non masqués de la matrice
|
4981
|
+
:param getxy : (optional) retourne en plus les coordonnées des points
|
4954
4982
|
|
4955
4983
|
ICI on retourne le résultat de get_values_underpoly, car une seule matrice, mais une autre classe pourrait vouloir faure autre chose
|
4956
4984
|
C'est le cas notamment de Wolfresults_2D
|
@@ -6931,8 +6959,9 @@ class WolfArrayMNAP(WolfArrayMB):
|
|
6931
6959
|
class WolfArray_Sim2D(WolfArray):
|
6932
6960
|
"""
|
6933
6961
|
Surcharge de WolfArray pour les matrices fines de simulation
|
6934
|
-
|
6935
|
-
|
6962
|
+
|
6963
|
+
Objectif : lier la matrice de mask à une source commune
|
6964
|
+
|
6936
6965
|
"""
|
6937
6966
|
def __init__(self,
|
6938
6967
|
fname:str=None,
|
wolfhece/wolfresults_2D.py
CHANGED
@@ -2723,10 +2723,8 @@ class Wolfresults_2D(Element_To_Draw):
|
|
2723
2723
|
|
2724
2724
|
which_block : numéro du bloc; 1-based;
|
2725
2725
|
|
2726
|
-
|
2727
|
-
|
2728
|
-
Les indices sont passés comme WOLF --> en numérottaion Fortran (démarrage à 1 et non à 0)
|
2729
|
-
***
|
2726
|
+
ATTENTION : Les indices sont passés comme WOLF --> en numérottaion Fortran (démarrage à 1 et non à 0)
|
2727
|
+
|
2730
2728
|
"""
|
2731
2729
|
k=-1
|
2732
2730
|
e=-1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wolfhece
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.19
|
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
|
@@ -53,6 +53,12 @@ Requires-Dist: h5py
|
|
53
53
|
Requires-Dist: basemap
|
54
54
|
Requires-Dist: exif
|
55
55
|
Requires-Dist: pyglm
|
56
|
+
Requires-Dist: mqtt
|
57
|
+
Requires-Dist: wradlib
|
58
|
+
Requires-Dist: seaborn
|
59
|
+
Requires-Dist: autograd
|
60
|
+
Requires-Dist: plyfile
|
61
|
+
Requires-Dist: tabulate
|
56
62
|
|
57
63
|
Ce paquet contient l'interface graphique Python du logiciel WOLF (HECE - ULiège) de même que plusieurs outils de traitements topographique, hydraulique et hydrologique.
|
58
64
|
|