Allow interpolation across narrow masked water bodies - #94
Draft
scottstanie wants to merge 2 commits into
Draft
Conversation
…region Interpolating over a narrow river was already the intent - "ignore little water bodies and interpolate a smooth thing from one to the next" - but two things in our own pipeline prevented it. `interpolate` skips any pixel whose complex value is exactly zero (the `ifg != 0` nodata convention it shares with dolphin), and compare_gunw zeroes masked pixels before calling unwrap, so water was invisible to the interpolator; unwrap then re-zeroed masked pixels afterwards anyway. Dolphin uses the same convention but is handed a raw interferogram where water still carries noisy non-zero values, so it does interpolate there - the difference was ours, not inherent. `fill_invalid` makes those nodata pixels interpolation targets. They get UNIT amplitude, because they have none to preserve and would otherwise come back as 0+0j and read as invalid to every downstream nodata test. The fill is self-limiting: a pixel is only filled when the spiral search finds high-weight support within interp_max_radius, so a narrow river fills while the middle of a wide ocean finds nothing and stays nodata. `unwrap(interp_across_mask=True)` wires that through and keeps the filled phase for the solve. Masked pixels are never used as interpolation neighbours, and the solver mask admits only water that was actually filled. The output contract is unchanged: the returned phase and connected components are still masked, and integration already crossed masked regions, so the filled path only serves to level the two banks against each other. On 008_055_D_073, the river frame the bridge fix rescued, it reaches 1.0000 per-component agreement with NO bridging at all (bridge alone: 0.9998; neither: 0.9984), so it does address the same failure from the other end. It is ~5x slower than bridging on that frame (67s vs 12s), so this is an alternative to evaluate rather than a replacement to adopt. Off by default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What changed
Adds opt-in
unwrap(interp_across_mask=True), CLI--interp-across-mask, and benchmark plumbing. Exact-zero masked pixels can receive unit-amplitude phase only when a high-weight neighbor exists insideinterp_max_radius. Filled pixels join the temporary solve mask but remain masked in returned phase and connected components; unsupported ocean remains nodata.Result and tradeoff
On 008_055_D_073 with bridging disabled:
The normal bridge path is already 99.9813% in 11.5 s. This PR is therefore an orthogonal research/A-B option, not a recommended default or campaign setting.
Validation