[SciPy-user] Bilinear Interpolation

Ryan May rmay at ou.edu
Wed Sep 27 08:09:18 CDT 2006

Ryan May wrote:
> Stefan van der Walt wrote:
>> On Tue, Sep 26, 2006 at 11:19:37AM -0500, Ryan May wrote:
>>> Is there function for doing a simple bilinear interpolation in scipy?  I 
>>> tried the interpolate.interp2d routines, but it appears that it uses 
>>> B-splines even when kind='linear' is specified. (I wouldn't otherwise 
>>> care except that my class assignment explicitly says to use
>>> bilinear.)
>> I'm speaking under correction, but if you choose 'linear', b-splines
>> of degree 1 (i.e. straight lines) are used and you are doing linear
>> interpolation.
> That's what I kinda thought, but using 'linear' for interp2d didn't give 
> me the same answer as when I performed the calculation manually.  I'll 
> have to see what I can find on this...

Ok, if I select the 4 points surrounding the location of interest, 
interp2d gives me the value I get with manually calculating a bilinear 
interpolation.  However if I use the whole field (or even 9 points 
instead of 4), I get a different answer.  I _know_ I wouldn't expect 
this for bilinear interpolation, and it would seem to imply that even 
_linear_ B-splines uses the information from additional points.  Am I 
missing something here, or are the methods just not truly equivalent?


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
rmay at rossby.ou.edu

More information about the SciPy-user mailing list