Robust NDWI Calculation with Edge-Protected Gaussian Filteringprotected blurring#73
Open
Vishesh0305 wants to merge 1 commit intofwitmer:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the numerical stability and spatial accuracy of the NDWI labeling process.
Numerical Stability - Implemented np.nan_to_num and np.errstate to handle zero-division and invalid pixels (0/0 cases) safely, which is critical for raw satellite sensor data.
Edge Protection - ntroduced a NoData mask ($green == 0$ ) that is applied after Gaussian blurring. This prevents the "smearing" of zero-value border pixels into the valid NDWI data, preserving the coastline's integrity at the image boundaries.
Value Distinction - Mapped NoData values to -1.0 to clearly distinguish "No Information" from "Deep Water" (NDWI \approx 1.0) and "Land" (NDWI < 0).