uk.ac.leeds.ccg.andyt.grids.process
Class Grid2DSquareCellProcessorDEM

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
      extended by uk.ac.leeds.ccg.andyt.grids.process.Grid2DSquareCellProcessor
          extended by uk.ac.leeds.ccg.andyt.grids.process.Grid2DSquareCellProcessorDEM
All Implemented Interfaces:
java.io.Serializable

public class Grid2DSquareCellProcessorDEM
extends Grid2DSquareCellProcessor

A class of methods relevant to the processing of Digital Elevation Model Data.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class uk.ac.leeds.ccg.andyt.grids.process.Grid2DSquareCellProcessor
grid2DSquareCells, log, logIndentation, startTime, workspace
 
Fields inherited from class uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
handleOutOfMemoryErrorFalse, handleOutOfMemoryErrorTrue, memoryReserve
 
Constructor Summary
Grid2DSquareCellProcessorDEM()
          Creates a new Grid2DSquareCellDoubleProcessorDEM
 
Method Summary
 Grid2DSquareCellDouble doFlowAccumulation(Grid2DSquareCellDouble flowAccumulation, Grid2DSquareCellDouble grid, double precipitation, java.util.HashSet outflowCellIDs, Grid2DSquareCellDoubleFactory gridFactory)
          TODO: docs frictionFactor = 75.0d; constant = 8.0d * 9.81d / frictionFactor; velocity = Math.sqrt( constant * waterDepth * changeInDepth / ChangeInLength ); discharge = velocity * waterDepth
 Grid2DSquareCellDouble getFlowAccumulation(Grid2DSquareCellDouble grid, int iterations, double precipitation, java.util.HashSet outflowCellIDs, Grid2DSquareCellDoubleFactory gridFactory)
          There are many estimates of flow that can be generated and many models developed in hydrology.
 Grid2DSquareCellDouble getHollowFilledDEM(Grid2DSquareCellDouble grid, double outflowHeight, int maxIterations, java.util.HashSet outflowCellIDsSet, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble hollowFilledDEM which has cell values as in grid except with any hollows raised so that they are not hollows.
 Grid2DSquareCellDouble getInitialFlowAccumulation(Grid2DSquareCellDouble grid, double precipitation, java.util.HashSet outflowCellIDs, Grid2DSquareCellDoubleFactory gridFactory)
          TODO: docs frictionFactor = 75.0d; constant = 8.0d * 9.81d / frictionFactor; velocity = Math.sqrt( constant * waterDepth * changeInDepth / ChangeInLength ); discharge = velocity * waterDepth
 java.util.HashSet getInitialPeaksHashSetAndSetTheirValue(Grid2DSquareCellDouble grid, Grid2DSquareCellDouble upSlopeAreaMetrics)
          Returns a HashSet containing cellIDs which identifies cells for which neighbouring cells in the immediate 8 cell neighbourhood that are either the same value, lower or noDataValues
 Grid2DSquareCellDouble getMaxFlowDirection(Grid2DSquareCellDouble grid, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble result containing values which indicate the direction of the maximum down slope for the immediate 8 cell neighbourhood.
 Grid2DSquareCellDouble[] getMetrics1(Grid2DSquareCellDouble[] metrics1, Grid2DSquareCellDouble grid, java.math.BigDecimal[] dimensions, double distance, double weightIntersect, double weightFactor)
          Returns an Grid2DSquareCellDouble[] metrics1 where: metrics1[0] = no data count; metrics1[1] = flatness; metrics1[2] = roughness; metrics1[3] = slopyness; metrics1[4] = levelness; metrics1[5] = totalDownness; metrics1[6] = averageDownness; metrics1[7] = totalUpness; metrics1[8] = averageUpness; metrics1[9] = maxd_hhhh [ sum of distance weighted maximum height differences ]; metrics1[10] = mind_hhhh [ sum of distance weighted minimum height differences ]; metrics1[11] = sumd_hhhh [ sum of distance weighted height differences ]; metrics1[12] = aved_hhhh [ sum of distance weighted average height difference ]; metrics1[13] = count_hhhh [ count ]; metrics1[14] = w_hhhh [ sum of distance weights ]; metrics1[15] = mind_hxhx_ai_hhhl [ sum of distance weighted ( minimum difference of cells adjacent to lower cell ) ]; metrics1[16] = maxd_hxhx_ai_hhhl [ sum of distance weighted ( maximum difference of cells adjacent to lower cell ) ]; metrics1[17] = sumd_hxhx_ai_hhhl [ sum of distance weighted ( sum of differences of cells adjacent to lower cell ) ]; metrics1[18] = d_xhxx_ai_hhhl [ sum of distance weighted ( difference of cell opposite lower cell ) ]; metrics1[19] = d_xxxl_ai_hhhl [ sum of distance weighted ( difference of lower cell ) ]; metrics1[20] = sumd_xhxl_ai_hhhl [ sum of distance weighted ( sum of differences of lower cell and cell opposite ) ]; metrics1[21] = mind_abs_xhxl_ai_hhhl [ sum of distance weighted ( minimum difference magnitude of lower cell and cell opposite ) ]; metrics1[22] = maxd_abs_xhxl_ai_hhhl [ sum of distance weighted ( maximum difference magnitude of lower cell and cell opposite ) ]; metrics1[23] = sumd_abs_xhxl_ai_hhhl [ sum of distance weighted ( sum of difference magnitudes of lower cell and cell opposite ) ]; metrics1[24] = count_hhhl [ count ]; metrics1[25] = w_hhhl [ sum of distance weights ]; metrics1[26] = mind_hxhx_ai_hlhl [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[27] = maxd_hxhx_ai_hlhl [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[28] = sumd_hxhx_ai_hlhl [ sum of distance weighted ( sum differences of higher cells ) ]; metrics1[29] = mind_xlxl_ai_hlhl [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[30] = maxd_xlxl_ai_hlhl [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[31] = sumd_xlxl_ai_hlhl [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[32] = mind_abs_hlhl [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[33] = maxd_abs_hlhl [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[34] = sumd_abs_hlhl [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[35] = count_hlhl [ count ]; metrics1[36] = w_hlhl [ sum of distance weights ]; metrics1[37] = mind_hhxx_ai_hhll [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[38] = maxd_hhxx_ai_hhll [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[39] = sumd_hhxx_ai_hhll [ sum of distance weighted ( sum of differences of higher cells ) ]; metrics1[40] = mind_xxll_ai_hhll [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[41] = maxd_xxll_ai_hhll [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[42] = sumd_xxll_ai_hhll [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[43] = mind_abs_hhll [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[44] = maxd_abs_hhll [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[45] = sumd_abs_hhll [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[46] = count_hhll [ count ]; metrics1[47] = w_hhll [ sum of distance weights ]; metrics1[48] = mind_lxlx_ai_lllh [ sum of distance weighted ( minimum difference of cells adjacent to higher cell ) ]; metrics1[49] = maxd_lxlx_ai_lllh [ sum of distance weighted ( maximum difference of cells adjacent to higher cell ) ]; metrics1[50] = sumd_lxlx_ai_lllh [ sum of distance weighted ( sum of differences of cells adjacent to higher cell ) ]; metrics1[51] = d_xlxx_ai_lllh [ sum of distance weighted ( difference of cell opposite higher cell ) ]; metrics1[52] = d_xxxh_ai_lllh [ sum of distance weighted ( difference of higher cell ) ]; metrics1[53] = sumd_xlxh_ai_lllh [ sum of distance weighted ( sum of differences of higher cell and cell opposite ) ]; metrics1[54] = mind_abs_xlxh_ai_lllh [ sum of distance weighted ( minimum difference magnitude of higher cell and cell opposite ) ]; metrics1[55] = maxd_abs_xlxh_ai_lllh [ sum of distance weighted ( maximum difference magnitude of higher cell and cell opposite ) ]; metrics1[56] = sumd_abs_xlxh_ai_lllh [ sum of distance weighted ( sum of difference magnitudes of higher cell and cell opposite ) ]; metrics1[57] = count_lllh [ count ]; metrics1[58] = w_lllh [ sum of distance weights ]; metrics1[59] = maxd_llll [ sum of distance weighted maximum height differences ]; metrics1[60] = mind_llll [ sum of distance weighted minimum height differences ]; metrics1[61] = sumd_llll [ sum of distance weighted height differences ]; metrics1[62] = aved_llll [ sum of distance weighted average height difference ]; metrics1[63] = count_llll [ count ]; metrics1[64] = w_llll [ sum of distance weights ];
 Grid2DSquareCellDouble[] getMetrics1(Grid2DSquareCellDouble grid, double distance, double weightIntersect, double weightFactor, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble[] metrics1 where: metrics1[0] = no data count; metrics1[1] = flatness; metrics1[2] = roughness; metrics1[3] = slopyness; metrics1[4] = levelness; metrics1[5] = totalDownness; metrics1[6] = averageDownness; metrics1[7] = totalUpness; metrics1[8] = averageUpness; metrics1[9] = maxd_hhhh [ sum of distance weighted maximum height differences ]; metrics1[10] = mind_hhhh [ sum of distance weighted minimum height differences ]; metrics1[11] = sumd_hhhh [ sum of distance weighted height differences ]; metrics1[12] = aved_hhhh [ sum of distance weighted average height difference ]; metrics1[13] = count_hhhh [ count ]; metrics1[14] = w_hhhh [ sum of distance weights ]; metrics1[15] = mind_hxhx_ai_hhhl [ sum of distance weighted ( minimum difference of cells adjacent to lower cell ) ]; metrics1[16] = maxd_hxhx_ai_hhhl [ sum of distance weighted ( maximum difference of cells adjacent to lower cell ) ]; metrics1[17] = sumd_hxhx_ai_hhhl [ sum of distance weighted ( sum of differences of cells adjacent to lower cell ) ]; metrics1[18] = d_xhxx_ai_hhhl [ sum of distance weighted ( difference of cell opposite lower cell ) ]; metrics1[19] = d_xxxl_ai_hhhl [ sum of distance weighted ( difference of lower cell ) ]; metrics1[20] = sumd_xhxl_ai_hhhl [ sum of distance weighted ( sum of differences of lower cell and cell opposite ) ]; metrics1[21] = mind_abs_xhxl_ai_hhhl [ sum of distance weighted ( minimum difference magnitude of lower cell and cell opposite ) ]; metrics1[22] = maxd_abs_xhxl_ai_hhhl [ sum of distance weighted ( maximum difference magnitude of lower cell and cell opposite ) ]; metrics1[23] = sumd_abs_xhxl_ai_hhhl [ sum of distance weighted ( sum of difference magnitudes of lower cell and cell opposite ) ]; metrics1[24] = count_hhhl [ count ]; metrics1[25] = w_hhhl [ sum of distance weights ]; metrics1[26] = mind_hxhx_ai_hlhl [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[27] = maxd_hxhx_ai_hlhl [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[28] = sumd_hxhx_ai_hlhl [ sum of distance weighted ( sum differences of higher cells ) ]; metrics1[29] = mind_xlxl_ai_hlhl [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[30] = maxd_xlxl_ai_hlhl [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[31] = sumd_xlxl_ai_hlhl [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[32] = mind_abs_hlhl [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[33] = maxd_abs_hlhl [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[34] = sumd_abs_hlhl [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[35] = count_hlhl [ count ]; metrics1[36] = w_hlhl [ sum of distance weights ]; metrics1[37] = mind_hhxx_ai_hhll [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[38] = maxd_hhxx_ai_hhll [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[39] = sumd_hhxx_ai_hhll [ sum of distance weighted ( sum of differences of higher cells ) ]; metrics1[40] = mind_xxll_ai_hhll [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[41] = maxd_xxll_ai_hhll [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[42] = sumd_xxll_ai_hhll [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[43] = mind_abs_hhll [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[44] = maxd_abs_hhll [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[45] = sumd_abs_hhll [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[46] = count_hhll [ count ]; metrics1[47] = w_hhll [ sum of distance weights ]; metrics1[48] = mind_lxlx_ai_lllh [ sum of distance weighted ( minimum difference of cells adjacent to higher cell ) ]; metrics1[49] = maxd_lxlx_ai_lllh [ sum of distance weighted ( maximum difference of cells adjacent to higher cell ) ]; metrics1[50] = sumd_lxlx_ai_lllh [ sum of distance weighted ( sum of differences of cells adjacent to higher cell ) ]; metrics1[51] = d_xlxx_ai_lllh [ sum of distance weighted ( difference of cell opposite higher cell ) ]; metrics1[52] = d_xxxh_ai_lllh [ sum of distance weighted ( difference of higher cell ) ]; metrics1[53] = sumd_xlxh_ai_lllh [ sum of distance weighted ( sum of differences of higher cell and cell opposite ) ]; metrics1[54] = mind_abs_xlxh_ai_lllh [ sum of distance weighted ( minimum difference magnitude of higher cell and cell opposite ) ]; metrics1[55] = maxd_abs_xlxh_ai_lllh [ sum of distance weighted ( maximum difference magnitude of higher cell and cell opposite ) ]; metrics1[56] = sumd_abs_xlxh_ai_lllh [ sum of distance weighted ( sum of difference magnitudes of higher cell and cell opposite ) ]; metrics1[57] = count_lllh [ count ]; metrics1[58] = w_lllh [ sum of distance weights ]; metrics1[59] = maxd_llll [ sum of distance weighted maximum height differences ]; metrics1[60] = mind_llll [ sum of distance weighted minimum height differences ]; metrics1[61] = sumd_llll [ sum of distance weighted height differences ]; metrics1[62] = aved_llll [ sum of distance weighted average height difference ]; metrics1[63] = count_llll [ count ]; metrics1[64] = w_llll [ sum of distance weights ];
 Grid2DSquareCellDouble[] getMetrics2(Grid2DSquareCellDouble grid, double distance, double weightIntersect, double weightFactor, int samplingDensity, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble[] metrics2 where: TODO: metrics2 is a mess.
protected  double[] getSlopeAndAspect(Grid2DSquareCellDouble grid, double x, double y, double distance, double weightIntersect, double weightFactor)
          Returns a double[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor.
 Grid2DSquareCellDouble[] getSlopeAndAspect(Grid2DSquareCellDouble grid, double distance, double weightIntersect, double weightFactor, Grid2DSquareCellDouble slopeAndAspectDimensions, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor.
 Grid2DSquareCellDouble[] getSlopeAndAspect(Grid2DSquareCellDouble grid, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor.
protected  double[] getSlopeAndAspect(Grid2DSquareCellDouble grid, long rowIndex, long colIndex, double distance, double weightIntersect, double weightFactor)
          Returns a double[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor.
protected  double[] getSlopeAndAspect(Grid2DSquareCellDouble grid, long rowIndex, long colIndex, double x, double y, double distance, double weightIntersect, double weightFactor)
          Returns a double[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor.
 Grid2DSquareCellDouble getUpSlopeAreaMetrics(Grid2DSquareCellDouble grid, double distance, double weightFactor, double weightIntersect, Grid2DSquareCellDoubleFactory gridFactory)
          Returns an Grid2DSquareCellDouble[] each element of which corresponds to a metrics of up slope cells of grid - a DEM The steeper the slope the higher the runoff?
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.process.Grid2DSquareCellProcessor
add, addToGrid, addToGrid, addToGrid, addToGrid, addToGrid, addToGrid, addToGrid, addToGrid, addToGrid, addToGrid, aggregate, aggregate, copyAndSetUpNewLog, distanceToDataValue, divide, freeMemoryOrThrowError, getGrid2DSquareCells, getRowProcessData, getRowProcessInitialData, getTime0, getWorkspace, initWorkspace, linearRescale, linearRescale, log, log, logRescale, logRescale, mask, mask, mask, mask, mask, mask, minus, multiply, replace, setValueALittleBitLarger, setValueALittleBitLarger, setValueALittleBitSmaller, setValueALittleBitSmaller, setWorkspace, setWorkspace
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
clearMemoryReserve, initMemoryReserve, initMemoryReserve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grid2DSquareCellProcessorDEM

public Grid2DSquareCellProcessorDEM()
Creates a new Grid2DSquareCellDoubleProcessorDEM

Method Detail

getSlopeAndAspect

public Grid2DSquareCellDouble[] getSlopeAndAspect(Grid2DSquareCellDouble grid,
                                                  Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the clockwize angle from north. slopeAndAspect[2] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the sine of the clockwize angle from north. slopeAndAspect[3] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the cosine of the clockwize angle from north. (N.B. Effectively no weighting is applied.)

Parameters:
grid - the Grid2DSquareCellDouble to be processed.
gridFactory - the factory used for constructing slopeAndAspect.

getSlopeAndAspect

public Grid2DSquareCellDouble[] getSlopeAndAspect(Grid2DSquareCellDouble grid,
                                                  double distance,
                                                  double weightIntersect,
                                                  double weightFactor,
                                                  Grid2DSquareCellDouble slopeAndAspectDimensions,
                                                  Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the clockwize angle from north. slopeAndAspect[2] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the sine of the clockwize angle from north. slopeAndAspect[3] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the cosine of the clockwize angle from north.

Parameters:
grid - the Grid2DSquareCellDouble to be processed.
distance - the distance which defines the aggregate region.
weightIntersect - the kernel weighting weight at centre.
weightFactor - the kernel weighting distance decay.
slopeAndAspectDimensions - is an AbstractGrid2DSquareCellDouble used for setting the resolutions, dimensions and noDataValue of slopeAndAspect.
gridFactory - the factory used for generating slopeAndAspect. (NB. There are various strategies to reduce bias caused by noDataValues. Here: If the cell in grid for which slopeAndAspect is being calculated is a noDataValue then the cells in slopeAndAspect are assigned their noDataValue. If one of the cells in the calculation of slope and aspect is a noDataValue then its height is taken as the nearest cell value. (Formerly the difference in its height was taken as the average difference in height for those cells with values.) )

getSlopeAndAspect

protected double[] getSlopeAndAspect(Grid2DSquareCellDouble grid,
                                     long rowIndex,
                                     long colIndex,
                                     double distance,
                                     double weightIntersect,
                                     double weightFactor)
Returns a double[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the clockwize angle from north. slopeAndAspect[2] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the sine of the clockwize angle from north. slopeAndAspect[3] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the cosine of the clockwize angle from north.

Parameters:
grid - the Grid2DSquareCellDouble to be processed.
rowIndex - the rowIndex where slopeAndAspect is calculated.
colIndex - the colIndex where slopeAndAspect is calculated.
distance - the distance which defines the aggregate region.
weightIntersect - the kernel weighting weight at centre.
weightFactor - the kernel weighting distance decay.

getSlopeAndAspect

protected double[] getSlopeAndAspect(Grid2DSquareCellDouble grid,
                                     double x,
                                     double y,
                                     double distance,
                                     double weightIntersect,
                                     double weightFactor)
Returns a double[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the clockwize angle from north. slopeAndAspect[2] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the sine of the clockwize angle from north. slopeAndAspect[3] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the cosine of the clockwize angle from north.

Parameters:
grid - the Grid2DSquareCellDouble to be processed.
x - the x coordinate from where the aspect is calculated
y - the y coordinate from where the aspect is calculated
distance - the distance which defines the aggregate region.
weightIntersect - the kernel weighting weight at centre.
weightFactor - the kernel weighting distance decay.

getSlopeAndAspect

protected double[] getSlopeAndAspect(Grid2DSquareCellDouble grid,
                                     long rowIndex,
                                     long colIndex,
                                     double x,
                                     double y,
                                     double distance,
                                     double weightIntersect,
                                     double weightFactor)
Returns a double[] slopeAndAspect where: slopeAndAspect[0] is the aggregate slope over the region weighted by distance, weightIntersect and weightFactor; slopeAndAspect[1] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the clockwize angle from north. slopeAndAspect[2] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the sine of the clockwize angle from north. slopeAndAspect[3] is the aggregate aspect over the region weighted by distance, weightIntersect and weightFactor. This is the cosine of the clockwize angle from north.

Parameters:
grid - - the Grid2DSquareCellDouble to be processed
rowIndex - the rowIndex where the result is calculated
colIndex - the colIndex where the result is calculated
x - the x coordinate from where the aspect is calculated
y - the y coordinate from where the aspect is calculated
distance - the distance which defines the region
weightIntersect -
weightFactor - NB. If grid.getCell( x, y ) == grid.getNoDataValue() then; result[ 0 ] = grid.getNoDataValue() result[ 1 ] = grid.getNoDataValue() TODO: x and y can be offset from a cell centroid so consider interpolation

getHollowFilledDEM

public Grid2DSquareCellDouble getHollowFilledDEM(Grid2DSquareCellDouble grid,
                                                 double outflowHeight,
                                                 int maxIterations,
                                                 java.util.HashSet outflowCellIDsSet,
                                                 Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble hollowFilledDEM which has cell values as in grid except with any hollows raised so that they are not hollows. All cells with height < outflowFilling is done by finding all hollows DEM TODO: docs

Parameters:
grid - the Grid2DSquareCellDouble to be processed

getMetrics1

public Grid2DSquareCellDouble[] getMetrics1(Grid2DSquareCellDouble grid,
                                            double distance,
                                            double weightIntersect,
                                            double weightFactor,
                                            Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble[] metrics1 where: metrics1[0] = no data count; metrics1[1] = flatness; metrics1[2] = roughness; metrics1[3] = slopyness; metrics1[4] = levelness; metrics1[5] = totalDownness; metrics1[6] = averageDownness; metrics1[7] = totalUpness; metrics1[8] = averageUpness; metrics1[9] = maxd_hhhh [ sum of distance weighted maximum height differences ]; metrics1[10] = mind_hhhh [ sum of distance weighted minimum height differences ]; metrics1[11] = sumd_hhhh [ sum of distance weighted height differences ]; metrics1[12] = aved_hhhh [ sum of distance weighted average height difference ]; metrics1[13] = count_hhhh [ count ]; metrics1[14] = w_hhhh [ sum of distance weights ]; metrics1[15] = mind_hxhx_ai_hhhl [ sum of distance weighted ( minimum difference of cells adjacent to lower cell ) ]; metrics1[16] = maxd_hxhx_ai_hhhl [ sum of distance weighted ( maximum difference of cells adjacent to lower cell ) ]; metrics1[17] = sumd_hxhx_ai_hhhl [ sum of distance weighted ( sum of differences of cells adjacent to lower cell ) ]; metrics1[18] = d_xhxx_ai_hhhl [ sum of distance weighted ( difference of cell opposite lower cell ) ]; metrics1[19] = d_xxxl_ai_hhhl [ sum of distance weighted ( difference of lower cell ) ]; metrics1[20] = sumd_xhxl_ai_hhhl [ sum of distance weighted ( sum of differences of lower cell and cell opposite ) ]; metrics1[21] = mind_abs_xhxl_ai_hhhl [ sum of distance weighted ( minimum difference magnitude of lower cell and cell opposite ) ]; metrics1[22] = maxd_abs_xhxl_ai_hhhl [ sum of distance weighted ( maximum difference magnitude of lower cell and cell opposite ) ]; metrics1[23] = sumd_abs_xhxl_ai_hhhl [ sum of distance weighted ( sum of difference magnitudes of lower cell and cell opposite ) ]; metrics1[24] = count_hhhl [ count ]; metrics1[25] = w_hhhl [ sum of distance weights ]; metrics1[26] = mind_hxhx_ai_hlhl [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[27] = maxd_hxhx_ai_hlhl [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[28] = sumd_hxhx_ai_hlhl [ sum of distance weighted ( sum differences of higher cells ) ]; metrics1[29] = mind_xlxl_ai_hlhl [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[30] = maxd_xlxl_ai_hlhl [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[31] = sumd_xlxl_ai_hlhl [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[32] = mind_abs_hlhl [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[33] = maxd_abs_hlhl [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[34] = sumd_abs_hlhl [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[35] = count_hlhl [ count ]; metrics1[36] = w_hlhl [ sum of distance weights ]; metrics1[37] = mind_hhxx_ai_hhll [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[38] = maxd_hhxx_ai_hhll [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[39] = sumd_hhxx_ai_hhll [ sum of distance weighted ( sum of differences of higher cells ) ]; metrics1[40] = mind_xxll_ai_hhll [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[41] = maxd_xxll_ai_hhll [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[42] = sumd_xxll_ai_hhll [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[43] = mind_abs_hhll [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[44] = maxd_abs_hhll [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[45] = sumd_abs_hhll [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[46] = count_hhll [ count ]; metrics1[47] = w_hhll [ sum of distance weights ]; metrics1[48] = mind_lxlx_ai_lllh [ sum of distance weighted ( minimum difference of cells adjacent to higher cell ) ]; metrics1[49] = maxd_lxlx_ai_lllh [ sum of distance weighted ( maximum difference of cells adjacent to higher cell ) ]; metrics1[50] = sumd_lxlx_ai_lllh [ sum of distance weighted ( sum of differences of cells adjacent to higher cell ) ]; metrics1[51] = d_xlxx_ai_lllh [ sum of distance weighted ( difference of cell opposite higher cell ) ]; metrics1[52] = d_xxxh_ai_lllh [ sum of distance weighted ( difference of higher cell ) ]; metrics1[53] = sumd_xlxh_ai_lllh [ sum of distance weighted ( sum of differences of higher cell and cell opposite ) ]; metrics1[54] = mind_abs_xlxh_ai_lllh [ sum of distance weighted ( minimum difference magnitude of higher cell and cell opposite ) ]; metrics1[55] = maxd_abs_xlxh_ai_lllh [ sum of distance weighted ( maximum difference magnitude of higher cell and cell opposite ) ]; metrics1[56] = sumd_abs_xlxh_ai_lllh [ sum of distance weighted ( sum of difference magnitudes of higher cell and cell opposite ) ]; metrics1[57] = count_lllh [ count ]; metrics1[58] = w_lllh [ sum of distance weights ]; metrics1[59] = maxd_llll [ sum of distance weighted maximum height differences ]; metrics1[60] = mind_llll [ sum of distance weighted minimum height differences ]; metrics1[61] = sumd_llll [ sum of distance weighted height differences ]; metrics1[62] = aved_llll [ sum of distance weighted average height difference ]; metrics1[63] = count_llll [ count ]; metrics1[64] = w_llll [ sum of distance weights ];

Parameters:
grid - the Grid2DSquareCellDouble to be processed
distance - the distance within which metrics will be calculated
weightIntersect - kernel parameter ( weight at the centre )
weightFactor - kernel parameter ( distance decay )
gridFactory - the preferred factory for creating grids

getMetrics1

public Grid2DSquareCellDouble[] getMetrics1(Grid2DSquareCellDouble[] metrics1,
                                            Grid2DSquareCellDouble grid,
                                            java.math.BigDecimal[] dimensions,
                                            double distance,
                                            double weightIntersect,
                                            double weightFactor)
Returns an Grid2DSquareCellDouble[] metrics1 where: metrics1[0] = no data count; metrics1[1] = flatness; metrics1[2] = roughness; metrics1[3] = slopyness; metrics1[4] = levelness; metrics1[5] = totalDownness; metrics1[6] = averageDownness; metrics1[7] = totalUpness; metrics1[8] = averageUpness; metrics1[9] = maxd_hhhh [ sum of distance weighted maximum height differences ]; metrics1[10] = mind_hhhh [ sum of distance weighted minimum height differences ]; metrics1[11] = sumd_hhhh [ sum of distance weighted height differences ]; metrics1[12] = aved_hhhh [ sum of distance weighted average height difference ]; metrics1[13] = count_hhhh [ count ]; metrics1[14] = w_hhhh [ sum of distance weights ]; metrics1[15] = mind_hxhx_ai_hhhl [ sum of distance weighted ( minimum difference of cells adjacent to lower cell ) ]; metrics1[16] = maxd_hxhx_ai_hhhl [ sum of distance weighted ( maximum difference of cells adjacent to lower cell ) ]; metrics1[17] = sumd_hxhx_ai_hhhl [ sum of distance weighted ( sum of differences of cells adjacent to lower cell ) ]; metrics1[18] = d_xhxx_ai_hhhl [ sum of distance weighted ( difference of cell opposite lower cell ) ]; metrics1[19] = d_xxxl_ai_hhhl [ sum of distance weighted ( difference of lower cell ) ]; metrics1[20] = sumd_xhxl_ai_hhhl [ sum of distance weighted ( sum of differences of lower cell and cell opposite ) ]; metrics1[21] = mind_abs_xhxl_ai_hhhl [ sum of distance weighted ( minimum difference magnitude of lower cell and cell opposite ) ]; metrics1[22] = maxd_abs_xhxl_ai_hhhl [ sum of distance weighted ( maximum difference magnitude of lower cell and cell opposite ) ]; metrics1[23] = sumd_abs_xhxl_ai_hhhl [ sum of distance weighted ( sum of difference magnitudes of lower cell and cell opposite ) ]; metrics1[24] = count_hhhl [ count ]; metrics1[25] = w_hhhl [ sum of distance weights ]; metrics1[26] = mind_hxhx_ai_hlhl [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[27] = maxd_hxhx_ai_hlhl [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[28] = sumd_hxhx_ai_hlhl [ sum of distance weighted ( sum differences of higher cells ) ]; metrics1[29] = mind_xlxl_ai_hlhl [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[30] = maxd_xlxl_ai_hlhl [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[31] = sumd_xlxl_ai_hlhl [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[32] = mind_abs_hlhl [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[33] = maxd_abs_hlhl [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[34] = sumd_abs_hlhl [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[35] = count_hlhl [ count ]; metrics1[36] = w_hlhl [ sum of distance weights ]; metrics1[37] = mind_hhxx_ai_hhll [ sum of distance weighted ( minimum difference of higher cells ) ]; metrics1[38] = maxd_hhxx_ai_hhll [ sum of distance weighted ( maximum difference of higher cells ) ]; metrics1[39] = sumd_hhxx_ai_hhll [ sum of distance weighted ( sum of differences of higher cells ) ]; metrics1[40] = mind_xxll_ai_hhll [ sum of distance weighted ( minimum difference of lower cells ) ]; metrics1[41] = maxd_xxll_ai_hhll [ sum of distance weighted ( maximum difference of lower cells ) ]; metrics1[42] = sumd_xxll_ai_hhll [ sum of distance weighted ( sum of differences of lower cells ) ]; metrics1[43] = mind_abs_hhll [ sum of distance weighted ( minimum difference magnitude of cells ) ]; metrics1[44] = maxd_abs_hhll [ sum of distance weighted ( maximum difference magnitude of cells ) ]; metrics1[45] = sumd_abs_hhll [ sum of distance weighted ( sum of difference magnitudes of cells ) ]; metrics1[46] = count_hhll [ count ]; metrics1[47] = w_hhll [ sum of distance weights ]; metrics1[48] = mind_lxlx_ai_lllh [ sum of distance weighted ( minimum difference of cells adjacent to higher cell ) ]; metrics1[49] = maxd_lxlx_ai_lllh [ sum of distance weighted ( maximum difference of cells adjacent to higher cell ) ]; metrics1[50] = sumd_lxlx_ai_lllh [ sum of distance weighted ( sum of differences of cells adjacent to higher cell ) ]; metrics1[51] = d_xlxx_ai_lllh [ sum of distance weighted ( difference of cell opposite higher cell ) ]; metrics1[52] = d_xxxh_ai_lllh [ sum of distance weighted ( difference of higher cell ) ]; metrics1[53] = sumd_xlxh_ai_lllh [ sum of distance weighted ( sum of differences of higher cell and cell opposite ) ]; metrics1[54] = mind_abs_xlxh_ai_lllh [ sum of distance weighted ( minimum difference magnitude of higher cell and cell opposite ) ]; metrics1[55] = maxd_abs_xlxh_ai_lllh [ sum of distance weighted ( maximum difference magnitude of higher cell and cell opposite ) ]; metrics1[56] = sumd_abs_xlxh_ai_lllh [ sum of distance weighted ( sum of difference magnitudes of higher cell and cell opposite ) ]; metrics1[57] = count_lllh [ count ]; metrics1[58] = w_lllh [ sum of distance weights ]; metrics1[59] = maxd_llll [ sum of distance weighted maximum height differences ]; metrics1[60] = mind_llll [ sum of distance weighted minimum height differences ]; metrics1[61] = sumd_llll [ sum of distance weighted height differences ]; metrics1[62] = aved_llll [ sum of distance weighted average height difference ]; metrics1[63] = count_llll [ count ]; metrics1[64] = w_llll [ sum of distance weights ];

Parameters:
metrics1 - an Grid2DSquareCellDouble[] for storing result
grid - the Grid2DSquareCellDouble to be processed
distance - the distance within which metrics will be calculated
weightIntersect - kernel parameter ( weight at the centre )
weightFactor - kernel parameter ( distance decay ) Going directly to this method is useful if the initialisation of the metrics1 is slow and has already been done.

getMetrics2

public Grid2DSquareCellDouble[] getMetrics2(Grid2DSquareCellDouble grid,
                                            double distance,
                                            double weightIntersect,
                                            double weightFactor,
                                            int samplingDensity,
                                            Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble[] metrics2 where: TODO: metrics2 is a mess. Need to decide what to do with regard to contour tracing and profile trace for axes and comparisons. metrics2[0] = slope; metrics2[1] = aspect; metrics2[2] = no data count; metrics2[3] = contourConcavity; metrics2[4] = contourConvexity; metrics2[5] = profileConcavity; metrics2[6] = profileConvexity;


getMaxFlowDirection

public Grid2DSquareCellDouble getMaxFlowDirection(Grid2DSquareCellDouble grid,
                                                  Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble result containing values which indicate the direction of the maximum down slope for the immediate 8 cell neighbourhood. 1 2 3 4 0 5 6 7 8 If there is no downhill slope then the flow direction is 0.

Parameters:
grid - the Grid2DSquareCellDouble to be processed
gridFactory - the Grid2DSquareCellDoubleFactory used to create result

getUpSlopeAreaMetrics

public Grid2DSquareCellDouble getUpSlopeAreaMetrics(Grid2DSquareCellDouble grid,
                                                    double distance,
                                                    double weightFactor,
                                                    double weightIntersect,
                                                    Grid2DSquareCellDoubleFactory gridFactory)
Returns an Grid2DSquareCellDouble[] each element of which corresponds to a metrics of up slope cells of grid - a DEM The steeper the slope the higher the runoff?


getInitialPeaksHashSetAndSetTheirValue

public java.util.HashSet getInitialPeaksHashSetAndSetTheirValue(Grid2DSquareCellDouble grid,
                                                                Grid2DSquareCellDouble upSlopeAreaMetrics)
Returns a HashSet containing cellIDs which identifies cells for which neighbouring cells in the immediate 8 cell neighbourhood that are either the same value, lower or noDataValues

Parameters:
grid - - the Grid2DSquareCellDouble to be processed

getFlowAccumulation

public Grid2DSquareCellDouble getFlowAccumulation(Grid2DSquareCellDouble grid,
                                                  int iterations,
                                                  double precipitation,
                                                  java.util.HashSet outflowCellIDs,
                                                  Grid2DSquareCellDoubleFactory gridFactory)
There are many estimates of flow that can be generated and many models developed in hydrology. These methods are simplistic but are based on the work of others. The basics are that discharge from any cell is a simple mutliple of velocity and depth. A measure of velocity can be obtained by measuring slope and the depth of discharge itself where the slope is given by the change in height divided by the distance. The algorithm is this: An Grid2DSquareCellDouble height is initialised using grid A coincident Grid2DSquareCellDouble accumulation is initialised Step 1: A value of rainfall is added to all cells in accumulation. Step 2: A proportion of this rainfall is then distributed to neighbouring cells based on Mannings discharge equations. proportionally based on the difference in height of neighbouring cells which are down slope. If no immediate neighbours are downslope then the height cell is raised by value. Step 3: Repeat Steps 2 and 3 iterations number of times. Step 4: Return height and accumulation. NB Care needs to be taken to specify outflow cells TODO: 1. Change precipitation to be a grid 2. Variable frictionFactor


getInitialFlowAccumulation

public Grid2DSquareCellDouble getInitialFlowAccumulation(Grid2DSquareCellDouble grid,
                                                         double precipitation,
                                                         java.util.HashSet outflowCellIDs,
                                                         Grid2DSquareCellDoubleFactory gridFactory)
TODO: docs frictionFactor = 75.0d; constant = 8.0d * 9.81d / frictionFactor; velocity = Math.sqrt( constant * waterDepth * changeInDepth / ChangeInLength ); discharge = velocity * waterDepth


doFlowAccumulation

public Grid2DSquareCellDouble doFlowAccumulation(Grid2DSquareCellDouble flowAccumulation,
                                                 Grid2DSquareCellDouble grid,
                                                 double precipitation,
                                                 java.util.HashSet outflowCellIDs,
                                                 Grid2DSquareCellDoubleFactory gridFactory)
TODO: docs frictionFactor = 75.0d; constant = 8.0d * 9.81d / frictionFactor; velocity = Math.sqrt( constant * waterDepth * changeInDepth / ChangeInLength ); discharge = velocity * waterDepth