django-raster icon indicating copy to clipboard operation
django-raster copied to clipboard

Continuous colormaps - exact range boundary values not displayed

Open sebbelese opened this issue 4 years ago • 0 comments

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.

sebbelese avatar Feb 19 '21 10:02 sebbelese