interpolate_var | R Documentation |
Note that some variables are colocated with nodes, while others are associated with elements (triangular faces). The former require interpolation, the later requires more prep but no interpolation. The first dimension of any requested variable must be 'node' (implemented) or "nele" (not implemented). Any other is an error.
interpolate_var(p, X, var = "h")
p |
sf POINT object |
X |
FVCOMPhysics object with an element mesh |
var |
character the variable to interpolate (bathymetry is h) |
Nodes: We could just find the mean var of the three nodes surrounding each element, but that assumes the point in in the centroid of the element which is likely to not be the case. So, this uses simple plane geometry to interpolate the depth at an arbitrary location within the mesh.
numeric vector of interpolates, NA where points fall outside of the mesh
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.