[SciPy-User] [SciPy-user] 2d interpolation, non-regular lat/lon grid - help with delauney/natgrid??
Robert Kern
robert.kern at gmail.com
Thu Aug 13 12:27:46 EDT 2009
On Thu, Aug 13, 2009 at 08:47, John [H2O]<washakie at gmail.com> wrote:
>
> YOU should've read the (FM)?? Or I? ;)
>
> Actually, I have referred to both docs, but I'm just missing something. &-(
>
> Unfortunately, it seems now the problem is that m (basemap instance) expects
> grid_lon, grid_lat to be of the same length. I tried to convert them into
> meshgrid objects, but then I get the error I received in the prior message
> about monotonically increasing axes...
Ah, yes. griddata() only handles regular grids for some reason, not
arbitrary interpolation points. You will have to use the underlying
delaunay package to interpolate arbitrary points. Using your variable
names:
# triangulate data
tri = delaunay.Triangulation(x,y)
# interpolate data
interp = tri.nn_interpolator(z)
Z0 = interp(gridx, gridy)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-User
mailing list