django-raster
django-raster copied to clipboard
Continuous colormaps - exact range boundary values not displayed
Hi,
Thanks for developing this nice software!
I noticed that the display of rasters with a continuous colormap was not including values exactly at the boundaries of the raster data range. This can be an issue for e.g. rasters having a lot of zeros as lower limit. If this is a bug, it can be fixed by modifying utils.py line 82 from:
# Compute alpha channel from mask if available.
if numpy.ma.is_masked(dat):
alpha = 255 * numpy.logical_not(dat.mask) * (norm >= 0) * (norm <= 1)
else:
alpha = 255 * (norm > 0) * (norm < 1)
to
# Compute alpha channel from mask if available.
if numpy.ma.is_masked(dat):
alpha = 255 * numpy.logical_not(dat.mask) * (norm >= 0) * (norm <= 1)
else:
alpha = 255 * (norm >= 0) * (norm <= 1) #Just changed this line
Sorry for not making a proper merge request, but it is just a small change.