Added edge handling in LUT interp with pre-built LUT#701
Merged
Conversation
evan-greenbrg
commented
May 27, 2025
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.
Isofit errors out when using a pre-built lut grid, and the interpolated value (as noted in the "interp" key) is at, or smaller than the smallest value in the lut dimension for that key. See example for "surface_elevation_km" below:
As noted in #697, we may not want to support run cases when the scene-value is lower than the LUT value, but at the bare minimum we have to support cases when the scene-value is at the LUT grid minimum, which currently fails.
The root of the issue is with how we slice the LUT dimension. For example, when the interpolated value (
val) is equal to the smallest value in the lut grid (dim[0]):returns 0 and
returns a slice, which always indexes to an empty list.
Interestingly, the inverse is not true. If the interpolated value is greater than the largest value in the lut grid (
val > dim[-1]):returns len(dim) and
returns a slice for the last LUT dim value. It looks like we actually currently allow for scene-values for LUT elements to be greater than the maximum value within the LUT grid.
The proposed changes are to: