Closed delbronski closed 9 months ago
🤔 I think it's a rio-tiler bug
if len(colormap) > 256 or max(colormap) >= 256 or min(colormap) < 0:
return apply_discrete_cmap(data, colormap)
should be
if len(colormap) != 256 or max(colormap) >= 256 or min(colormap) < 0:
return apply_discrete_cmap(data, colormap)
Oh sorry I did not notice that file was part of the rio-tiler library. I think you are right! Thanks. I'll open a bug ticket on their repo then.
no need, PR is already open and patch soon to be released :D
no need, PR is already open and patch soon to be released :D
Thanks vincent!
Problem description
A have a tiff file of bioclimate zones. It is a simple 1 band tiff, Float32, min: 0.0, max:15.0. Each Float represents a bioclimate zone, so 0.0 represents Artic, 1 represents Extremely Cold and Wet, etc. So inside the tiff is just a big matrix from 0.0 to 15.0 each cell representing one of the zones.
I am trying to apply the following custom discrete colormap but it does not work:
{0: '#00ffff', 1: '#539791', 2: '#57c217', 3: '#5d45ff', 4: '#62d989', 5: '#8cff29', 6: '#966eff', 7: '#b3cf64', 8: '#d6829c', 9: '#e8aa6c', 10: '#ffe180', 11: '#ffb8b4', 12: '#ffff8c', 13: '#ffb4c4', 14: '#ff0000', 15: '#ffdada'}
I get the following error:
File "..../venv/lib/python3.11/site-packages/rio_tiler/colormap.py", line 114, in apply_cmap data = lookup_table[data[0], :]