gstat 包未返回 NA
我正在使用 gstat 软件包估计未知地点之一的降雨量。
我只是测试这些代码,以表明即使不满足“nmin”、nmax 和“maxdist”参数,“gstat”包也会返回估计值。代码应返回“NA”。
我有三个相邻站点,距离兴趣点位置分别为 97.51、37.45 和 50.94 公里。您有什么建议吗?
library(gstat)
library(sp)
Rainfall = data.frame(x = c(-47.6, -48.9, -48.2, -48.9, -47.6, -48.6),
y = c(-23.4, -24.0, -23.9, -23.1, -22.7, -22.5),
Rain = c(27.0, 33.4, 34.6, 18.2, 30.8, 42.8))
sp = Rainfall
coordinates(sp) = ~x+y
xi = c(-48.0530600)
yi = c(-23.5916700)
grid = expand.grid (xi=xi ,yi=yi)
coordinates(grid) = ~xi + yi
idw(sp$Rain~1, sp, grid, nmin=2,nmax=3, maxdist=25)
[inverse distance weighted interpolation]
class : SpatialPointsDataFrame
features : 1
extent : -48.05306, -48.05306, -23.59167, -23.59167 (xmin, xmax, ymin, ymax)
crs : NA
variables : 2
names : var1.pred, var1.var
value : 32.2319969930987, NA
I'm estimating the value of rainfall in one of the unknown locations with the gstat package.
I'm merely testing these codes to show that the 'gstat' package returns an estimated value even when the 'nmin' nmax and'maxdist' parameters aren't met. The codes should return 'NA'.
I have three neighbouring stations that are 97.51, 37.45, and 50.94 kilometres from the location of the point of interest. Do you have any recommendations?
library(gstat)
library(sp)
Rainfall = data.frame(x = c(-47.6, -48.9, -48.2, -48.9, -47.6, -48.6),
y = c(-23.4, -24.0, -23.9, -23.1, -22.7, -22.5),
Rain = c(27.0, 33.4, 34.6, 18.2, 30.8, 42.8))
sp = Rainfall
coordinates(sp) = ~x+y
xi = c(-48.0530600)
yi = c(-23.5916700)
grid = expand.grid (xi=xi ,yi=yi)
coordinates(grid) = ~xi + yi
idw(sp$Rain~1, sp, grid, nmin=2,nmax=3, maxdist=25)
[inverse distance weighted interpolation]
class : SpatialPointsDataFrame
features : 1
extent : -48.05306, -48.05306, -23.59167, -23.59167 (xmin, xmax, ymin, ymax)
crs : NA
variables : 2
names : var1.pred, var1.var
value : 32.2319969930987, NA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论