Add IDW interpolation to rubbersheeting algorithm#239
Open
xhuang-jpl wants to merge 41 commits intoisce-framework:developfrom
Open
Add IDW interpolation to rubbersheeting algorithm#239xhuang-jpl wants to merge 41 commits intoisce-framework:developfrom
xhuang-jpl wants to merge 41 commits intoisce-framework:developfrom
Conversation
added 30 commits
September 19, 2023 20:40
…o add_idw_rubbersheeting
added 8 commits
March 18, 2026 18:30
…o add_idw_rubbersheeting
…o add_idw_rubbersheeting
xhuang-jpl
commented
Apr 9, 2026
Co-authored-by: xhuang-jpl <118782850+xhuang-jpl@users.noreply.github.com>
xhuang-jpl
commented
Apr 9, 2026
Comment on lines
+763
to
+764
| ''' | ||
| Performs IDW interpolation on a 2D grid containing NaN values. |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| ''' | |
| Performs IDW interpolation on a 2D grid containing NaN values. | |
| ''' | |
| Performs Inverse Distance Weighting (IDW) interpolation on a 2D grid containing NaN values. |
| eps: float = 1e-12): | ||
| ''' | ||
| Performs IDW interpolation on a 2D grid containing NaN values. | ||
| Missing pixels are filled using inverse distance weighting (IDW) |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| Missing pixels are filled using inverse distance weighting (IDW) | |
| Missing pixels are filled using IDW |
Comment on lines
+815
to
+822
| if radius is None: | ||
| dists, idxs = tree.query(qpoints, k=min(k, points.shape[0])) | ||
| # dists: (M, k) | ||
| # idxs : (M, k) | ||
| use_mask = np.isfinite(dists) | ||
| else: | ||
| dists, idxs = tree.query(qpoints, k=min(k, points.shape[0]), distance_upper_bound=radius) | ||
| # For neighbors not found within radius, idxs == points.shape[0], dists == inf |
Contributor
Author
There was a problem hiding this comment.
need to combine together
Comment on lines
+829
to
+833
| zero_hit = np.any((dists <= eps) & use_mask, axis=1) | ||
| if np.any(zero_hit): | ||
| row = np.where(zero_hit)[0] | ||
| col = np.argmax(((dists <= eps) & use_mask)[row], axis=1) | ||
| filled_vals[row] = values[idxs[row, col]] |
Contributor
Author
There was a problem hiding this comment.
might not be neccessary here since the distance in 2D grid is usually > 1
Comment on lines
+843
to
+845
| w = np.zeros_like(d, dtype=float) | ||
| w[m] = 1.0 / np.maximum(d[m], eps) ** power | ||
|
|
share/nisar/defaults/insar.yaml
Outdated
Comment on lines
+547
to
+560
| interpolation_method: idw | ||
|
|
||
| # Flag to enable the use of subswath mask for the outlier detection | ||
| subswath_mask_apply_enabled: True | ||
|
|
||
| # IDW interpolation method parameters | ||
| idw_interpolation: | ||
| # Power parameter controlling the distance weighting | ||
| power: 2 | ||
| # Number of nearest neighbors used for interpolation | ||
| number: 100 | ||
| # Maximum search radius in pixels | ||
| radius: 200 | ||
|
|
Contributor
Author
There was a problem hiding this comment.
keep the default to be linear
share/nisar/schemas/insar.yaml
Outdated
Comment on lines
+607
to
+610
| # Number of nearest neighbors used for interpolation | ||
| number: int(min=0, required=False) | ||
| # Maximum search radius in pixels | ||
| radius: num(min=0, required=False) |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| # Number of nearest neighbors used for interpolation | |
| number: int(min=0, required=False) | |
| # Maximum search radius in pixels | |
| radius: num(min=0, required=False) | |
| # Number of nearest neighbors used for interpolation | |
| number: int(min=1, required=False) | |
| # Maximum search radius in pixels, if not specified, it will use all of the valid pixels in the image | |
| radius: num(min=1, required=False) |
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 is to add the IDW (inverse distance weighting) algorithm to the rubbersheeting algorithm. This is based on our comparison that the IDW performs slightly better than the linear interpolation.