Is there a scipy / numpy method to get indices for the closest interpolation?

Essentially, I have a set of large (GB) datasets with points that I need to make in the nearest interpolation. This is essentially a scalar / vector field, which is a function of time. I know scipy.interpolateall this stuff, and I use it. However, I realized that the spatial data structure is constant in time (Euler), so when I find out which indexes correspond to a particular interpolation point, say, for the first time step, I could just get these indexes, and the same indexes should be able to create the same shaped, interpolated data at other time periods. Essentially, it saves the step of re-interpolating the data over and over.

I am ready to do it myself, but I wanted to check if there is already a way that may not be in scipy, but in another place. scipy.interpolatehas nothing ready, it looks like he can do it. If there are no answers, I will send my decision.

Finally, the grid is Euler, but not regular and has possible repetitions, so the nearest interpolation is necessary. I can (and had) done a lexical look at spatial points, and this will help to quickly view.

+4
source share
1 answer

kD trees are commonly used to split multidimensional data to perform quick searches for nearest neighbors.

, scipy.interpolate.NearestNDInterpolator scipy.spatial.cKDTree (. ). cKDTree.query , .

+2

Source: https://habr.com/ru/post/1622273/


All Articles