0

観測データを含むデータセットがあり、それをグリッド上で補間する必要があります。gstat パッケージの idw 関数を使用しました。補間を行いますが、一部の値を NA のままにします。また、extrap=TRUE に特化した akima の interp 関数も試しましたが、非現実的な値が作成されました。これらの欠落した値をどのように満たすことができるか、誰か考えがありますか? コードは以下のとおりです。

winter1 <- winter
winter1$x <- winter1$Lon
winter1$y <- winter1$Lat
coordinates(winter1) = ~x + y
dx <- as.numeric(c(9,30.5))
dy <- as.numeric(c(53.8,66))
grd <- expand.grid(x = seq(from = dx[1], to = dx[2], by = 0.1), y = seq(from = dy[1], to = dy[2], by = 0.1))
coordinates(grd) <- ~x + y 
winter_idw <- idw(formula = winter$Secchi ~ 1, locations = winter1, newdata = grd)
winter_idw <- as.data.frame(winter_idw) 
world <- ne_countries(scale = "medium", returnclass = "sf")
  class(world)
  rng = range(c(0,10))
  p <- ggplot(data = world)+
    geom_raster(data = v, mapping=aes(x = x, y = y, fill=var1.pred))+
    scale_fill_gradient2(low = "blue",
                         mid = "yellow",
                         high = "red",
                         breaks=seq(0,10,2),
                         midpoint=5,
                         limits=c(floor(rng[1]), ceiling(rng[2])))+
    borders("world", colour="black",xlim = c(9,30.5), ylim = c(53.8,66))+
    geom_sf(fill="antiquewhite") +
    coord_sf(xlim=c(9,30.5), ylim=c(53.8,66))+
    theme(plot.title = element_text(hjust = 0.5))

私はそのような地図を手に入れます: 欠落データの大きな領域

よろしくお願いします。

4

0 に答える 0