sl.griddes2neighmat: Read CDO Grid Description File and Derive Neighbourhood

Description Usage Arguments Details Value Author(s) Examples

View source: R/sl.griddes2neighmat.R


Read longitude and latitude information (nodes and boundary vertices) from a CDO grid description file of an unstructured triangular mesh and derive neighbourhood and other information.


sl.griddes2neighmat(CDOgriddes, critnum.neigh = 2, critnum.coast = 1)



a character providing the system location of the CDO grid description file (NetCDF format).


an integer needed to decide whether any two nodes are neighbours; nodes need to have at least critnum.neigh common boundary vertices to be classified as neighbours. The correct value may depend on the mesh structure, and/or the question at hand. The default value is critnum.neigh=2.


an integer needed to decide whether a node is coastal: if any of the corresponding boundary vertices has less than critnum.coast matches with any boundary vertex of any other node, the node is assigned as coastal. The correct value depends on the mesh structure. The default is critnum.coast=1, which works for meshes where coastal nodes have at least one boundary vertex that is not shared with any neighbour node. Other meshes may need critnum.coast=2.


For each node given in the CDO mesh description the boundary vertices span a polygon that defines the 'stamp' of that node, that is, the patch over which the node value is assumed to be valid ('finite volume' interpretation). In this function the longitude and latitude information of the boundary vertices are used to derive the neighbourhood (and other) information. Note that the boundary polygon is not identical with what is usually referred to as an 'element': the latter is constructed by three nodes, whereas the boundary polygon consists of vertices surrounding each node, e.g., the edge medians and element centroids.



a vector of length N giving the latitudes of all nodes.


a vector of length N giving the longitudes of all nodes.


a matrix of size NxM giving the (ordered) neighbours of all nodes, where M is the maximum number of neighbours for a node.


a vector of size NxM giving the (ordered) neighbours of all nodes.


a vector of size N with logical values indicating which nodes are coastal.


an integer identical with the equally named function argument.


an integer identical with the equally named function argument.


Helge Goessling


## To be provided ...

helgegoessling/spheRlab documentation built on Dec. 22, 2018, 10:14 p.m.