r-barnes / richdem

High-performance Terrain and Hydrology Analysis
GNU General Public License v3.0
261 stars 66 forks source link

Access flow direction array directly #29

Open smultsch opened 5 years ago

smultsch commented 5 years ago

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

sluedtke commented 3 years ago

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

dgketchum commented 2 years ago

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.