Robust nodata detection in raster builders#853
Conversation
- Handle NaNs explicitly in masking logic for float rasters - Fix fallback path to respect generated masks (e.g. from NaN or rio.nodata) - Add regression tests for NaN handling and rioxarray compatibility
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #853 +/- ##
=====================================
Coverage 85.5% 85.5%
=====================================
Files 151 151
Lines 16091 16145 +54
=====================================
+ Hits 13756 13810 +54
Misses 2335 2335
🚀 New features to boost your workflow:
|
|
Hi @Omiii-215 and thank you for this PR. Because we are now receiving many GSOC related PRs and Issues, we have updated our GSOC Contribution Policy and would ask all participants to please review it. As this PR is not targeted at a priority project for GSOC this year, we will leave this open for the maintainers to consider when they have time, but it won't be a priority for GSOC consideration. |
martinfleis
left a comment
There was a problem hiding this comment.
Not sure I follow this properly but is there actually anything that would fail without these changes? Seems to me that it essentially does anything no? Masks out np.nan to replace it with np.nan...
|
mask = values != nodata failed for nan because np.nan != np.nan evaluates to True? because of this only i think nan pixels were to be treated as valid data, np.isnan(values) handles nan. The test failure confirms that without this fix, nans incorrectly leak into the weights object. |
- Changed comparison logic to ~np.isnan() to fix np.nan != np.nan issue - Added support for numpy scalar NaNs - Added new tests for edge cases
|
i have improved the handling and added some new tests to remove the robustness |
The justification for this PR is: