Method griddata
| Improve this Doc View Sourcegriddata(Double[], Double[], Double[], Double[], Double[], Double[,], Grid, Double)
plgriddata: Grid data from irregularly sampled data
Declaration
public void griddata(Double[] x, Double[] y, Double[] z, Double[] xg, Double[] yg, Double[, ] zg, Grid type, Double data)
Parameters
Type | Name | Description |
---|---|---|
Double[] | x | The input x vector. |
Double[] | y | The input y vector. |
Double[] | z | The input z vector. Each triple x[i], y[i], z[i] represents one data sample coordinate. |
Double[] | xg | A vector that specifies the grid spacing in the x direction. Usually xg has nptsx equally spaced values from the minimum to the maximum values of the x input vector. |
Double[] | yg | A vector that specifies the grid spacing in the y direction. Similar to the xg parameter. |
Double[,] | zg | The matrix of interpolated results where data lies in the grid specified by xg and yg. Therefore the zg matrix must be dimensioned nptsx by nptsy. |
Grid | type | The type of grid interpolation algorithm to use, which can be: GRID_CSA: Bivariate Cubic Spline approximation GRID_DTLI: Delaunay Triangulation Linear Interpolation GRID_NNI: Natural Neighbors Interpolation GRID_NNIDW: Nearest Neighbors Inverse Distance Weighted GRID_NNLI: Nearest Neighbors Linear Interpolation GRID_NNAIDW: Nearest Neighbors Around Inverse Distance Weighted For details of the algorithms read the source file plgridd.c. |
Double | data | Some gridding algorithms require extra data, which can be specified through this argument. Currently, for algorithm: GRID_NNIDW, data specifies the number of neighbors to use, the lower the value, the noisier (more local) the approximation is. GRID_NNLI, data specifies what a thin triangle is, in the range [1. .. 2.]. High values enable the usage of very thin triangles for interpolation, possibly resulting in error in the approximation. GRID_NNI, only weights greater than data will be accepted. If 0, all weights will be accepted. |
Remarks
Real world data is frequently irregularly sampled, but PLplot 3D plots require data organized as a grid, i.e., with x sample point values independent of y coordinate and vice versa. This function takes irregularly sampled data from the x[npts], y[npts], and z[npts] vectors; reads the desired grid location from the input vectors xg[nptsx] and yg[nptsy]; and returns the interpolated result on that grid using the output matrix zg[nptsx][nptsy]. The algorithm used to interpolate the data to the grid is specified with the argument type which can have one parameter specified in argument data.