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


@pyaw
 

Here are some edits from stack that came about since my question may not be interpreted correctly: 

Edit: I am using the full dataset (Global dataset) which is located in the hyperlink below the map
 
Edit 2: When I mean 2D array, I meant a numpy array that looks like this: `[[0, 255, 0], [0, 0, 255]]`.
 
Additionally, this is the meta data:
`{'driver': 'GTiff', 'dtype': 'float32', 'nodata': -200.0, 'width': 72164, 'height': 36000, 'count': 3, 'crs': None, 'transform': Affine(1.0, 0.0, 0.0, 0.0, 1.0, 0.0)}`
 
Thanks to mike for a slight correction: I am actually after just increasing the number of bands so that I can differentiate the two given values which are 0 and 255.
 
Note that when you do `x = src.dataset_mask()` to grab the numpy array, 0 and 255 are the only two values. Like any population density map, I'm after values that are between a range rather than simply having two numbers... e.g. numbers between 0-255 or float values.

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