Dynamically determine nodata index based on multiple heuristics #55
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.
Description
This change is intended to fix an issue with palettizing browse images with a nodata value. Input data in general can have a color palette enter HyBIG in a number of ways:
In each of these cases, the intended behavior of where the nodata value is intended to go in the palettized raster is a little different:
self.ndvbut does not have a concept of a "nodata index". The location of the "nv" line in the input text colormap is lost when the ColorPalette object is instantiated. Due to this, our default behavior should be to put the "nodata index" at 0 when palettizing these rasters, unless there is a specific color entry that matches the nodata value.Jira Issue ID
GITC-8020
Local Test Steps
Ran unit tests. One unit test,
test_convert_singleband_to_raster_with_colormap_and_bad_datahad its expected result modified to match the behavior when there is "nv" in the input colormap but no explicit "nodata index" - we want to use a nodata index of 0 in that case instead of len(levels) - 1.PR Acceptance Checklist
CHANGELOG.mdupdated to include high level summary of PR changes.docker/service_version.txtupdated if publishing a release.