[SciPy-Dev] Review request: interp2d with partial redgrid backend

John Travers jtravs at gmail.com
Sun Nov 11 18:54:23 EST 2012


Hi All,

It has been a long time since I submitted any scipy hacks, but I got
hit by an old issue of mine so decided to do something about it.

The current interp2d backend uses the surfit routine from dierkx's
fitpack, which is not meant for interpolation (which we choose when we
set s=0.0). From the surfit.f code:

c   to choose s very small is strongly discouraged. this considerably
c   increases computation time and memory requirements. it may also
c   cause rank-deficiency (ier<-2) and endager numerical stability.

I originally raised this a long time ago with ticket #286 which
proposed replacing surfit with regrid which does not suffer from this
problem. However as is rightly stated in the comments to that ticket,
it changed interp2d to only work on rectangular grids rather than
scattered data which is not acceptable (and an API breakage).

So I propose to find a step by step solution to this. First the
following code uses regrid whenever possible:

https://github.com/jtravs/scipy/compare/master...interp2d_rectangular_fixes

This fixes #286, #776, #898 and parts of #1364, #1072, and #703.

Following this I hope to improve the docs a little and find a better
solution to the scattered data problem rather than using surfit (which
is great for smoothing BTW).

Please note that this is my first attempt at the whole git workflow
thing for scipy, so I hope this code review request is the right way
to go. I hope to submit quite a few more changes, so please correct me
where I go wrong!

Cheers,
John



More information about the SciPy-Dev mailing list