[SciPy-User] interpolation grid/scatter

Vincent Schut schut at sarvision.nl
Wed Feb 10 11:06:15 EST 2010


On 02/10/2010 04:58 PM, fred wrote:
> Hi all,
>
> Say I have data grid like this:
>
> xmin, xmax, dx = 0, 5, 1
> ymin, ymax, dy = 0, 4, 1
>
> data.shape : (6,5)
>
> I would like to get scalar value at points that are _not_ on the grid
> nodes, say at x=1.213, y=3.24.
>
> How could I do that?
>
> Is there a scipy function to do what I want?
>
> PS : I have about 100 points on which I want the scalar value
>
> PS2 : my array can be 3D array.
>
> TIA.
>
> Cheers,
>

Fred,

As long as your points are all within the data grid boundaries (so: no 
extrapolation) and your data grid is regular and without voids, 
scipy.ndimage.map_coordinates should do what you want.
Be careful for spline interpolation artifacts though. Under/overshoots 
might result when using order=2 or highter. Order=1 will interpolate 
linearly, order=0 does nearest neighbour mapping.

Vincent.




More information about the SciPy-User mailing list