Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure we return uint8 when applying colormap #423

Merged
merged 4 commits into from
Sep 15, 2021

Conversation

vincentsarago
Copy link
Member

closes #421

@@ -141,7 +141,7 @@ def apply_discrete_cmap(
for k, v in colormap.items():
res[data[0] == k] = v

data = numpy.transpose(res, [2, 0, 1])
data = numpy.transpose(res, [2, 0, 1]).astype("uint8")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we make sure the output is in uint8

InvalidDatatypeWarning,
)
data = self._rescale(data, self.mask, in_range=datatype_range)
if not colormap:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is a colormap passed we don't need to auto-rescale

@vincentsarago
Copy link
Member Author

test are failing because of recent change in rasterio (see: rasterio/rasterio#2289) but was fixed in #418 by changing the dateline dataset

let me see if I can bring the change we push in rio-tiler-v3 branch

@vincentsarago vincentsarago merged commit 8455727 into master Sep 15, 2021
@vincentsarago vincentsarago deleted the Uint16AndColormap branch September 15, 2021 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output array after applying colormap should be of uint8 type
1 participant