[SciPy-user] Interpolation
Robert Kern
rkern at ucsd.edu
Thu Apr 21 19:31:34 CDT 2005
Tim Gray wrote:
> Hi, I've got a question for everyone. I'm trying to some code from IDL that uses the interpolate function. Basically I've got a big 2d array of data with time as one index and radius on the other index. Each value in the array is "data". I basically need to interpolate this data to other radii.
>
> Here's what IDL's interpolate does (to 2d arrays). It takes an array such as:
> x =[[ 0, 1, 2, 3,]
> [ 4, 5, 6, 7,]
> [ 8, 9,10,11,]
> [12,13,14,15,]]
>
> and given two vectors which define the desired indices to interpolate the data to, it spits out a new array. So for an input of:
> interpolate(x,[.5,1.5,2.5],[.5,1.5,2.5]), you get a 3x3 array of:
> [[ 2.5, 3, 4.5]
> [ 6.5, 7.5, 8.5]
> [10.5, 11.5, 12.5]]
>
> I'm sure something like this is in Scipy already, I'm just having problems finding it. Any suggestions?
Look at scipy.interpolate.interpolate.interp2d . Yes, there are 2
"interpolate"s in there. I don't know why interp2d isn't exposed like
interp1d is.
Pearu, is this an oversight? Or is interp2d not robust enough, yet?
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the SciPy-user
mailing list