Accumulate flow, given flow directions and weights.

accumulate_flow(directions, weights, wrapX, wrapY)

Arguments

directions

a matrix of flow directions, where directions are represented by the following values:

  • east: 1

  • southeast: 2

  • south: 4

  • southwest: 8

  • west: 16

  • northwest: 32

  • north: 64

  • northeast: 128

  • none (sink cell): NA

weights

a matrix of weights, representing the amount of flow originating at each cell

wrapX

should flow exiting the X-limits of the model be routed to the other side?

wrapY

should flow exiting the Y-limits of the model be routed to the other side?

Value

a matrix of accumulated flow values