0

Problem

I have some simulation data (let's call it data_1 which is a scalar) over unstructured 3D coordinates mesh1. I want to interpolate this data to a new set of unstructured coordinates mesh2 to get data_2. I have already tried scipy.interpolate.griddata as in

data_2 = griddata(mesh1, data_1, mesh2)

but it was painfully slow. It took about 7 minutes for a single interpolation! I should note that the length of my mesh is in the order of 100k points.

What other functions exist in python that can do this at a faster rate?

Background

I perform two thermal simulations with different mesh structures and I would like to compare the whole temperature profile at identical time frames. But since my mesh structures do not match, I need to take one of them as reference and interpolate the data of the other simulation over it. I would also be happy if there are any suggestion on how I could do this differently that would be faster.

  • 1
    Does this answer your question? [Very slow interpolation using \`scipy.interpolate.griddata\`](https://stackoverflow.com/questions/28613747/very-slow-interpolation-using-scipy-interpolate-griddata) – jayveesea Feb 13 '21 at 17:51
  • I had seen that one already. I had a lot of troubling understanding how `ndimage.map_coordinates` works but it seems to be aimed for 2D data interpolation. And the other function from OpenCV is again meant for image transformation (2D). I have arrays of (m=data points, D=4) shape and can't use 2D methods. I have tried `scatteredInterpolant` function in matlab previously and it can do the job in 20 seconds instead of 7 minutes that I saw for griddata. So I am looking for something similar in python. – pooriyag Feb 14 '21 at 11:10
  • I also tried scipy.interpolate.Rbf as mentioned in another post for spline 3D interpolation but due to large size of data, the memory quickly fills up (32GB in my PC) and my system crashes. – pooriyag Feb 14 '21 at 11:49
  • [This](https://stackoverflow.com/a/20930910/11305111) may help. – jayveesea Feb 14 '21 at 13:20
  • I have seen that one too. I do have different 'frames' to interpolate over the same coordinates, but for now I am focusing on the speed of a single frame and that's super slow. I ended up importing matlab.engine just for the interpolation part which can be done in 20 sec with scatteredInterpolant. I am kinda disappointed with python's efficiency. I was hoping someone with more expertise would point me to the right direction. – pooriyag Feb 14 '21 at 16:50

0 Answers0