Slight mistake in docs "Multivariate data interpolation on a regular grid"

Hello,

I think I spotted a slight mistake in the docs here.

The CartesianGridInterpolator from Johanness Buchner is told to be an “almost drop-in” replacement for RegularGridInterpolator for N-D images. I have some code written with RGI, so I tried to move to the proposed implementation.

self.limits = np.array([[min(x), max(x)] for x in points]) (line 1 of init)

does not mirror the behavior of RGI. The correct implementation of RGI’s behavior, is, I think, something like this :

self.limits = np.array([[x[0], x[-1]] for x in points])

My correction might be wrong, I’m by no means an experienced dev or an interpolation expert, but I am pretty sure that the current proposed implementation is wrong and can mislead the user.

BTW, thank you to you all for the excellent toolkit that is scipy

Hi,

It’s great that you’re taking time to improve the example, much appreciated!

Now, the example is definitely a quick untested demo, it very well might be faulty. Could you explain a bit more though, what is wrong with the original version, and how yours fixes the problem? Here or in a pull request to the scipy repository.

Cheers,

Evgeni