These GridUtility methods create new GridData objects from pairs of input grids. The new grid is the result of a mathematical operation on the two inputs grid, and retains the original grid's cell size and coordinate system.
If the two input grids do not intersect or are not geometrically compatible—that is, if their cell sizes, coordinate systems, and the position of the origin (0, 0) cell for indexing are not the same—the calculation will not be completed and a null object will be returned.
Each of the grid algebra functions takes as its last argument an integer array of length 1, containing a status flag. The value is set to 0 for a successful compute. A non-zero status value indicates that the grids do not overlap, or are otherwise of different geometries or types.

GridUtilities.gridAdd


This method creates a new grid from two input grids. The new grid's extent is equivalent to the intersection of the two input grids, and the cell values in the new grid contain the sum of the values in the corresponding cells in the input grids. The output grid value is set to NULL in cells where either input grid has a NULL value.
GridData GridUtilities.gridAdd(
GridData grid1,
GridData grid2
int[] status)

GridUtilities.gridSubtract


This method creates a new grid from two input grids. The new grid's extent is equivalent to the intersection of the two input grids, and the cell values in the new grid contain the difference computed by subtracting the values in the corresponding cells in grid2 from the values in grid1. The output grid value is set to NULL in cells where either input grid has a NULL value.
GridData GridUtilities.gridSubtract(
GridData grid1,
GridData grid2
int[] status)

GridUtilities.gridMultiply


This method creates a new grid from two input grids. The new grid's extent is equivalent to the intersection of the two input grids, and the cell values in the new grid contain the product of the values in the corresponding cells in the input grids. The output grid value is set to NULL in cells where either input grid has a NULL value.
GridData GridUtilities.gridMultiply(
GridData grid1,
GridData grid2
int[] status)

GridUtilities.gridDivide


This method creates a new grid from two input grids. The new grid's extent is equivalent to the intersection of the two input grids, and the cell values in the new grid contain the quotient computed by dividing the values in the corresponding cells in the first input grid by the values in the second input grid. The output grid value is set to NULL in cells where either input grid has a NULL value.
GridData GridUtilities.gridDivide(
GridData grid1,
GridData grid2
int[] status)