我需要保存一个3波段的geotiff文件。我目前正在使用rasterio,当我写出3波段图像时,我得到了错误Source shape (1, 3445, 4703, 4) is inconsistent with given indexes 1
。在
我的最终目标是能够对图像执行一些分析并将其写入文件。在
我已经试过reshape_as_raster
和reshape_as_image
。我也尝试过其他一些组合。转置(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)
我希望在文件中保存一个geotiff。相反,我得到:
ValueError rasterio_io.pyx in rasterio._io.datasetWriterBase.write()
ValueError: Source shape (1, 3445, 4, 4703) is inconsistent with given indexes 1
目前没有回答
相关问题 更多 >
编程相关推荐