richdem icon indicating copy to clipboard operation
richdem copied to clipboard

Access flow direction array directly

Open smultsch opened this issue 4 years ago • 2 comments

Hello Richards,

I have started to work with the richdem Python package. It is a great tool! I am using winpython37 and the tools works out of the box just by using the pip installer.

I have two question/request which would greatly help me in my current work:

(1) Is there a function to access the flow coordinate system (https://richdem.readthedocs.io/en/latest/flow_metrics.html), so the values which indicate the next cell by an integer value between 1 and 8? I implemented a Python version of D8 as well, but with a very limited functionality. So, your tool fits quite well for my current work. But I want to plot the flow directions as arrows colored by the altitude (see the attached figure). I have a function which can do that, but I need the flow coordinate system.

(2) Is there a way to include a predefined stream network for catchment processing? For example, the model SWAT holds the option to consider a stream network (poly line) when creating the sub-catchments.

Would be great if you could address my questions.

Best regards, Sebastian

smultsch avatar Aug 05 '19 05:08 smultsch

Hi there,

are there any news about this question? I need a similar output and would be happy to use the available tools.

cheers,

Stefan

sluedtke avatar Dec 10 '20 13:12 sluedtke

A related pure-python package can do this, see the builder examples in pygsflow. It has a different flow direction coordinate system; one can map one to another with the following dict:

d8_map = {5: 1, 6: 2, 7: 4, 8: 8, 1: 16, 2: 32, 3: 64, 4: 128}

Where key, value is richdem direction, pygsflow direction.

I have found myself taking advantage of RichDEM for it's speed, and using high-level functions from pygsflow to get stream networks, etc.

dgketchum avatar Mar 31 '22 19:03 dgketchum