sl.elemfull2elemsub: Generate Elements of an Unstructured-Mesh Node Subset

Description Usage Arguments Details Value Author(s) Examples

View source: R/sl.elemfull2elemsub.R

Description

Generate the elements (triangles) of an unstructured-mesh node subset based on (i) the elements (triangles) of a corresponding larger (full) unstructured mesh and (ii) the latitude and longitude information for both the full mesh and the subset. Can be used to work with regionally truncated data (e.g. produced by 'cdo sellonlatbox ...').

Usage

1
sl.elemfull2elemsub(nodes.full.lon, nodes.full.lat, nodes.sub.lon, nodes.sub.lat, elem.full, tolerance = 0)

Arguments

nodes.full.lon

a vector of size N with the longitudes of the nodes of the full mesh.

nodes.full.lat

a vector of size N with the latitudes of the nodes of the full mesh.

nodes.sub.lon

a vector of size M<N with the longitudes of the nodes of the reduced mesh; should be a subset of nodes.full.lon.

nodes.sub.lat

a vector of size M<N with the latitudes of the nodes of the reduced mesh; should be a subset of nodes.full.lon.

elem.full

an Nex3 matrix with the node indices of the triangular elements of the full mesh in rows.

tolerance

a scalar specifying the tolerance by which the matching longitudes and latitudes may be displaced. Default is 0; if you allow a non-zero tolerance, check the results carefully!

Details

By matching nodes based on their longitude and latitude information, the triangular elements of a full mesh that are contained in a subset of nodes are identified. This enables one to work with regionally truncated data (e.g. produced by 'cdo sellonlatbox ...'). For a particular subset (truncation), this function needs to be run only once and the resulting element matrix can be used for any analyses of that subset.

Value

elem.sub

an Mex3 matrix with the node indices of the triangular elements of the node subset in rows.

full2sub

a vector of length M mapping each node of the subset to the nodes (indices) of the full mesh.

sub2full

a vector of length N mapping nodes of the full mesh to the nodes (indices) of the subset mesh. Contains N-M NAs.

Author(s)

Helge Goessling

Examples

1
## To be provided ...

helgegoessling/spheRlab documentation built on Sept. 29, 2017, 6:36 a.m.