0

Please see below code which is from the INLA prediction stack function. However when I run this my points are not selected from within the boundary.

Nxy.scale <- 10  # about 10km resolution

Boundary <- Mesh$mesh$loc[Mesh$mesh$segm$int$idx[, 2], ]
Nxy.size <- c(diff(range(Boundary[, 1])), diff(range(Boundary[, 2])))
Nxy <- round(Nxy.size / Nxy.scale)

projgrid <- inla.mesh.projector(Mesh$mesh,
                            xlim = range(Boundary[, 1]),
                            ylim = range(Boundary[, 2]),
                            dims = Nxy)

# Get the index of points on the grid within the boundary
xy.in <- splancs::inout(projgrid$lattice$loc, boundary)
boundary <- Boundary[,1:2]
# Select only points on the grid that fall within the boundary
predcoords <- projgrid$lattice$loc[which(xy.in), ]
colnames(predcoords) <- c('Long','Lat')
Apred <- projgrid$proj$A[which(xy.in), ]

This is the points and the boundary (UK)

Here is the selected points, as you can see they are all over the place and do not resemble the UK

Any help on this would be greatly apricated!

Thank you.

0 Answers0