我正在尝试将多个栅格镶嵌到R中的单个大栅格中。使用在/programming/15287807/how-can-i-create-raster-mosaic-using-list-of-rasters中发布的脚本 但是,我收到了警告消息和错误消息。
rasters1 <- list.files("F:\\MOD15A2_LAI_1km\\MOD15A2_LAI_2009",
pattern = "mod15a2.a2009001.*.005.*.img$",
full.names = TRUE, recursive = TRUE)
mos1 <-mosaic(rasters1, fun=mean)
它报告错误如下
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘extent’ for signature ‘"character"’
然后我尝试了另一个版本。
rasters1.mosaicargs <- rasters1
rasters1.mosaicargs$fun <- mean
但是这里有一些警告信息如下
Warning message:
In rasters1.mosaicargs$fun <- mean : Coercing LHS to a list
我忽略了该消息,然后继续
mos2 <- do.call(mosaic, rasters1.mosaicargs)
但是这里有与上面提到的相同的错误
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘mosaic’ for signature ‘"character", "character"’
我也找到了以下脚本,但是它不起作用 nceas.ucsb.edu/scicomp/usecases/createrasterimagemosaic
—
Vandka