For each pixel, compute which cells drain _into_ that pixel.

create_inward_dir_matrix(directions, 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

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

Matrix containing the summed direction values of all adjacent pixels that flow into this pixel. Value is zero if no adjacent pixels flow into this pixel (i.e, the pixel is a sink.)