Skip to content

Commit

Permalink
Merge pull request #83 from mraspaud/fix-palettize-type
Browse files Browse the repository at this point in the history
Fix palettize dtype for dask arrays
  • Loading branch information
mraspaud authored Sep 2, 2021
2 parents c160f34 + 147e3b5 commit ea87a27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion trollimage/colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def palettize(arr, colors, values):

def _palettize_dask(darr, colors, values):
"""Apply a palette to a dask array."""
return darr.map_blocks(_palettize, values, dtype=colors.dtype)
return darr.map_blocks(_palettize, values, dtype=int)


def _palettize(arr, values):
Expand Down
1 change: 1 addition & 0 deletions trollimage/tests/test_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test_palettize_dask(self):
self.assertTrue(np.allclose(channels.compute(), [[0, 1, 2, 3],
[0, 1, 2, 3],
[0, 1, 2, 3]]))
assert channels.dtype == int

def test_set_range(self):
"""Test set_range."""
Expand Down

0 comments on commit ea87a27

Please sign in to comment.