On Thu, Oct 12, 2006 at 08:15:46PM +0100, John Travers wrote:
I've added a patch to the ticket #286 that makes interp2d use regrid. I think this must be the best compromise for now until we sort out a suitable routine for scattered data interpolation.
I have a couple of concerns: 1. I recently made some changes to the interp2d interface in order to make the coordinate specification more consistent. Your patch simply reverts to the older behaviour. I don't like this because it assumes that x values increase with rows and y values with columns, even though this isn't mentioned anywhere in the docstrings. I'm not suggesting that the alternative is better, but it does make fewer assumptions -- it simply flattens the x and y inputs and pass them to the fitpack routine (unless x*y != z.size, in which case it makes up a meshgrid). 2. The docstrings were updated to be fairly descriptive, whereas after patching we'd be back to short, non-descriptive documentation. I'm also not happy about the way the output shape is determined (but this is a shortcoming of the current version, not a problem with your patch). Again, do x values increase along rows or columns? One option which overcomes this problem is for the output to be the same as the argument to __call__, i.e. x([[0,1,2],[3,4,5],[6,7,8]],[[0,1,2,],[3,4,5],[6,7,8]]) returns a (3,3) array of values, whereas x([0,1,2],[0,1,2]) returns a (3,) array of values, unlike the current (3,3). Unfortunately, this doesn't allow the usage of ogrid. Ultimately, it doesn't really matter as long as we choose an axis system and document it clearly. I'd also like to see some tests to verify the behaviour of the new interp2d that is *different* from the old version. It's easier to add it now, while everything is still fresh in our memories. We can probably sort out these issues with minimal effort. Thanks a lot for working on interp2d -- it has been long overdue for an overhaul. Cheers Stéfan