Python 3d interpolation in Python using a mesh grid

  • Thread starter CAF123
  • Start date


Gold Member
I have four arrays of data xvalues[], yvalues[], zvalues[] and wvalues[] and I want to create, from this data, an interpolated function w = f(x,y,z). Is it easy to do this in python using first a meshgrid and then calling scipy's interpolation?

e.g toy set up is something like, where wvalues contains 5x3x6 values.

`xvalues = np.array([0,1,2,3,4]);
yvalues = np.array([0,1,2]);
zvalues = np.array([0,1,2,3,4,5]);
wvalues = np.array([10,9,8,.....])'

`xx,yy,zz,ww = np.meshgrid(xvalues, yvalues, zvalues, wvalues)` produces a grid containing many points and at each point there is a value for the tuple (x,y,z,w). I've done simple 1D interpolations in python before but I've not found any resources which can help with a multidimensional interpolation using a mesh grid. Can anyone help? Thanks!

Want to reply to this thread?

"3d interpolation in Python using a mesh grid" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving