xdem icon indicating copy to clipboard operation
xdem copied to clipboard

[POC] dem_processing from demcompare

Open adebardo opened this issue 1 year ago • 1 comments

Context

The purpose of this ticket is to implement the dem_processing methods from demcompare into xdem. We propose following a similar approach as described in this ticket but this time by copying the dem_processing directory into xdem.

This directory includes the following calculations:

  1. The elevation difference between two DEMs
  2. The elevation difference according to the slope norm between two DEMs
  3. The angular difference between two DEMs
  4. The curvature of the reference DEM
  5. The curvature of the secondary DEM

Code

Once the directory is copied, the following changes need to be made:

  • [ ] Replace DEM datasets with the DEM class from xdem.
    • [ ] Pay attention to function parameters
    • [ ] Update function signatures
    • [ ] Adjust the methods for accessing attributes
    • [ ] Replace the create_dem functions

Tests

Retrieve this file: https://github.com/CNES/demcompare/blob/master/tests/dem_processing/test_dem_processing_methods.py

and make the necessary modifications.

Documentation

Add a section to the xdem documentation inspired by demcompare: https://demcompare.readthedocs.io/en/latest/userguide/statistics/dem_processing.html

Estimation:

4 days

adebardo avatar Aug 26 '24 09:08 adebardo

Sounds good for me! Do you think these processing methods should be implemented similarly as other DEM class methods, like DEM.alti_diff(other_dem=*), DEM.alti_diff_norm(other_dem=*), DEM.angular_diff(other_dem=*), with a core method living in a different module? This is what is currently done for terrain attributes like DEM.slope() which calls xdem.terrain.slope(). Our reasoning behind having these two options available was both structural (have an independent terrain module for organisation/testing) and to keep inputs flexible for users that might want to avoid relying on the DEM class yet still want to use these algorithms (as one can simply pass a NumPy array + transform/resolution value when calling xdem.terrain.slope()).

And, for the curvature, it seems like the existing DEM.curvature() could do the job!

rhugonnet avatar Sep 16 '24 20:09 rhugonnet