GlacioHack / xdem

Analysis of digital elevation models (DEMs)
https://xdem.readthedocs.io/
MIT License
137 stars 39 forks source link

[POC] dem_processing from demcompare #570

Open adebardo opened 1 month ago

adebardo commented 1 month ago

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:

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

rhugonnet commented 1 week ago

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!