Skip to content

Commit bb89315

Browse files
committed
Interpolate data for animaton for surface cahrt too
1 parent 091a2dd commit bb89315

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

data_vis/geonodes/data.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,28 @@ def _convert_data_to_geometry(
243243
)
244244
X, Y = np.meshgrid(x, y)
245245

246+
# Interpolate data points into a grid
247+
data_x = data.vert_positions[:, 0]
248+
data_y = data.vert_positions[:, 1]
246249
res = interpolate.Rbf(
247-
data.vert_positions[:, 0],
248-
data.vert_positions[:, 1],
250+
data_x,
251+
data_y,
249252
data.vert_positions[:, 2],
250253
function=interpolation_config.method,
251254
)(X, Y)
252255

256+
# Interpolate data points for animation into a grid
257+
data.z_ns = np.array(
258+
[
259+
interpolate.Rbf(
260+
data_x,
261+
data_y,
262+
z,
263+
function=interpolation_config.method,
264+
)(X, Y).reshape(-1)
265+
for z in data.z_ns.T
266+
]
267+
).T
253268
for row in range(interpolation_config.m):
254269
for col in range(interpolation_config.n):
255270
verts.append(

0 commit comments

Comments
 (0)