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

sl.elemfull2elemsubR Documentation

Generate Elements of an Unstructured-Mesh Node Subset

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

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

## To be provided ...

FESOM/spheRlab documentation built on April 6, 2024, 6:52 p.m.