Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vschaffn
Copy link
Contributor

@vschaffn vschaffn commented Mar 7, 2025

Resolves #662.

Changes

  • Adds robustness in Percentage_valid_inlier_ points when total_inlier_counts is 0 to avoid divided by 0.
  • Sets all stats to NaN when the raster or inlier mask is empty and add a warning in logging.
  • Fixes rmse (the sum was missing).

Tests

  • Adds a test with an empty inlier mask, ensure returned stats are NaN
  • Adds a check to ensure that value types in stats are int or float.

@quinto-clara
Copy link

quinto-clara commented Mar 13, 2025

We set slope classes so as to have an empty mask, thus 0 valid inlier points for one of the classes :

slopes [%] : [0, 30, 180, 100000, inf]
slopes [deg] : [0.0, 16.69924423399362, 60.94539590092286, 89.94270423958551, inf]

The masks are definied according to those classes :

Image
Image
Image
Image

We check the statistics for each mask with : .get_stats(inlier_mask=mask)
For the last class, no error is raised. We get 0 valid inlier count, 0.0% inlier points and -- value for most of the statistics and nan for 90th percenile and LE90.

Image

Image

Image

@adebardo
Copy link
Contributor

adebardo commented Mar 13, 2025

@vschaffn @rhugonnet, valentine (i can't @ you) -- means masked, do we work with this type or nan ? :)

@belletva
Copy link
Contributor

-- value for most of the statistics and nan for 90th percenile and LE90.

I think that we need to be consistent. In my opinion, nan could be a good choice for all the statistics.

@rhugonnet
Copy link
Member

I agree with nan for 0 valid values in the mask, more widely supported and understood.

@vschaffn
Copy link
Contributor Author

@adebardo @quinto-clara @rhugonnet @belletva Thanks for your feedback. I set all the stats to NaN when the raster is fully masked, and added a warning in the logs indicating that the raster is empty.

@adebardo adebardo merged commit 08bfb10 into GlacioHack:main Mar 18, 2025
16 checks passed
@vschaffn vschaffn deleted the stats_robustness branch March 18, 2025 09:00
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.

Error in Raster.get_stats when an empty inlier_mask is passed

5 participants