
Hi Finn,
Thank you for your reply! My fmesher version is ‘0.5.0.9000’ so that shouldn't be the problem. I've got 5332 datapoints. Here's how I created the mesh:
> res(gcov$ndvi)
[1] 0.08864447 0.08864447
> st_crs(cleanedlion2024km)
Coordinate Reference System:
User input: +proj=utm +zone=35 +south +units=km +datum=WGS84
wkt:
mesh <- fm_mesh_2d(
loc = fm_hexagon_lattice(cleanedlion2024km),
boundary = roadskm,
max.edge = c(10,20),
offset=c(10,20),
cutoff=1
)
fm_crs(mesh)<-st_crs(cleanedlion2024km)
> mesh$n
[1] 2753
I predicted the map above (fitnull model):
cmpnull<- geometry ~ mySmooth(geometry, model = matern) + 1
fitnull<- lgcp(cmpnull, cleanedlion2024km, samplers = roadlineskm, domain = list(geometry = mesh),weights=weight_scaled, options = list(
control.compute = list(dic = TRUE, config = TRUE),
control.predictor = list(compute = TRUE)))
intnull <- predict(fitnull, pred.df, ~ exp(mySmooth + Intercept), n.samples = 1000)
ggplot() +
gg(intnull, geom = "tile") +
geom_sf(data=kruger, alpha = 0, lwd = 1)
And the yellow-green map of fit2 model(NDVI+SPDE), just the SPDE component:
cmp2<- geometry ~ ndvi(f.ndvi(.data.), model = "linear") +
mySmooth(geometry, model=matern) + 1
fit2<- lgcp(cmp2, cleanedlion2024km, samplers = roadlineskm, domain = list(geometry = mesh),weights=weight_scaled, options = list(
control.compute = list(dic = TRUE, config = TRUE),
control.predictor = list(compute = TRUE)))
ndvi.lp <- predict(
fit2,
pred.df,
~ list(
smooth_ndvi= mySmooth + ndvi,
ndvi = ndvi,
smooth=mySmooth
)
)
ggplot() +
gg(ndvi.lp$smooth,geom="tile") +
csc +
theme(legend.position = "bottom") +
geom_sf(data=kruger, alpha = 0) +
ggtitle("SPDE")
Thank you again!