我尝试使用Rasterio-doc网站上的代码将数组作为TIFF写入磁盘https://rasterio.readthedocs.io/en/latest/topics/writing.html。
with rasterio.Env():
profile = src.profile
profile.update(
dtype=rasterio.uint8,
count=1,
compress='lzw')
with rasterio.open('example.tif', 'w', **profile) as dst:
dst.write(array.astype(rasterio.uint8), 1)当我运行代码时,会发生以下错误:“名称”数组未定义‘。
在最后一行中,我尝试使用“np.array”而不是“数组”来表示它是一个numpy数组,但它没有工作。
发布于 2021-10-17 11:57:16
变量“数组”表示应该写入磁盘的数据。例如,创建一个numpy数组:
import numpy as np
array = np.array(my_array_data)然后,如本教程所述,您可以将这些数据写入磁盘。
https://stackoverflow.com/questions/69603627
复制相似问题