2018_FSH556 icon indicating copy to clipboard operation
2018_FSH556 copied to clipboard

Building better meshes

Open jkbest2 opened this issue 6 years ago • 0 comments

A key part of getting valid approximations to a spatial field in INLA is forming a "good" mesh (triangulation). This section of the "SPDE Tutorial" on the INLA website describes what makes a good mesh, and gives a number of examples of good and bad meshes:

https://www.math.ntnu.no/inla/r-inla.org/tutorials/spde/html/spde-tutorialch1.html#x5-270001.3

The developers of INLA also recently (February) added a Shiny app that lets you build a mesh interactively. This is done using the meshbuilder function. It does not accept any arguments, but you can import spatial objects from your R workspace. It also provides the code necessary to reproduce a mesh that you build in the Shiny app so that you can use it.

This functionality was added in version 18.02.13 (you can see which version you have when you load INLA (library(INLA)). The latest "stable" version of INLA is 17.06.20, so in order to use meshbuilder you'll need to update to the "testing" version. The INLA Downloads page describes how to install INLA. If you want to upgrade from "stable" to "testing", you can run

install.packages("INLA", repos = c(getOption("repos"),
                                   INLA = "https://inla.r-inla-download.org/R/stable"),
                 dep=TRUE)

In the future, this functionality may be split into a package separate from INLA. It looks like Finn Lindgren is working on this in the https://github.com/finnlindgren/fmesher repository; it may be worth watching.

jkbest2 avatar May 08 '18 21:05 jkbest2