使用 NDSI 简单掩蔽燃烧数据

Simple Masking Burn Data with NDSI

我不明白这个错误。我试图用另一个图像(仅包含 0 和 1)来掩盖图像。它无法将 Mask 识别为输入图像 2。

Link to GEE Code

此行创建如下错误:

var MaskedBAI = First.updateMask(threshold);

Error: Required argument (image2) missing to function: Image.first(image1, image2)

Selects the value of the first value for each matched pair of bands in image1 and image2. If either image1 or image2 has only 1 band, then it is used against all the bands in the other image. If the images have the same number of bands, but not the same names, they're used pairwise in the natural order. The output bands are named for the longer of the two inputs, or if they're equal in length, in image1's order. The type of the output pixels is the union of the input types.

Args:

image1 (Image): The image from which the left operand bands are taken. image2 (Image): The image from which the right operand bands are taken.

英里格雷西

您代码中的屏蔽工作正常,您的问题是使用 .first()

如果像在脚本开头那样在 ImageCollection 上使用,则会返回集合的第一张图像。

如果在 Image 上使用它

Selects the value of the first value for each matched pair of bands in image1 and image2

正如描述所说。我猜这不是你想要的。所以解决方法很简单,去掉 .first():

Map.addLayer(MaskedBAI,BAIparam ,'BAI')

顺便提一下,没有像素低于您的阈值 0.3,这意味着整个遮罩为 0,这反过来不会向您显示 MaskedBAI 的任何内容……以防万一您想知道。