The griddata function should be doing delaunay triangulation by default, so the result from griddata should be identical to the second plot.  I see that you are using a "mask" for x0, y0, v0.  This is unnescessary, as you really want to pass the "flat" arrays.

I can not get a masked array from griddata.  Actually, I have to pass in flat arrays to make it work at all.  And the result is identical to the second plot:

ui = pylab.mlab.griddata(x0.flat, y0.flat, v0.flat, xi, yi)

As to whether the result is "correct" or not, I am not qualified to say, so I will leave that to someone else to determine.

Ben Root

On Sun, Jun 27, 2010 at 8:28 PM, Martinho MA <> wrote:

I need to interpolate from a 2d grid to another one.
I tryed to use griddata (with natgrid) but the returned data if fully masked. So, I used directly delaunay triangulation and I obtained quite bad results!!

I send attached a small code and the output figure as png. I also send my data as npz (32k).
To generate it just run
>>python 1

or from python:
>import test

Thanks for the help


uname -a
Linux cxx #1 SMP 2010-02-26 20:32:57 +0100 x86_64 x86_64 x86_64 GNU/Linux

This email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit --
Matplotlib-users mailing list