【发布时间】:2020-10-15 06:45:25
【问题描述】:
原始的两个数据集是两个 .tiff 图像文件,具有相同的坐标、高度、宽度和变换信息(假设 data1 和 data2)。我需要对它们进行简单的数学运算,但它们都有空值,所以我首先使用 masked=True:
new1 = data1.read(1,masked=True)
new2 = data2.read(1,masked=True)
然后算一算:
target = new1 - new2
当我得到目标时,我尝试如下代码:
target.width
target.height
target.transform
target.crs
它们都返回相同的错误:
'MaskedArray' object has no attribute 'xxx'(xxx represents all the attribute above: width, height, etc.)
似乎目标在数学后丢失了所有信息,我需要将这个新结果写入一个新的光栅文件,我应该怎么解决?
【问题讨论】: