Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells...

9
Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes

Transcript of Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells...

Page 1: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

Routine Performed for Each Origin Cell

There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes

Page 2: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

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

arrays/lists

1. Extract Data to Array(s)

Page 3: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

Movement:Origin Pixel Value = 1“1” Translates to (c+1, r)

2. Move

'X Coordinate CodesxC(1) = 1xC(2) = 1xC(4) = 0xC(8) = -1xC(16) = -1xC(32) = -1xC(64) = 0xC(128) = 1

'Y Coordinate CodesyC(1) = 0yC(2) = 1yC(4) = 1yC(8) = 1yC(16) = 0yC(32) = -1yC(64) = -1yC(128) = -1

For N = 1 To 8 NextPixel = pPixels(c + xC(N), r + yC(N)) …Next

???If statement vs array for translating???

Page 4: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

Get data from all layers that corresponds to current cell coordinates, and store in temporary array(s).

arrays/lists

3. Extract Data to Array(s)

Page 5: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

Movement:Origin Pixel Value = 1“2” Translates to (c+1, r+1)

2. Move

'X Coordinate CodesxC(1) = 1xC(2) = 1xC(4) = 0xC(8) = -1xC(16) = -1xC(32) = -1xC(64) = 0xC(128) = 1

'Y Coordinate CodesyC(1) = 0yC(2) = 1yC(4) = 1yC(8) = 1yC(16) = 0yC(32) = -1yC(64) = -1yC(128) = -1

For N = 1 To 8 NextPixel = pPixels(c + xC(N), r + yC(N)) …Next

???If statement vs array for translating???

Page 6: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

Get data from all layers that corresponds to current cell coordinates, and store in temporary array(s).

arrays/lists

3. Extract Data to Array(s)

Page 7: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

4. Stop

A stop condition is met, we are at the edge

Page 8: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

origin

STOP

1 1 2

2

2

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).

arrays/lists

5. Calculate

01234

01234

01234

01234

The flow path sequence is preserved in the index of the array

Math Machine

output raster(s)

1 set per origin pixelWrites to corresponding cell

Page 9: Routine Performed for Each Origin Cell There is another set of loops that cycle through Origin Cells once the D8 Neighbor procedure completes.

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