VelocityGrid ¶
VelocityGrid(
x: list[float],
y: list[float],
u: list[list[float]],
v: list[list[float]],
)
Velocities on a regular grid, laid out for streamplot(x, y, u, v).
Attributes:
-
x(list of float) –Grid x coordinates, increasing (constant when the points do not spread in x, which only
adjust_for_stream=Falseaccepts, as scVelo). -
y(list of float) –Grid y coordinates, increasing.
-
u(list of list of float) –x component of the velocity, one row per
yvalue and one column perxvalue. Hidden grid points are NaN. -
v(list of list of float) –y component of the velocity, laid out as
u. NaN whereuis NaN only whenadjust_for_stream=False(as scVelo, which hides stream points throughualone;streamplottreats either as missing).
Examples:
>>> from ggrust import *
>>> points = [[i % 10, i // 10] for i in range(100)]
>>> vectors = [[1.0, 0.5]] * 100
>>> grid = velocity_grid(points, vectors, n_neighbors=5)
>>> len(grid.x), len(grid.y), len(grid.u), len(grid.u[0])
(50, 50, 50, 50)