It seems a few relevant questions here didn't give me the answer I want.
So I have a 2D look up table which is a 2D grid with values at grid coordiates. For example, such table can be generated by code below:
xx, yy = np.meshgrid(np.arange(100), np.arange(100))
zz = some_function(xx, yy)
now I have a list of coordinates of scattered points on the grid, for example, I can generate such coordinates by:
xs = np.random.rand(10) * 100
ys = np.random.rand(10) * 100
scattered_points = [(x, y) for x, y in zip(xs, ys)]
How can I interpolate out the z value for these 10 points?
I only find out that I can do this by searching the neighboring grid points of (x, y) and perform interpolation there. It is fine for a few points but I just wonder if there is a better/pythonic way to do that using numpy
/scipy
.