Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: support conversion of other flow direction formats #495

Open
AlisterH opened this issue Feb 18, 2023 · 2 comments
Open

Suggestion: support conversion of other flow direction formats #495

AlisterH opened this issue Feb 18, 2023 · 2 comments

Comments

@AlisterH
Copy link

AlisterH commented Feb 18, 2023

There are many programs which produce flow direction rasters, and almost every one seems to use a different convention. There are reasons why some of these programs would be used in preference to others.
It is particularly strange to me that crayfish supports converting from PCRaster and SAGA, but not from GRASS, which is more reliably available in QGIS.
I found that a simple edit to dir_map = {} meant I could convert from GRASS output instead of PCRaster output:

        dir_map = {
            2: (1e-7, 1),
            1: (diag, diag),
            8: (1, 1e-7),
            7: (diag, -diag),
            6: (1e-7, -1),
            5: (-diag, -diag),
            4: (-1, 1e-7),
            3: (-diag, diag)
        }

There are also input cells containing -2, -4, -6 and -8, where there is edge contamination. I'm not sure if they should be treated the same as 2, 4, 6 and 8, or ignored.

Since it is essentially only a list of numbers that needs to change to support different conventions, rather than having separate tools for converting inputs with different conventions to grib, you could have a single tool which allows to specify the convention.
As a workaround, users could run some other tool (perhaps even just generating a VRT) to reclassify their input to match PCRaster or SAGA convention, but this isn't very accessible - users have to know what's going on and find out the convention that the different programs use.

@AlisterH
Copy link
Author

AlisterH commented Feb 18, 2023

Here are some other conventions I gleaned from the internet:

Taudem

4	3	2
5		1
6	7	8

Whitebox

64	128	1
32	0	2
16	8	4

RichDEM

2	3	4
1	0	5
8	7	6

PySheds

32	64	128
16		1
8	4	2

Others I haven't checked:
LSDTopotools
?

@AlisterH
Copy link
Author

AlisterH commented Feb 18, 2023

As a workaround, users could run some other tool (perhaps even just generating a VRT) to reclassify their input to match PCRaster or SAGA convention, but this isn't very accessible - users have to know what's going on and find out the convention that the different programs use.

Of course, a user might actually have other reasons to convert from one flow direction format to another (e.g. to compare the output of different programs, or apply the same style to the output from different programs), so perhaps a separate tool to convert flow direction formats would be more useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant