-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add terrain attributes (TRI, TPI, Roughness, Rugosity), add methods of slope, aspect, hillshade and test robustness against GDAL and richDEM #227
Conversation
Update upstream
Wow, amazing work @rhugonnet !! What was the small issue that fixed the GDAL difference? Also, would all analyses be possible with your new |
Could you also add documentation entries for the new terrain attributes? |
Yes, added in the to-do-list. |
…nto new_terrainattr
…eed of resolution, and fix doctests
…ope/aspect, tests on errors raised, changed default edge and fill methods to None and adjusted doctests
When starting this PR again, there was a couple of failures in tests that had nothing to do with |
EDIT: this is solved, see below.
|
… modify thumbnails and link those examples to the documentation chapter
This is solved, I filtered the warning as it was done for other attributes (e.g. curvatures). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew, what a work ! Well done !! 👏
I honestly did not have the time to check each line of code, but overall it seems well documented and well tested. I'm happy to merge and add issue if they arise later.
Summary of final draft
This PR adds several attributes:
I refer to the new documentation for more detailed description and references 😉.
All the above are now tested to be exactly the same results as GDALDEM within a small tolerance (10e-3 the magnitude of the attribute). For rugosity, specific tests using simplified cases are used, and another single test is based on the example illustrated in the publication itself.
This PR also adds a wrapper around richDEM, which can be used to generate attributes available there (slope, aspect, curvatures). It is also now used to rigorously test the curvatures, that do not exist in GDALDEM, and added to the dev dependencies.
The PR also fixes some existing issues:
Finally, the PR improves the documentation and testing:
Resolves #168
Resolves #169
Resolves #170
Resolves #127
Resolves #201
Resolves #263
In terms of structure, the terrain attributes functions are based on either
get_quadric_coefficients
for 3x3 windows where calculations requires resolution,get_windowed_indexes
for NxN windows where calculations do not require resolution,This structure could change in time (for efficiency, potentially), but at this stage I deemed it satisfactory as performance is not a big issue.
Old comments and to-do-list (edited down)
To add on Erik's terrain features. Now we'd have everything that also exists in GDAL!
I also added references to the papers that first came up with these calculations everywhere.
For the TRI, TPI and roughness, I coded the cases where the window size can be adjusted, so not only 3x3 but any size can be used as input :).
I'm getting some differences in the tests right now (not major, but unexplained as yet). It was already the case for the
slope
andaspect
of Erik. There exist two main algorithms for those, and we have the means of calculating the two.Next steps: