FAST_GRID3 Function

Returns a gridded, 2D array containing z values, given random x-, y-, z-coordinates (this function works best with dense data points).

Usage

    result = FAST_GRID3(points, grid_x, grid_y)

Input Parameters

points—A (3, n) array containing the random x, y, z points to be gridded.

grid_x—The x dimension of the grid. The x values are scaled to fit this dimension.

grid_y—The y dimension of the grid. The y values are scaled to fit this dimension.

Returned Value

result—A gridded, 2D array containing z values.

Keywords

Iter—The number of iterations on the smooth function. The execution time increases linearly with the number of iterations. The default is 3, but any non-negative integer (including zero) may be specified.

Nghbr—The size of the neighborhood to smooth. If not supplied, the neighborhood size is calculated from the distribution of the points. The amount of memory required increases by the square of the neighborhood size.

No_Avg—Normally, if multiple data points fall in the same cell in the gridded array, then the value of that cell is the average value of all the data points that fall in that cell.

If the No_Avg keyword is present and nonzero, however, the value of the cell in the gridded array is the total of all the points that fall in that cell.

XMin—The x-coordinate of the left edge of the grid. If omitted, maps the minimum x value found in the points(0, *) array to the left edge of the grid.

XMax—The x-coordinate of the right edge of the grid. If omitted, maps the maximum x value found in the points(0, *) array to the right edge of the grid.

YMin—The y-coordinate of the bottom edge of the grid. If omitted, maps the minimum y value found in the points(1, *) array to the bottom edge of the grid.

YMax—The y-coordinate of the top edge of the grid. If omitted, maps the maximum y value found in the points(1, *) array to the top edge of the grid.

Discussion

FAST_GRID3 uses a neighborhood smoothing technique to interpolate missing data values for 3D gridding. The gridded array returned by FAST_GRID3 is suitable for use with the SURFACE, TV, AND CONTOUR procedures.

FAST_GRID3 is similar to GRID_3D. FAST_GRID3, however, works best with dense data points (more than 1000 points to be gridded) and is considerably faster, but slightly less accurate, than GRID_3D. (GRID_3D works best with sparse data points and is stable when extrapolating into large void areas.)

Note: For best results, use a small neighborhood (such as 3) and a large number of iterations (more than 16).

Examples

This program shows 3D gridding with dense data points.

; Generate random data points.
points = RANDOMU(s, 3, 1000)
points(0, *) = points(0, *) * 10.0
points(1, *) = points(1, *) * 10.0
points(*, 0) = [1.7, 1.6,   2.9]
points(*, 1) = [1.4, 1.2,   3.7]
points(*, 2) = [9.8, 9.2,   5.5]
points(*, 3) = [9.8, 8.4,   0.1]
points(*, 4) = [4.8, 9.9,   6.3]
points(*, 5) = [0.2, 9.0,   9.0]
points(*, 6) = [3.1, 7.2,  15.2]
points(*, 7) = [5.6, 6.0,  -5.9]
points(*, 8) = [0.3, 0.5,   3.3]
points(*, 9) = [9.7, 0.7,  -1.6]
; Grid the resulting data points.
zval = FAST_GRID3(points, 48, 32)
; Display gridded data as a surface in the specified window.
WINDOW, 0
LOADCT, 0 & TEK_COLOR
SURFR
SURFACE, zval, Bottom=WoColorConvert(6), Ax=30.0, Az=30.0, /T3d

See Also

FAST_GRID2, FAST_GRID4, GRID_2D, GRID_3D, GRID_4D, GRIDN, GRID_SPHERE