3

does anyone have any resources for scripting the D8 flow accumulation in Python or MATLAB after obtaining the flow direction values and filling in 'sinks' and 'flats'?

I am trying to understand the logic so that I can apply a similar algorithm to a land use raster.

2

3 Answers 3

4

You might want to have a look at these Matlab functions

http://www.mathworks.com/matlabcentral/fileexchange/50124-topotoolbox

More specificaly, you can generate a flow accumulation matrix using

DEM = GRIDobj('YourRaster.tif');
FD = FLOWobj(DEM,'preprocess','carve');
A = flowacc(FD);
2
  • I think he/she wants the source not the arguments. Jan 15, 2016 at 16:27
  • 1
    Hein? He is asking for a Matlab or Python source program. Just click on the link download the functions, open it and read ? Feb 2, 2016 at 14:52
3

David Tarboton does a good job of breaking it down at http://hydrology.usu.edu/taudem/taudem5/help53/D8FlowDirections.html

basically as does Jenson.

Jenson, S. K., and J. O. Domingue. 1988. "Extracting Topographic Structure from Digital Elevation Data for Geographic Information System Analysis." Photogrammetric Engineering and Remote Sensing 54 (11): 1593–1600.

It is really quite simple.

  1. Slope (usually standard nine pixel Kernel using rise over run)

enter image description here

  1. Convert steepest slope of each pixel to a convention, see center small bit below. North is 64 in this convention.

enter image description here

  1. Now accumulate.

When two slopes are equal in step 2 just expand the search region (using only the equal slopes) until one becomes steeper.

1

If you are talking about Deterministic Modelling, you can look at PCRaster Python Framework

There is a chapter which talks about Deterministic Modelling and provides examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.