wolfhece 2.0.13__py3-none-any.whl → 2.0.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyDraw.py +46 -11
- wolfhece/PyPalette.py +6 -0
- wolfhece/Results2DGPU.py +5 -1
- wolfhece/opengl/__init__.py +0 -0
- wolfhece/opengl/gl_utils.py +1544 -0
- wolfhece/opengl/py3d.py +1665 -0
- wolfhece/opengl/tile_packer.py +352 -0
- wolfhece/scenario/imposebc_void.py +6 -3
- wolfhece/scenario/update_void.py +6 -3
- wolfhece/shaders/fragment_shader_texture.glsl +12 -0
- wolfhece/shaders/geom_grid.glsl +32 -0
- wolfhece/shaders/quad_frag_shader.glsl +34 -0
- wolfhece/shaders/quad_geom_shader.glsl +234 -9
- wolfhece/shaders/quadpos_frag_shader.glsl +12 -0
- wolfhece/shaders/quadpos_geom_shader.glsl +76 -0
- wolfhece/shaders/simple_fragment_shader.glsl +4 -1
- wolfhece/shaders/simple_vertex_shader_mvp.glsl +13 -0
- wolfhece/shaders/vertex_shader_texture.glsl +15 -0
- wolfhece/wolf_array.py +52 -8
- wolfhece/wolfresults_2D.py +14 -12
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/METADATA +2 -1
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/RECORD +25 -14
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/top_level.txt +0 -0
@@ -1,33 +1,258 @@
|
|
1
1
|
#version 460 core
|
2
2
|
|
3
3
|
layout (points) in;
|
4
|
-
layout (triangle_strip, max_vertices =
|
4
|
+
layout (triangle_strip, max_vertices = 20) out;
|
5
5
|
|
6
|
-
uniform
|
6
|
+
uniform sampler2DRect zText;
|
7
7
|
uniform float zScale;
|
8
8
|
uniform float dx;
|
9
|
+
uniform float dy;
|
9
10
|
uniform float origx;
|
10
11
|
uniform float origy;
|
12
|
+
uniform float width;
|
13
|
+
uniform float height;
|
14
|
+
uniform mat4 mvp;
|
15
|
+
uniform int idx;
|
11
16
|
|
12
|
-
|
17
|
+
uniform sampler1D colorPalette; // Texture de gradient représentant la palette de couleurs
|
18
|
+
|
19
|
+
uniform int paletteSize; // Taille de la palette
|
20
|
+
uniform float colorValues[256]; // Tableau de couleurs de la palette
|
21
|
+
|
22
|
+
out vec3 ourColor;
|
23
|
+
out vec3 Normal; // Normale du fragment dans l'espace du monde
|
24
|
+
out vec4 FragPos; // Position du fragment dans l'espace du monde
|
25
|
+
out vec3 ourCoord;
|
26
|
+
|
27
|
+
vec3 mapColor(float zValue) {
|
28
|
+
float zColor = 0.0;
|
29
|
+
|
30
|
+
// Mapper la valeur sur base d'intervalles
|
31
|
+
if (zValue <= colorValues[0]) {
|
32
|
+
zColor = 0.0;
|
33
|
+
}
|
34
|
+
else if (zValue >= colorValues[paletteSize-1]) {
|
35
|
+
zColor = 1.0;
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
for (int i = 1; i < paletteSize; i++) {
|
39
|
+
if (zValue <= colorValues[i]) {
|
40
|
+
float lower = colorValues[i-1];
|
41
|
+
float upper = colorValues[i];
|
42
|
+
|
43
|
+
zColor = ((zValue - lower) / (upper - lower) + float(i-1)) / float(paletteSize-1);
|
44
|
+
|
45
|
+
break;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
// Interpoler entre les couleurs dans la palette
|
51
|
+
return texture(colorPalette, zColor).rgb;
|
52
|
+
}
|
53
|
+
|
54
|
+
float get_value(sampler2DRect tex, vec2 pos) {
|
55
|
+
|
56
|
+
float posx = (pos.x - origx) / dx;
|
57
|
+
float posy = (pos.y - origy) / dy;
|
58
|
+
|
59
|
+
vec2 texCoord = vec2(posx, posy);
|
60
|
+
|
61
|
+
float zValue = texture(tex, texCoord).r * zScale;
|
62
|
+
return zValue;
|
63
|
+
}
|
64
|
+
|
65
|
+
void horizontal(){
|
13
66
|
|
14
67
|
float halfdx = dx/2.0;
|
68
|
+
float halfdy = dy/2.0;
|
69
|
+
|
70
|
+
float zValue = get_value(zText, gl_in[0].gl_Position.xy);
|
71
|
+
float zColor = 0.0;
|
15
72
|
|
16
|
-
|
73
|
+
vec3 color = mapColor(zValue);
|
17
74
|
|
18
|
-
float
|
75
|
+
float posx = (gl_in[0].gl_Position.x - origx) / dx ;// /width;
|
76
|
+
float posy = (gl_in[0].gl_Position.y - origy) / dy ;// /height;
|
77
|
+
ourCoord = vec3(posx, posy, idx);
|
19
78
|
|
20
|
-
gl_Position = vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y -
|
79
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
80
|
+
ourColor = color;
|
81
|
+
Normal = vec3(0.0, 0.0, 1.0);
|
82
|
+
FragPos = vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
21
83
|
EmitVertex();
|
22
84
|
|
23
|
-
gl_Position = vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y -
|
85
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
86
|
+
ourColor = color;
|
87
|
+
Normal = vec3(0.0, 0.0, 1.0);
|
88
|
+
FragPos = vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
24
89
|
EmitVertex();
|
25
90
|
|
26
|
-
gl_Position = vec4(gl_in[0].gl_Position.x
|
91
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
92
|
+
ourColor = color;
|
93
|
+
Normal = vec3(0.0, 0.0, 1.0);
|
94
|
+
FragPos = vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
27
95
|
EmitVertex();
|
28
96
|
|
29
|
-
gl_Position = vec4(gl_in[0].gl_Position.x
|
97
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
98
|
+
ourColor = color;
|
99
|
+
Normal = vec3(0.0, 0.0, 1.0);
|
100
|
+
FragPos = vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
30
101
|
EmitVertex();
|
31
102
|
|
32
103
|
EndPrimitive();
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
void walls(){
|
108
|
+
|
109
|
+
float halfdx = dx/2.0;
|
110
|
+
float halfdy = dy/2.0;
|
111
|
+
|
112
|
+
vec2 posCenter = gl_in[0].gl_Position.xy;
|
113
|
+
vec2 posLeft = vec2(posCenter.x - dx, posCenter.y);
|
114
|
+
vec2 posRight = vec2(posCenter.x + dx, posCenter.y);
|
115
|
+
vec2 posUp = vec2(posCenter.x , posCenter.y + dy);
|
116
|
+
vec2 posDown = vec2(posCenter.x , posCenter.y - dy);
|
117
|
+
|
118
|
+
vec2 texCenter = vec2(((posCenter.x - origx) / dx ), ((posCenter.y - origy) / dy));
|
119
|
+
vec2 texLeft = vec2(((posLeft.x - origx) / dx ), ((posLeft.y - origy) / dy));
|
120
|
+
vec2 texRight = vec2(((posRight.x - origx) / dx ), ((posRight.y - origy) / dy));
|
121
|
+
vec2 texUp = vec2(((posUp.x - origx) / dx ), ((posUp.y - origy) / dy));
|
122
|
+
vec2 texDown = vec2(((posDown.x - origx) / dx ), ((posDown.y - origy) / dy));
|
123
|
+
|
124
|
+
// float zCenter = texture(zText, texCenter).r * zScale;
|
125
|
+
// float zLeft = texture(zText, texLeft).r * zScale;
|
126
|
+
// float zRight = texture(zText, texRight).r * zScale;
|
127
|
+
// float zUp = texture(zText, texUp).r * zScale;
|
128
|
+
// float zDown = texture(zText, texDown).r * zScale;
|
129
|
+
|
130
|
+
float zCenter = get_value(zText, posCenter);
|
131
|
+
float zLeft = get_value(zText, posLeft);
|
132
|
+
float zRight = get_value(zText, posRight);
|
133
|
+
float zUp = get_value(zText, posUp);
|
134
|
+
float zDown = get_value(zText, posDown);
|
135
|
+
|
136
|
+
if (zCenter > zLeft) {
|
137
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
138
|
+
ourColor = mapColor(zCenter);
|
139
|
+
Normal = vec3(-1.0, 0.0, 0.0);
|
140
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
141
|
+
EmitVertex();
|
142
|
+
|
143
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
144
|
+
ourColor = mapColor(zCenter);
|
145
|
+
Normal = vec3(-1.0, 0.0, 0.0);
|
146
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
147
|
+
EmitVertex();
|
148
|
+
|
149
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y - halfdy, zLeft, 1.0);
|
150
|
+
ourColor = mapColor(zLeft);
|
151
|
+
Normal = vec3(-1.0, 0.0, 0.0);
|
152
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y - halfdy, zLeft, 1.0);
|
153
|
+
EmitVertex();
|
154
|
+
|
155
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y + halfdy, zLeft, 1.0);
|
156
|
+
ourColor = mapColor(zLeft);
|
157
|
+
Normal = vec3(-1.0, 0.0, 0.0);
|
158
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y + halfdy, zLeft, 1.0);
|
159
|
+
EmitVertex();
|
160
|
+
|
161
|
+
EndPrimitive();
|
162
|
+
}
|
163
|
+
|
164
|
+
if (zCenter > zRight) {
|
165
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
166
|
+
ourColor = mapColor(zCenter);
|
167
|
+
Normal = vec3(1.0, 0.0, 0.0);
|
168
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
169
|
+
EmitVertex();
|
170
|
+
|
171
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
172
|
+
ourColor = mapColor(zCenter);
|
173
|
+
Normal = vec3(1.0, 0.0, 0.0);
|
174
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
175
|
+
EmitVertex();
|
176
|
+
|
177
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y - halfdy, zRight, 1.0);
|
178
|
+
ourColor = mapColor(zRight);
|
179
|
+
Normal = vec3(1.0, 0.0, 0.0);
|
180
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y - halfdy, zRight, 1.0);
|
181
|
+
EmitVertex();
|
182
|
+
|
183
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y + halfdy, zRight, 1.0);
|
184
|
+
ourColor = mapColor(zRight);
|
185
|
+
Normal = vec3(1.0, 0.0, 0.0);
|
186
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y + halfdy, zRight, 1.0);
|
187
|
+
EmitVertex();
|
188
|
+
|
189
|
+
EndPrimitive();
|
190
|
+
}
|
191
|
+
|
192
|
+
if (zCenter > zUp) {
|
193
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
194
|
+
ourColor = mapColor(zCenter);
|
195
|
+
Normal = vec3(0.0, 1.0, 0.0);
|
196
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
197
|
+
EmitVertex();
|
198
|
+
|
199
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
200
|
+
ourColor = mapColor(zCenter);
|
201
|
+
Normal = vec3(0.0, 1.0, 0.0);
|
202
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y + halfdy, zCenter, 1.0);
|
203
|
+
EmitVertex();
|
204
|
+
|
205
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y + halfdy, zUp, 1.0);
|
206
|
+
ourColor = mapColor(zUp);
|
207
|
+
Normal = vec3(0.0, 1.0, 0.0);
|
208
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y + halfdy, zUp, 1.0);
|
209
|
+
EmitVertex();
|
210
|
+
|
211
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y + halfdy, zUp, 1.0);
|
212
|
+
ourColor = mapColor(zUp);
|
213
|
+
Normal = vec3(0.0, 1.0, 0.0);
|
214
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y + halfdy, zUp, 1.0);
|
215
|
+
EmitVertex();
|
216
|
+
|
217
|
+
EndPrimitive();
|
218
|
+
}
|
219
|
+
|
220
|
+
if (zCenter > zDown) {
|
221
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
222
|
+
ourColor = mapColor(zCenter);
|
223
|
+
Normal = vec3(0.0, -1.0, 0.0);
|
224
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
225
|
+
EmitVertex();
|
226
|
+
|
227
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
228
|
+
ourColor = mapColor(zCenter);
|
229
|
+
Normal = vec3(0.0, -1.0, 0.0);
|
230
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y - halfdy, zCenter, 1.0);
|
231
|
+
EmitVertex();
|
232
|
+
|
233
|
+
gl_Position = mvp * vec4(posCenter.x - halfdx, posCenter.y - halfdy, zDown, 1.0);
|
234
|
+
ourColor = mapColor(zDown);
|
235
|
+
Normal = vec3(0.0, -1.0, 0.0);
|
236
|
+
FragPos = vec4(posCenter.x - halfdx, posCenter.y - halfdy, zDown, 1.0);
|
237
|
+
EmitVertex();
|
238
|
+
|
239
|
+
gl_Position = mvp * vec4(posCenter.x + halfdx, posCenter.y - halfdy, zDown, 1.0);
|
240
|
+
ourColor = mapColor(zDown);
|
241
|
+
Normal = vec3(0.0, -1.0, 0.0);
|
242
|
+
FragPos = vec4(posCenter.x + halfdx, posCenter.y - halfdy, zDown, 1.0);
|
243
|
+
EmitVertex();
|
244
|
+
|
245
|
+
EndPrimitive();
|
246
|
+
}
|
247
|
+
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
void main() {
|
253
|
+
|
254
|
+
horizontal();
|
255
|
+
walls();
|
256
|
+
|
257
|
+
|
33
258
|
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#version 460 core
|
2
|
+
|
3
|
+
layout (points) in;
|
4
|
+
layout (triangle_strip, max_vertices = 20) out;
|
5
|
+
|
6
|
+
uniform sampler2DRect zText;
|
7
|
+
uniform float zScale;
|
8
|
+
uniform float dx;
|
9
|
+
uniform float dy;
|
10
|
+
uniform float origx;
|
11
|
+
uniform float origy;
|
12
|
+
uniform mat4 mvp;
|
13
|
+
|
14
|
+
uniform sampler1D colorPalette; // Texture de gradient représentant la palette de couleurs
|
15
|
+
|
16
|
+
uniform int paletteSize; // Taille de la palette
|
17
|
+
uniform float colorValues[256]; // Tableau de couleurs de la palette
|
18
|
+
|
19
|
+
out vec3 ourColor;
|
20
|
+
out vec4 FragPos; // Position du fragment dans l'espace du monde
|
21
|
+
|
22
|
+
|
23
|
+
float get_value(sampler2DRect tex, vec2 pos) {
|
24
|
+
|
25
|
+
float posx = (pos.x - origx) / dx;
|
26
|
+
float posy = (pos.y - origy) / dy;
|
27
|
+
|
28
|
+
vec2 texCoord = vec2(posx, posy);
|
29
|
+
|
30
|
+
float zValue = texture(tex, texCoord).r * zScale;
|
31
|
+
return zValue;
|
32
|
+
}
|
33
|
+
|
34
|
+
void horizontal(){
|
35
|
+
|
36
|
+
float halfdx = dx/2.0;
|
37
|
+
float halfdy = dy/2.0;
|
38
|
+
|
39
|
+
float zValue = get_value(zText, gl_in[0].gl_Position.xy);
|
40
|
+
float zColor = 0.0;
|
41
|
+
|
42
|
+
// float posx = (gl_in[0].gl_Position.x - origx) / dx;
|
43
|
+
// float posy = (gl_in[0].gl_Position.y - origy) / dy;
|
44
|
+
float posx = 1.;
|
45
|
+
float posy = 1.;
|
46
|
+
|
47
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
48
|
+
ourColor = vec3(1.,0.,0.);
|
49
|
+
FragPos = vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
50
|
+
EmitVertex();
|
51
|
+
|
52
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
53
|
+
ourColor = vec3(0.,1.,0.);
|
54
|
+
FragPos = vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y - halfdy, zValue, 1.0);
|
55
|
+
EmitVertex();
|
56
|
+
|
57
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
58
|
+
ourColor = vec3(0.,0.,1.);
|
59
|
+
FragPos = vec4(gl_in[0].gl_Position.x - halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
60
|
+
EmitVertex();
|
61
|
+
|
62
|
+
gl_Position = mvp * vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
63
|
+
ourColor = vec3(1.,0.,0.);
|
64
|
+
FragPos = vec4(gl_in[0].gl_Position.x + halfdx, gl_in[0].gl_Position.y + halfdy, zValue, 1.0);
|
65
|
+
EmitVertex();
|
66
|
+
|
67
|
+
EndPrimitive();
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
void main() {
|
73
|
+
|
74
|
+
horizontal();
|
75
|
+
|
76
|
+
}
|
wolfhece/wolf_array.py
CHANGED
@@ -56,6 +56,7 @@ from .xyz_file import XYZFile
|
|
56
56
|
from .PyPalette import wolfpalette
|
57
57
|
from .PyVertexvectors import Zones, vector, wolfvertex, zone, Triangulation
|
58
58
|
from .PyVertex import cloud_vertices
|
59
|
+
from .opengl.py3d import Cache_WolfArray_plot3D, WolfArray_plot3D
|
59
60
|
|
60
61
|
WOLF_ARRAY_HILLSHAPE = -1
|
61
62
|
WOLF_ARRAY_FULL_SINGLE = 1
|
@@ -2375,14 +2376,14 @@ class Ops_Array(wx.Frame):
|
|
2375
2376
|
return
|
2376
2377
|
|
2377
2378
|
curcol = dlg.GetColourData()
|
2378
|
-
dlg.Destroy()
|
2379
|
-
|
2380
2379
|
rgb = curcol.GetColour()
|
2381
2380
|
|
2382
|
-
|
2381
|
+
|
2382
|
+
# k = gridto.GetGridCursorRow()
|
2383
2383
|
gridto.SetCellValue(k, 1, str(rgb.red))
|
2384
2384
|
gridto.SetCellValue(k, 2, str(rgb.green))
|
2385
2385
|
gridto.SetCellValue(k, 3, str(rgb.blue))
|
2386
|
+
dlg.Destroy()
|
2386
2387
|
|
2387
2388
|
|
2388
2389
|
class SelectionData():
|
@@ -3374,6 +3375,9 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3374
3375
|
self.mypal.automatic = True
|
3375
3376
|
self.mygrid = {}
|
3376
3377
|
|
3378
|
+
self._array3d = None
|
3379
|
+
self.viewers3d:list[WolfArray_plot3D] = []
|
3380
|
+
|
3377
3381
|
self.cropini = crop
|
3378
3382
|
|
3379
3383
|
if isinstance(srcheader, header_wolf):
|
@@ -3441,6 +3445,37 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3441
3445
|
self.add_ops_sel() # Ajout d'un gestionnaire de sélection et d'opérations
|
3442
3446
|
|
3443
3447
|
|
3448
|
+
def get_centers(self, usenap:bool = True):
|
3449
|
+
""" Get the centers of the cells """
|
3450
|
+
|
3451
|
+
if usenap:
|
3452
|
+
ij = np.where(self.array.mask==False,)
|
3453
|
+
xy = self.get_xy_from_ij_array(np.vstack((ij[0], ij[1])).T).copy().flatten()
|
3454
|
+
else:
|
3455
|
+
ij = np.meshgrid(np.arange(self.nbx), np.arange(self.nby))
|
3456
|
+
ij = np.asarray([ij[0].flatten(), ij[1].flatten()]).T
|
3457
|
+
xy = self.get_xy_from_ij_array(ij).copy().flatten()
|
3458
|
+
|
3459
|
+
return xy.astype(np.float32)
|
3460
|
+
|
3461
|
+
def prepare_3D(self):
|
3462
|
+
""" Prepare the array for 3D display """
|
3463
|
+
|
3464
|
+
if self.array.ndim != 2:
|
3465
|
+
logging.error(_('Array is not 2D'))
|
3466
|
+
return
|
3467
|
+
|
3468
|
+
self._quads = self.get_centers()
|
3469
|
+
ztext = np.require(self.array.data, dtype=np.float32, requirements=['F'])
|
3470
|
+
ztext[self.array.mask] = self.array.min()
|
3471
|
+
self._array3d = WolfArray_plot3D(self._quads,
|
3472
|
+
self.dx, self.dy,
|
3473
|
+
self.origx, self.origy,
|
3474
|
+
zscale = 1.,
|
3475
|
+
ztexture = ztext,
|
3476
|
+
color_palette=self.mypal.get_colors_f32().flatten(),
|
3477
|
+
color_values=self.mypal.values.astype(np.float32))
|
3478
|
+
|
3444
3479
|
def check_bounds_ij(self, i:int, j:int):
|
3445
3480
|
"""Check if i and j are inside the array bounds"""
|
3446
3481
|
return i>=0 and j>=0 and i<self.nbx and j<self.nby
|
@@ -3517,17 +3552,20 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
3517
3552
|
if id(cur.mypal) != id(self.mypal):
|
3518
3553
|
cur.mypal = self.mypal
|
3519
3554
|
|
3520
|
-
def filter_inundation(self,
|
3555
|
+
def filter_inundation(self, epsilon:float = None, mask:np.ndarray = None):
|
3521
3556
|
"""
|
3522
3557
|
Apply filter on array :
|
3523
3558
|
- mask data below eps
|
3524
3559
|
- mask data outisde linkedvec
|
3525
3560
|
"""
|
3526
|
-
|
3561
|
+
if epsilon is not None:
|
3562
|
+
self.array[np.where(self.array<epsilon)] = self.nullvalue
|
3563
|
+
elif mask is not None:
|
3564
|
+
self.array.data[mask] = self.nullvalue
|
3527
3565
|
|
3528
3566
|
idx_nan = np.where(np.isnan(self.array))
|
3529
3567
|
if len(idx_nan[0])>0:
|
3530
|
-
self.array[idx_nan] =
|
3568
|
+
self.array[idx_nan] = self.nullvalue
|
3531
3569
|
self.array.mask[idx_nan] = True
|
3532
3570
|
logging.warning(_('NaN values found in the array'))
|
3533
3571
|
for i,j in zip(idx_nan[0],idx_nan[1]):
|
@@ -4516,7 +4554,8 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
4516
4554
|
|
4517
4555
|
if not self.loaded and self.filename != '':
|
4518
4556
|
# if not loaded, load it
|
4519
|
-
self.
|
4557
|
+
self.read_all()
|
4558
|
+
# self.read_data()
|
4520
4559
|
if self.masknull:
|
4521
4560
|
self.mask_data(self.nullvalue)
|
4522
4561
|
|
@@ -5590,12 +5629,17 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
5590
5629
|
self.rgb[pond<0,i] = self.rgb[pond<0,i] * (1.+pond[pond<0]) - pmin[pond<0,i] * pond[pond<0]
|
5591
5630
|
self.rgb[pond>0,i] = self.rgb[pond>0,i] * (1.-pond[pond>0]) + pmax[pond>0,i] * pond[pond>0]
|
5592
5631
|
|
5593
|
-
self.rgb[self.array.mask] = [1., 1., 1.,
|
5632
|
+
self.rgb[self.array.mask] = [1., 1., 1., 0.]
|
5594
5633
|
|
5595
5634
|
if self.myops is not None:
|
5596
5635
|
# update the wx
|
5597
5636
|
self.myops.update_palette()
|
5598
5637
|
|
5638
|
+
if len(self.viewers3d) > 0:
|
5639
|
+
for cur in self.viewers3d:
|
5640
|
+
cur.update_palette(self.idx, self.mypal.get_colors_f32().flatten(), self.mypal.values.astype(np.float32))
|
5641
|
+
|
5642
|
+
|
5599
5643
|
def plot(self, sx:float=None, sy:float=None, xmin:float=None, ymin:float=None, xmax:float=None, ymax:float=None, size:float=None):
|
5600
5644
|
"""
|
5601
5645
|
Plot the array - OpenGL
|
wolfhece/wolfresults_2D.py
CHANGED
@@ -353,7 +353,7 @@ class Props_Res_2D(wx.Frame):
|
|
353
353
|
Toolssizer = wx.BoxSizer(wx.VERTICAL)
|
354
354
|
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
355
355
|
self._label_nullvalue = wx.StaticText(self._tools,label=_('Epsilon'))
|
356
|
-
self._txt_nullvalue = wx.TextCtrl(self._tools,value=str(self._parent.
|
356
|
+
self._txt_nullvalue = wx.TextCtrl(self._tools,value=str(self._parent.epsilon), style=wx.TE_CENTER)
|
357
357
|
self._txt_nullvalue.SetToolTip(_('Epsilon value under which the value is not plotted'))
|
358
358
|
hbox.Add(self._label_nullvalue, 0, wx.EXPAND|wx.ALL)
|
359
359
|
hbox.Add(self._txt_nullvalue, 1, wx.EXPAND|wx.ALL)
|
@@ -621,7 +621,7 @@ class Props_Res_2D(wx.Frame):
|
|
621
621
|
if self._parent.nullvalue == np.nan:
|
622
622
|
self._txt_nullvalue.Value = 'nan'
|
623
623
|
else :
|
624
|
-
self._txt_nullvalue.Value = str(self._parent.
|
624
|
+
self._txt_nullvalue.Value = str(self._parent.epsilon)
|
625
625
|
|
626
626
|
self.update_palette()
|
627
627
|
|
@@ -634,8 +634,8 @@ class Props_Res_2D(wx.Frame):
|
|
634
634
|
else:
|
635
635
|
newnull = float(newnull)
|
636
636
|
|
637
|
-
if self._parent.
|
638
|
-
self._parent.
|
637
|
+
if self._parent.epsilon != newnull:
|
638
|
+
self._parent.epsilon = newnull
|
639
639
|
self._parent.read_oneresult(self._parent.current_result)
|
640
640
|
self._parent.set_currentview()
|
641
641
|
|
@@ -1417,7 +1417,8 @@ class OneWolfResult:
|
|
1417
1417
|
- mask data below eps
|
1418
1418
|
- mask data outisde linkedvec
|
1419
1419
|
"""
|
1420
|
-
self.
|
1420
|
+
mask = self.waterdepth.array < self.epsilon
|
1421
|
+
self._current.filter_inundation(mask = mask)
|
1421
1422
|
|
1422
1423
|
def set_current(self,which):
|
1423
1424
|
self._which_current = which
|
@@ -1568,6 +1569,7 @@ class OneWolfResult:
|
|
1568
1569
|
|
1569
1570
|
self._current.linkedvec = self.linkedvec
|
1570
1571
|
self._current.idx = self.idx
|
1572
|
+
self._current.nullvalue = self.waterdepth.nullvalue
|
1571
1573
|
|
1572
1574
|
@property
|
1573
1575
|
def min_field_size(self):
|
@@ -2032,14 +2034,14 @@ class Wolfresults_2D(Element_To_Draw):
|
|
2032
2034
|
|
2033
2035
|
return x>=xmin and x<=xmax and y>=ymin and y<=ymax
|
2034
2036
|
|
2035
|
-
@property
|
2036
|
-
def nullvalue(self):
|
2037
|
-
|
2037
|
+
# @property
|
2038
|
+
# def nullvalue(self):
|
2039
|
+
# return self.epsilon
|
2038
2040
|
|
2039
|
-
@nullvalue.setter
|
2040
|
-
def nullvalue(self, value):
|
2041
|
-
|
2042
|
-
|
2041
|
+
# @nullvalue.setter
|
2042
|
+
# def nullvalue(self, value):
|
2043
|
+
# self._epsilon_default = value
|
2044
|
+
# self.epsilon = self._epsilon_default
|
2043
2045
|
|
2044
2046
|
@property
|
2045
2047
|
def alpha(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wolfhece
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.15
|
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
|
@@ -51,6 +51,7 @@ Requires-Dist: xarray
|
|
51
51
|
Requires-Dist: rasterio
|
52
52
|
Requires-Dist: h5py
|
53
53
|
Requires-Dist: basemap
|
54
|
+
Requires-Dist: exif
|
54
55
|
|
55
56
|
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.
|
56
57
|
|