-
I'm creating a rio raster combining two channels (e.g., NDVI index map from sentinel-2 band images):
However, I also want to save it in 8bit. Thus I do:
Now my question is: When you convert the image to 8bit, some pixels are converted to 0, which is the same as NaN. Therefore you see gaps in the middle of the image. I saw this solved for rasterio. However, I'm not sure how to do it in rioxarray and I wanted to avoid the parameter they fitted. I thought I could take the mask no_data from the combo before the 8bit conversion, fill the mask no_data in 8bit to everything is avalaible and then set the mask I took before. How can I do this? btw, why if I put combo.rio. in vscode I cannot see any property or method but if I write combo. I can see those for xarray? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There currently isn't support for masks in rioxarray. This is due to how xarray handles integer masks: You should be able to add the mask using rasterio after writing to disk with |
Beta Was this translation helpful? Give feedback.
There currently isn't support for masks in rioxarray. This is due to how xarray handles integer masks:
pydata/xarray#1194
You should be able to add the mask using rasterio after writing to disk with
r+
as mentioned in the documentation you linked.