【发布时间】:2019-12-21 11:33:20
【问题描述】:
我有一个非常大的光栅文件(行数=14810;列数=12392),我想使用“焦点”函数在特定大小的窗口(例如 5像素 X 5 像素)。我曾经在 R(光栅 R 包)中应用“焦点”功能。但是,对于这么大的栅格大小,该函数非常慢。
我知道“spatial.tools”中有一个名为“focal_hpc”的函数可以加速焦点处理(并行)。但是,我不知道如何指定“平均”函数。我使用了以下脚本:
require(raster)
require(spatial.tools)
tahoe_highrez <- brick(system.file("external/tahoe_highrez.tif", package="spatial.tools"))
res<-focal_hpc(x=tahoe_highrez,fun=mean,window_dims=c(5,5))
但它给了我这个错误:
Error in (function (x, ...) :
call to standardGeneric("mean") apparently not from the body of that generic function
有人使用过这个包和功能吗?
【问题讨论】:
标签: r spatial raster parallel.foreach