Re: Convert gray band from dataset to RGB with rasterio for population density


@pyaw
 

This is a re worded question that probably sounds a bit better: https://gis.stackexchange.com/questions/351639/rasterio-change-singelband-gray-to-singleband-pseudo-color-for-multiple-colors

Quoted: This is in reference to: Convert gray band from dataset to RGB with rasterio for population density however there is a difference. I have been playing around with QGIS which I had opened the aforementioned .tif.ovr file and finally got some different hues of gray.

Instead of having multiple bands like the original question, simply having multiple colors is what I'm seeking with rasterio (or gdal. Honestly either one works). In QGIS, I set the rendering type for the .tif.ovr file to singleband pseudocolor with a magma color ramp and on continuous mode with linear interpolation. (Setting the mode to equal interval also works well).

Looks neat! So how would I do the same (probably best to use RGB instead though with black being 0 statistic minimum) with the rasterio data that I used from the aforementioned question?

Recalling, the dataset I have from src.dataset_mask() is a 2D numpy array (e.g. [[0,255],[255,255]]) in which the only values in the entire dataset is either 0 or 255. I'm seeking a way to make the values either Floats or a range between 0 and 255. Thank you! 

Join main@rasterio.groups.io to automatically receive all group messages.