我完全被难住了,我正在尝试使用 R + rgee 创建 JRC MonthlyHistory 地表水计数观测的区域时间序列(按区域)。我可以下载该波段的总观测值,但我无法按特定值进行过滤,在我的情况下,我想为每个区域选择每个月的“地表水观测值”计数。我认为这可能与作为位掩码的数据集有关,即
位 0-1:水检测 0:无数据 1:非水 2:水
library(rgee)
library(mapview)
ee_Initialize()
surface_water <- ee$ImageCollection("JRC/GSW1_2/MonthlyHistory")$
filterDate("2006-01-01", "2006-12-31")$
map(function(x) x$reproject("EPSG:4326")$select("water[1]"))
ee_sw <- ee_extract(x = surface_water, y = wnf_shapes, scale = 30, fun = ee$Reducer$count(), sf = FALSE)
colnames(ee_sw) <- sprintf("%02d", 1:12)
ee_sw$id <- wnf_shapes$id
链接到形状文件 - https://drive.google.com/file/d/1oWJ_ZpEQ4bEYr7R73oOXrQc9UhOH_oCB/view?usp=sharing