90 likes | 195 Views
Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes. 1. Extract Data to Array(s). Get data from all layers that corresponds to current cell coordinates, and store in temporary array(s).
E N D
Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes
1. Extract Data to Array(s) Get data from all layers that corresponds to current cell coordinates, and store in temporary array(s). Using a dynamic array probably best since the number of rows is unknown origin 1 1 2 2 2 STOP arrays/lists
2. Move Movement: Origin Pixel Value = 1 “1” Translates to (c+1, r) origin 1 1 2 2 ???If statement vs array for translating??? 2 STOP 'X Coordinate Codes xC(1) = 1 xC(2) = 1 xC(4) = 0 xC(8) = -1 xC(16) = -1 xC(32) = -1 xC(64) = 0 xC(128) = 1 'Y Coordinate Codes yC(1) = 0 yC(2) = 1 yC(4) = 1 yC(8) = 1 yC(16) = 0 yC(32) = -1 yC(64) = -1 yC(128) = -1 For N = 1 To 8 NextPixel = pPixels(c + xC(N), r + yC(N)) … Next
3. Extract Data to Array(s) Get data from all layers that corresponds to current cell coordinates, and store in temporary array(s). origin 1 1 2 2 2 STOP arrays/lists
2. Move Movement: Origin Pixel Value = 1 “2” Translates to (c+1, r+1) origin 1 1 2 2 ???If statement vs array for translating??? 2 STOP 'X Coordinate Codes xC(1) = 1 xC(2) = 1 xC(4) = 0 xC(8) = -1 xC(16) = -1 xC(32) = -1 xC(64) = 0 xC(128) = 1 'Y Coordinate Codes yC(1) = 0 yC(2) = 1 yC(4) = 1 yC(8) = 1 yC(16) = 0 yC(32) = -1 yC(64) = -1 yC(128) = -1 For N = 1 To 8 NextPixel = pPixels(c + xC(N), r + yC(N)) … Next
3. Extract Data to Array(s) Get data from all layers that corresponds to current cell coordinates, and store in temporary array(s). origin 1 1 2 2 2 STOP arrays/lists
4. Stop origin 1 1 2 A stop condition is met, we are at the edge 2 2 STOP
5. Calculate Once STOP is met, the array(s) can be combined in many ways and then the result(s) are written to the location of the origin cell on the output raster(s). origin 1 1 2 The flow path sequence is preserved in the index of the array 2 0 1 2 3 4 2 STOP 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 arrays/lists Writes to corresponding cell Math Machine 1 set per origin pixel output raster(s)
6. RINSE AND REPEAT Data are cleared from the temporary arrays, and we start with a new origin pixel The term Origin Pixel really refers to a starting location in an array, because the whole time we are dealing with arrays