inla.mesh.project {INLA}R Documentation

Methods for projecting to/from an inla.mesh

Description

Calculate a lattice projection to/from an inla.mesh()

Usage

inla.mesh.project(...)

## S3 method for class 'inla.mesh'
inla.mesh.project(mesh, loc = NULL, field = NULL, crs = NULL, ...)

## S3 method for class 'inla.mesh.1d'
inla.mesh.project(mesh, loc, field = NULL, ...)

## S3 method for class 'inla.mesh.projector'
inla.mesh.project(projector, field, ...)

inla.mesh.projector(...)

## S3 method for class 'inla.mesh'
inla.mesh.projector(
  mesh,
  loc = NULL,
  lattice = NULL,
  xlim = NULL,
  ylim = NULL,
  dims = c(100, 100),
  projection = NULL,
  crs = NULL,
  ...
)

## S3 method for class 'inla.mesh.1d'
inla.mesh.projector(mesh, loc = NULL, xlim = mesh$interval, dims = 100, ...)

Arguments

...

Additional arguments passed on to methods.

mesh

An inla.mesh() or inla.mesh.1d() object.

loc

Projection locations. Can be a matrix or a SpatialPoints or a SpatialPointsDataFrame object.

field

Basis function weights, one per mesh basis function, describing the function to be avaluated at the projection locationssFunction values for on the mesh

crs

An optional CRS or inla.CRS object associated with loc and/or lattice.

projector

An inla.mesh.projector object.

lattice

An inla.mesh.lattice() object.

xlim

X-axis limits for a lattice. For R2 meshes, defaults to covering the domain.

ylim

Y-axis limits for a lattice. For R2 meshes, defaults to covering the domain.

dims

Lattice dimensions.

projection

One of c("default", "longlat", "longsinlat", "mollweide").

Details

The call inla.mesh.project(mesh, loc, field=..., ...), is a shortcut to inla.mesh.project(inla.mesh.projector(mesh, loc), field).

Value

For inla.mesh.project(mesh, ...), a list with projection information. For inla.mesh.projector(mesh, ...), an inla.mesh.projector object. For inla.mesh.project(projector, field, ...), a field projected from the mesh onto the locations given by the projector object.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

See Also

inla.mesh(), inla.mesh.1d(), inla.mesh.lattice()

Examples


n <- 20
loc <- matrix(runif(n * 2), n, 2)
mesh <- inla.mesh.create(loc, refine = list(max.edge = 0.05))
proj <- inla.mesh.projector(mesh)
field <- cos(mesh$loc[, 1] * 2 * pi * 3) * sin(mesh$loc[, 2] * 2 * pi * 7)
image(proj$x, proj$y, inla.mesh.project(proj, field))

if (require(rgl)) {
    plot(mesh, rgl = TRUE, col = field, draw.edges = FALSE, draw.vertices = FALSE)
}



[Package INLA version 21.11.22 Index]