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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up terrain attribute calculation using convolution #486

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhugonnet
Copy link
Contributor

@rhugonnet rhugonnet commented Mar 12, 2024

Ongoing

Resolves #302

For the (frequent) case of desiring no edge-filling or nodata-filling method during terrain attribute derivation, we can use a 3D convolution (already implemented with a function hidden in spatialstats.py) for fast computing of terrain attributes. This should work for almost all but fractal rugosity. Convolution can be done through SciPy or Numba (which one is fastest depends on matrix size and convolution kernel size).

Additionally, our current functions are deriving all coefficients of Zevenberg and Thorne (A, B, C, ... to I), while less than half are typically used for terrain attributes! (A, B, C and I are virtually useless, and D, E and F only required for curvature).

To-do

  • Add implementation for windowed attributes,
  • Add tests,
  • Homogenize current implementation to support the new functions.

Bonus?

  • Check if we can't derive 2D planar fit coefficients analytically for a certain grid size and turn them into kernels (we should be able to!)... To provide the means of deriving slope/aspect/curvature over any grid size! 馃槃

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

Successfully merging this pull request may close these issues.

Vectorize terrain.py methods
1 participant