开发者

MATLAB's griddata3 for NumPy?

I realize that there is a griddata for NumPy via Matplotlib, but is there a griddata3 (same has griddata, but for higher dimensions)?

In other words, I have (x,y,z,d(x,y,z)) where (x,y,z) form an irregular grid and d(x,y,z) is a scalar function of three variables. I need to generate d(xi, yi, zi) for a new set of (xi, yi, zi) points using some kind of开发者_如何学Go interpolation that can handle the non-uniformity of the original (x,y,z) data.

Ultimately, the (xi, yi, zi, d(xi, yi, zi)) data will have to be rendered as a surface somehow, but that's a problem for later. I also do not have an analytical form for the d(.) function; I just have data for it.


SciPy 0.9 (at the moment, a first beta is out) has a new griddata function that can handle N-dimensional data.


Not sure how you intend to render a surface of a scalar function of 3 variables, except perhaps using cutplanes or something similar. Mayavi (really VTK which powers Mayavi) has support for efficient Delaunay triangulation via enthought.mayavi.mlab.pipeline.delaunay3d, which is the core of the algorithm used by griddata3. See the 2D example code they have posted, just add one dimension (and use delaunay3d instead). I don't know of a way to explicitly get the interpolated values used to render the surface, but there might be a way to sample it through Mayavi, you could dig through the documentation or ask on one of the Enthought mailing lists.

Alternatively, one of the C functions in the NCAR natgrid library may be useful i.e. dsgrid3d. There is a partial wrapper implemented as a matplotlib toolkit.


I am not familiar with griddata3, but you might want to look into meshgrid and this related post.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜