I want to write a binary raster to disk. I have the numpy array whose dtype is:
dtype('bool')
I try to open a GTiff for writing:
img_output = rasterio.open(
"../../binary_output.tif",
'w',
driver='GTiff',
nodata=nd,
height=self.raster.height,
width = self.raster.width,
count=1,
dtype = binary_raster.dtype,
crs=self.raster.crs,
transform=self.raster.transform,)
But I end up with:
TypeError: invalid dtype: 'bool'
I have also tried things like:
dtype = bool
dtype = 'bool'
dtype = "bool"
What is the problem with this? According to the docs, dtype can be any numpy dtype. How do I write a binary raster?