[SciPy-user] 2D Interpolation

Ryan May rmay31 at gmail.com
Sun Jun 29 15:30:51 EDT 2008


>> Jackpot!  This works really well.  There's a good example on using  
>> it here:
>>
>> http://www.scipy.org/Cookbook/Interpolation
>>
>> Which is important, because I had to read the docstring a dozen  
>> times to
>> understand what was going on.  It should also be noted that while the
>> example interpolates to a regular grid, there's nothing precluding
>> interpolating to an irregular collection of points.  What's weird is
>> that you need to manually scale the points to which you're  
>> interpolating
>>  to be floating point indices within the original grid.  This is
>> probably due to the ndimage-focused nature of map_coordinates.
>>
>> Moving some of the functionality of map_coordinates, in a more generic
>> fashion, into scipy.interpolate wouldn't be the worst idea in the  
>> world.
>>  Then again, I don't know if anyone else is planning on improving
>> scipy.interpolate to gain this functionality (interpolation to array  
>> of
>> irregular set of points) in another way.  (I also can't volunteer to
>> step up and do it at this time.)
>>
> Ryan,
> 
> It looks like you were bitten by the same organizational problem that  
> Shane mentions here (4th paragraph about where to find interpolation):
> 
> http://www.vetta.org/2008/05/scipy-some-more-thoughts/
> 
> Seems like we should address this both in the documentation and in the  
> actual organization/location of the routines.  Thoughts?
> 
> Travis

I think docs would be a good first step.  Ndimage definitely wasn't an 
area that I thought of, and even if I did look there, "map_coordinates" 
is not a name I associate with interpolation.  As far as a 
reorganization is concerned, I think a refactoring is more likely what 
is needed.  Even though it manages to do what I need, it still feels 
like I'm abusing the function a bit rather than it being a smooth 
solution to my problem.  I think what would be nice would be taking the 
functionality available in map_coordinates and wrapping it with the 
existing API's in scipy.interpolate (either OO-based or procedural). 
Obviously, this is a bit of work, and since I don't have the time ATM, I 
can't push too hard here. :)

I think a good interim solution would to at least add a see also link to 
map_coordinates from some of the relevant scipy.interpolate docstrings. 
  I think cleaning up the map_coordinates docstring and maybe adding 
some better examples would also help.

My 0.02.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma



More information about the SciPy-User mailing list