[Numpy-discussion] creating mesh data from xyz data

Christopher Barker Chris.Barker@noaa....
Tue Sep 8 10:38:35 CDT 2009


Giuseppe Aprea wrote:
> I have some files with data stored in columns:
> 
> x1     y1     z1
> x2     y2     z2
> x3     y3     z3
> x4     y4     z4
> x5     y5     z5
> I usually load data using 3 lists: x, y and z; I wonder if there is
> any function which is able to take these 3 lists and return the right
> inputs for matplotlib functions.

There may b e some MPL utilities that help with this, so you may want to 
ask there, but:

What you want to do depends on the nature of your data. If your data is 
on a rectangular structured grid, the you should use your knowledge of 
the data structure to re-create that structure to pass to MPL.

If it is unstructured data: i.e. the (x,y) points are at arbitrary 
positions, then you need some sort of interpolation scheme to get an 
appropriate rectangular mesh:


Here's a good start:

http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list