I need to save out a 3 band geotiff to file. I am currently using rasterio and when I go to write out the 3 band imagery I get the error Source shape (1, 3445, 4703, 4) is inconsistent with given indexes 1.
My final goal is to be able to perform some analysis on an image and write this out to file.
I have already tried reshape_as_raster and reshape_as_image. I have tried a few other combinations as well as .transpose(arr, (0,1,2))
https://rasterio.readthedocs.io/en/stable/topics/image_processing.html#imageorder
with rio.open(r"C:\Users\name\Documents\project\name.tif") as src:
naip_data = src.read()
naip_meta = src.profile
image = reshape_as_raster(naip_data)
with rio.open('C:\\Users\\name\\Documents\\UAV_test_save\\filename.tif', 'w',**naip_meta) as dst:
dst.write(image, 3)
I am expecting to have a geotiff saved in the file. instead I get:
ValueError rasterio_io.pyx in rasterio._io.DatasetWriterBase.write()
ValueError: Source shape (1, 3445, 4, 4703) is inconsistent with given indexes 1