PyNGL Home > Functions > Interpolation


Uses a natural neighbor algorithm to interpolate 2-dimensional randomly spaced data.


iarr = Ngl.natgrid(x, y, z, xo, yo)


x, y

One-dimensional arrays of the X and Y coordinate points of the input data.


The one-dimensional input data to be interpolated, of the same length as x and y. Can be a NumPy float array or a Python list or tuple.

xo, yo

One-dimensional NumPy float arrays or Python lists (of length numxout and numyout) containing the coordinate points of the output data grid.

Return value


A 2-dimensional NumPy array of size numxout x numyout.


This function uses a natural neighbor algorithm for interpolating 2-dimensional randomly spaced data. This function is a Python version of the similar function in the Natgrid package of the ngmath library.

The first two arguments of Ngl.natgrid are 1-dimensional NumPy float arrays or Python lists of the same size, containing the X and Y coordinates of the input data points. The third argument is another 1-dimensional float array, or Python list (of the same size as the X and Y arrays) containing the values of the input function. The last two arguments are 1-dimensional float arrays or Python lists containing the X and Y coordinates of the output data grid.

The procedure Ngl.nnsetp is used to set parameter values for Ngl.natgrid, and the function Ngl.nngetp is used to retrieve parameter values.

See Also

Ngl.nngetp, Ngl.nnsetp


See (and its output).