问题描述
因此,我试图在此处使用可变窗口大小的CHM(Canopy Height Model)实现最大过滤器,“ Tree_Heights”是一个数据框,其中包含线性回归模型的拟合值以预测树的直径,即窗口大小应该与给定高度的树的半径的较低预测间隔匹配。
RoundOdd <- function(x) {2*floor(x/2)+1}
fitlwr <- function(x){
RoundOdd(Tree_Heights[Tree_Heights$Tree_Height == x,"fit.lwr"]/2)
}
m <- raster::focalWeight(x = CMM,d = fitlwr(),type = "circle")
CMM <- raster::focal(x = CMM,w = m,fun = max)
这将返回以下错误:
Error in `[.data.frame`(Tree_Heights,Tree_Heights$Tree_Height == x,"fit.lwr") : argument "x" is missing,with no default
6.`[.data.frame`(Tree_Heights,"fit.lwr")
5.Tree_Heights[Tree_Heights$Tree_Height == x,"fit.lwr"]
4.RoundOdd(Tree_Heights[Tree_Heights$Tree_Height == x,"fit.lwr"]/2)
3.fitlwr()
2..circular.weight(x,d[1])
1.raster::focalWeight(x = CMM,type = "circle")
Error in .local(x,...) : is.matrix(w) is not TRUE
5. stop(simpleError(msg,call = if (p <- sys.parent(1L)) sys.call(p)))
4. stopifnot(is.matrix(w))
3. .local(x,...)
2. raster::focal(x = CMM,w = fitlwr,fun = max)
1. raster::focal(x = CMM,fun = max)
此功能固有地无法使用可变的窗口大小吗? Raster软件包中还有其他选择吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)