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


@pyaw
 

https://gis.stackexchange.com/questions/351614/convert-gray-band-from-dataset-to-rgb-with-rasterio-for-population-density

I'm pretty new to GIS so please correct and terminology or logical fallacies:
 
I have this dataset: https://ghsl.jrc.ec.europa.eu/download.php?ds=pop (I am using the full dataset (Global dataset) which is located in the hyperlink below the map). When I unzip it (the .tif.ovr file) and access it via rasterio, there is only one band. On QGIS GUI, I've managed to open the .tif.ovr file and change some of the colors (since I'm working on population density). Unfortunately, I have no clue on how to change this dataset to have RGB bands.
 
Right now, when I do:
 
with open(pathtodata, "r+", **profile) as src:
    src.meta
    src.dataset_mask()
 
I only get a 2D numpy array with what seems like the gray band only values (0 and 255), but I'd like to have the RGB values so I can work with the RGB values in Python (not for visualization). The meta values show that there is only one band (count) and no photometric. Doing `src.colorinterp` shows only `ColorInterp.gray: 1` which is the issue.
 
So how would I change the gray band to RGB bands to work with RGB-valued data with numpy? Thank you!

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