I have a cubic grid defined by the spacing xi,yi,zi
:
xi,yi,zi = [linspace(ox,ox+s*d,s) for ox,s,d in zip(origin,size,delta)]
I also have set of scalar values W
onto that grid. W.shape() == size
. I'd like to use scipy's linear interpolation, which requires as input:
class
scipy.interpolate.LinearNDInterpolator(points, values)
:Parameters :
points
: ndarray of floats, shape(npoints, ndims)
Data point coordinates.
values
: ndarray of float or complex, shape(npoints, ...)
Data values.
How do I create a fake set of points
(via magical broadcasting) from xi,yi,zi
? Right now I'm creating an intermediate array to feed to the interpolation function - is there a better way?
Related Question: Numpy meshgrid in 3D. The answers in this post actually create the grid - I only want to simulate it as input to another function (pure numpy solution preferred).