0

我首先加载 Sentinel 1 图像并根据我的研究区域、时间、VV/VH 极化和上升或下降路径进行过滤。执行这些程序的代码如下

library(rgee)
library(tcltk)
#Load sentinel1 image collection
sentinel1 <-ee$ImageCollection('COPERNICUS/S1_GRD')
#AOI Geometry
Ext <- list(
  c(35.953444081338944, 0.31636293022018336),
  c(36.21024950126082,0.31636293022018336),
  c(36.21024950126082, 0.7475567060026045),
  c(35.953444081338944, 0.7475567060026045))

marigat_plains <- ee$Geometry$Polygon(coords = Ext, proj = "EPSG:4326",
                                      geodesic = FALSE)

#user dateinput
start <- ee$Date('2014-01-01')
end <- ee$Date('2014-12-31')

#Filter to get images with VV and VH polarization,specified date and region
vv <- sentinel1$filter(ee$Filter$listContains('transmitterReceiverPolarisation',
                                              'VV'))
vh <- vv$filter(ee$Filter$listContains('transmitterReceiverPolarisation', 'VH'))
iws <- vh$filter(ee$Filter$eq('instrumentMode', 'IW'))
filtered <- iws$filterBounds(marigat_plains)$filterDate(start, end)
filtered$getInfo()

#select path,ASCENDING or DESCENDING
path <-'ASCENDING'
if (path == 'ASCENDING') {
  selectedPath <- filtered$filter(ee$Filter$eq('orbitProperties_pass',
                                               'ASCENDING'))
} else if(path == 'DESCENDING') {
  selectedPath <- filtered$filter(ee$Filter$eq('orbitProperties_pass',
                                               'ASCENDING'))
} else {
  print("Specifiy whether ASCENDING/DESCENDING")
}

应用过滤器后,我定义了一个从 CFSV2 获取数据的函数:NCEP 气候预报系统第 2 版,6 小时产品,用于风掩蔽,以消除风造成的表面粗糙。此函数采用 YY 格式的日期-MM-DD 作为参数并返回 ee-image。

ncep <- function(date){
  #rdate <-eedate_to_rdate(eeDate,timestamp = TRUE)
  wx <- ee$ImageCollection('NOAA/CFSV2/FOR6H')$filterDate(date)
  vwind <- wx$select('v-component_of_wind_height_above_ground')
  a <- vwind$max()
  uwind <- wx$select('u-component_of_wind_height_above_ground')
  b <- uwind$max()
  a <- a$pow(2)
  b <- b$pow(2)
  ab <- a$add(b)
  ws <- ab$sqrt()
  ws <- ws$multiply(3.6)
  return (ws$rename('windy')$set('date',date))
}

为了获取图像集中每个场景的数据,我做了一个功能,将日期格式化为 yy-mm-dd 格式,并将它们聚合到一个 eelist 中,如下所示,

#Get the dates from the image and format them
dates <- selectedPath$map(function(image) {
  return(image$set('date', image$date()$format('Y-MM-dd')))
})
#Get a list of dates
datelist <- dates$aggregate_array('date')

然后我尝试将日期列表映射到函数ncep,如下所示

ws <- ee$List(datelist)$map(ncep)

我得到错误RuntimeError: Evaluation error: argument "date" is missing, with no default.

4

0 回答 0