用肥皂膜平滑剂设置模型时的边界误差

问题描述

我正在调整Soap-film smoothers & lake bathymetries code,以使用R在切萨皮克湾创建平均盐度测量值的地图。在我尝试使用gam()拟合模型时,一切工作都很好,直到出现以下错误

smooth.construct.so.smooth.spec(object,dk $ data,dk $ knots)中的错误:肥皂基础条件不佳-更改'xt $ nmax'可能有帮助

然后我使用soap_check()确保边界和结点正确,并且在process.boundary()中出现以下错误

if(x 1!= x [n] || y 1!= y [n])中的错误{:缺少需要TRUE / FALSE的值

我相信这意味着我的边界在此步骤中x和y坐标的长度不同,但是我不明白为什么会这样。

这是我的代码

#Import Raster
watermaskSG100 <- raster(here("WaterMask/CB_Water_2019_SG_100m.tif"))

#Transform into a single polygon
watermaskpoly <- rasterTopolygons(watermaskSG100,dissolve = TRUE)
area_threshold <- set_units(200,km^2)
outline <- smoother::fill_holes(watermaskpoly,threshold = area_threshold)
outline <- smoother::drop_crumbs(outline,threshold = area_threshold)

#Convert into a data frame and extract coordinates
foutline <- fortify(outline)
crds <- foutline[,1:2]

#Create boundary and knots
bound <- list(list(x = crds[,1],y = crds[,2],f = rep(0,nrow(crds))))
N <- 25
gx <- seq(min(crds[,1]),max(crds[,len = N)
gy <- seq(min(crds[,2]),len = N)
gp <- expand.grid(gx,gy)
knots <- expand.grid(gx,gy)
names(knots) <- c("os_x","os_y")
names(bound[[1]]) <- c("os_x","os_y","f")
sub_knots <- slice(knots,c(32:36,38,56:61,63,64,82:86,88,107:111,131:135,155:160,180:186,204,208:211,228,233:237,253,258:262,284:288,310:313,335,337:339,360,361,363:369,389:391,412,415:417,442,443,467,469,470,490:493))

#Data
newstationDF <- as.data.frame(newstationSp)
newstationDF <- newstationDF[,-c(2:3)]
names(newstationDF) <- c("station","mean","max","min","range","os_x","os_y")

#Fit model
m2 <- gam(mean ~ s(os_x,os_y,bs = "so",xt = list(bnd = bound)),data = newstationDF,method = "REML",knots = sub_knots)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...