mpas_tools.viz.mesh_to_triangles.mesh_to_triangles

mpas_tools.viz.mesh_to_triangles.mesh_to_triangles(dsMesh, periodicCopy=False)[source]

Construct a dataset in which each MPAS cell is divided into the triangles connecting pairs of adjacent vertices to cell centers.

Parameters:
  • dsMesh (xarray.Dataset) – An MPAS mesh

  • periodicCopy (bool, optional) – Whether to make a periodic copy of triangles that cross -180/180 degrees longitude. This is helpful when plotting triangles in a lon/lat space.

Returns:

dsTris (xarray.Dataset) – A dataset that defines triangles connecting pairs of adjacent vertices to cell centers as well as the cell index that each triangle is in and cell indices and weights for interpolating data defined at cell centers to triangle nodes. dsTris includes variables triCellIndices, the cell that each triangle is part of; nodeCellIndices and nodeCellWeights, the indices and weights used to interpolate from MPAS cell centers to triangle nodes; Cartesian coordinates xNode, yNode, and zNode; and lonNode` and latNode in radians. lonNode is guaranteed to be within 180 degrees of the cell center corresponding to triCellIndices. Nodes always have a counterclockwise winding.