It calculates the drainage directions with the method of the maximal steepest descent slope, choosing it among 8 possible directions around the selected pixel.

Inputs



Output



Notes

The maximal slope direction is chosen among the 8 possible directions and codified with numbers ranging from 0 to 8. Such method derives from the one originarily used by D. Tarboton in his Phd thesis. However the outlets are marked with value 10 (beware: many other programs assume it).