Actions

NetCDF unstructured grid

From BAWiki

Revision as of 13:11, 18 April 2016 by imported>Lang Guenther (Edge-node connectivity: Typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Introduction

A grid made out of arbitrary faces (triangles, quadrilaterals) is described. Typical file types are e.g. untrim_grid.dat as well as utrsub_grid.dat. Storage of grid related data, e. g. bathymetry or water level, is described elsewhere (see NetCDF synoptic data for unstructured grid. Furthermore no information on open or closed edges, boundary cconditions etc. is given here. The following description is concentrating solely on grid structure (topology).

The following description is complete with respect to the staggered locations node, edge and face. One should consider although that the full set of data is not available for all file types.

The concept presented is essentially identical with section 2D flexible mesh (mixed triangles, quadrilaterals, etc.) topology of the UGRID Conventions. All deviations from the UGRID conventions are highlighted in darkorange color.

File contents

Dimensions

  1. nMesh2_node : number of nodes.
  2. nMesh2_edge : number of edges.
  3. nMesh2_face : number of faces (polygons).
  4. nMaxMesh2_face_nodes : maximum number of nodes/edges in a face (polygon).
  5. two : constant ( = 2 ).

Local coordinates

Nodes

double Mesh2_node_x(nMesh2_node) ;

Mesh2_node_x:long_name = "x-ccordinate of 2D mesh nodes" ;
Mesh2_node_x:units = "m" ;
Mesh2_node_x:name_id = 1650 ;
Mesh2_node_x:standard_name = "projection_x_coordinate" ;

double Mesh2_node_y(nMesh2_node) ;

Mesh2_node_y:long_name = "y-coordinate of 2D mesh nodes" ;
Mesh2_node_y:units = "m" ;
Mesh2_node_y:name_id = 1651 ;
Mesh2_node_y:standard_name = "projection_y_coordinate" ;

Comment:

  1. "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.

Edges

double Mesh2_edge_x(nMesh2_edge) ;

Mesh2_edge_x:long_name = "x-coordinate of 2D mesh edges (center)" ;
Mesh2_edge_x:units = "m" ;
Mesh2_edge_x:name_id = 1650 ;
Mesh2_edge_x:bounds = "Mesh2_edge_x_bnd" ;
Mesh2_edge_x:standard_name = "projection_x_coordinate" ;

double Mesh2_edge_y(nMesh2_edge) ;

Mesh2_edge_y:long_name = "y-coordinate of 2D mesh edges (center)" ;
Mesh2_edge_y:units = "m" ;
Mesh2_edge_y:name_id = 1651 ;
Mesh2_edge_y:bounds = "Mesh2_edge_y_bnd" ;
Mesh2_edge_y:standard_name = "projection_y_coordinate" ;

Comment:

  1. "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.

Faces (polygons)

double Mesh2_face_x(nMesh2_face) ;

Mesh2_face_x:long_name = "x-coordinate of 2D mesh faces (center of gravity)" ;
Mesh2_face_x:units = "m" ;
Mesh2_face_x:name_id = 1650 ;
Mesh2_face_x:bounds = "Mesh2_face_x_bnd" ;
Mesh2_face_x:standard_name = "projection_x_coordinate" ;

double Mesh2_face_y(nMesh2_face) ;

Mesh2_face_y:long_name = "y-coordinate of 2D mesh faces (center of gravity)" ;
Mesh2_face_y:units = "m" ;
Mesh2_face_y:name_id = 1651 ;
Mesh2_face_y:bounds = "Mesh2_face_y_bnd" ;
Mesh2_face_y:standard_name = "projection_y_coordinate" ;

double Mesh2_face_center_x(nMesh2_face) ;

Mesh2_face_center_x:long_name = "x-coordinate of 2D mesh faces (circumcenter)" ;
Mesh2_face_center_x:units = "m" ;
Mesh2_face_center_x:name_id = 1650 ;
Mesh2_face_center_x:standard_name = "projection_x_coordinate" ;

double Mesh2_face_center_y(nMesh2_face) ;

Mesh2_face_center_y:long_name = "y-coordinate of 2D mesh faces (circumcenter)" ;
Mesh2_face_center_y:units = "m" ;
Mesh2_face_center_y:name_id = 1651 ;
Mesh2_face_center_y:standard_name = "projection_y_coordinate" ;

Comment:

  1. "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.
  2. Center of gravity is used, because this point is always inside the polygon if the polygon is convex.
  3. The center of the circumcircle is relevant for numerical models like UNTRIM or UNTRIM2.

(optional) Bounds for edges

double Mesh2_edge_x_bnd(nMesh2_edge, two) ; \\ no metadata required

double Mesh2_edge_y_bnd(nMesh2_edge, two) ; \\ no metadata required

(optional) Bounds for faces (polygons)

double Mesh2_face_x_bnd(nMesh2_face, nMaxMesh2_face_nodes) ;

Mesh2_face_x_bnd:_FillValue = fillvalue ; \\ _FillValue required, not all nMaxMesh2_face_nodes must be present in one face

double Mesh2_face_y_bnd(nMesh2_face, nMaxMesh2_face_nodes) ;

Mesh2_face_y_bnd:_FillValue = fillvalue ; \\ _FillValue required, not all nMaxMesh2_face_nodes must be present in one face

Comment:

  1. Node coordinates of faces (polygons) must be prescribed in counter-clockwise orientation.
  2. Invalid coordinates are allowed to be present in the last position(s) in case there are less than nMaxMesh2_face_nodes nodes in a face.

Geographic coordinates

Nodes

double Mesh2_node_lon(nMesh2_node) ;

Mesh2_node_lon:long_name = "longitude of 2D mesh nodes" ;
Mesh2_node_lon:units = "degrees_east" ;
Mesh2_node_lon:name_id = 1653 ;
Mesh2_node_lon:standard_name = "longitude" ;

double Mesh2_node_lat(nMesh2_node) ;

Mesh2_node_lat:long_name = "latitude of 2D mesh nodes" ;
Mesh2_node_lat:units = "degrees_north" ;
Mesh2_node_lat:name_id = 1652 ;
Mesh2_node_lat:standard_name = "latitude" ;

Comment:

  1. "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.

Edges

double Mesh2_edge_lon(nMesh2_edge) ;

Mesh2_edge_lon:long_name = "longitude of 2D mesh edges (center)" ;
Mesh2_edge_lon:units = "degrees_east" ;
Mesh2_edge_lon:name_id = 1653 ;
Mesh2_edge_lon:bounds = "Mesh2_edge_lon_bnd" ;
Mesh2_edge_lon:standard_name = "longitude" ;

double Mesh2_edge_lat(nMesh2_edge) ;

Mesh2_edge_lat:long_name = "latitude of 2D mesh edges (center)" ;
Mesh2_edge_lat:units = "degrees_north" ;
Mesh2_edge_lat:name_id = 1652 ;
Mesh2_edge_lat:bounds = "Mesh2_edge_lat_bnd" ;
Mesh2_edge_lat:standard_name = "latitude" ;

Comment:

  1. "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.

Faces (polygons)

double Mesh2_face_lon(nMesh2_face) ;

Mesh2_face_lon:long_name = "longitude of 2D mesh nodes (center of gravity)" ;
Mesh2_face_lon:units = "degrees_east" ;
Mesh2_face_lon:name_id = 1653 ;
Mesh2_face_lon:bounds = "Mesh2_face_lon_bnd" ;
Mesh2_face_lon:standard_name = "longitude" ;

double Mesh2_face_lat(nMesh2_face) ;

Mesh2_face_lat:long_name = "latitude of 2D mesh nodes (center of gravity)" ;
Mesh2_face_lat:units = "degrees_north" ;
Mesh2_face_lat:name_id = 1652 ;
Mesh2_face_lat:bounds = "Mesh2_face_lat_bnd" ;
Mesh2_face_lat:standard_name = "latitude" ;

double Mesh2_face_center_lon(nMesh2_face) ;

Mesh2_face_center_lon:long_name = "longitude of 2D mesh nodes (circumcenter)" ;
Mesh2_face_center_lon:units = "degrees_east" ;
Mesh2_face_center_lon:name_id = 1653 ;
Mesh2_face_center_lon:standard_name = "longitude" ;

double Mesh2_face_center_lat(nMesh2_face) ;

Mesh2_face_center_lat:long_name = "latitude of 2D mesh nodes (circumcenter)" ;
Mesh2_face_center_lat:units = "degrees_north" ;
Mesh2_face_center_lat:name_id = 1652 ;
Mesh2_face_center_lat:standard_name = "latitude" ;

Comment:

  1. "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.
  2. Center of gravity is used, because this point is always inside the polygon if the polygon is convex.
  3. The center of the circumcircle is relevant for numerical models like UNTRIM or UNTRIM2.

(optional) Bounds for edges

double Mesh2_edge_lon_bnd(nMesh2_edge, two) ; \\ no metadata required

double Mesh2_edge_lat_bnd(nMesh2_edge, two) ; \\ no metadata required

(optional) Bounds for faces (polygons)

double Mesh2_face_lon_bnd(nMesh2_face, nMaxMesh2_face_nodes) ; \\ _FillValue required, not all nMaxMesh2_face_nodes must be present in one face

Mesh2_face_lon_bnd:_FillValue = fillvalue ;

double Mesh2_face_lat_bnd(nMesh2_face, nMaxMesh2_face_nodes) ; \\ _FillValue required, not all nMaxMesh2_face_nodes must be present in one face

Mesh2_face_lat_bnd:_FillValue = fillvalue ;

Comment:

  1. Node coordinates of faces (polygons) must be prescribed in counter-clockwise orientation.
  2. Invalid coordinates are allowed to be present in the last position(s) in case there are less than nMaxMesh2_face_nodes nodes in a face.

Connectivities

Edge-node connectivity

int Mesh2_edge_nodes(nMesh2_edge, two) ;

Mesh2_edge_nodes:long_name = "list of nodes for all edges, start node - end node" ;
Mesh2_edge_nodes:cf_role= "edge_node_connectivity" ;
Mesh2_edge_nodes:start_index = 0;

Comment:

  1. First and second node represent start and end point of an edge.

Edge-face connectivity

int Mesh2_edge_faces(nMesh2_edge, two) ;

Mesh2_edge_faces:long_name = "list of (adjacent) faces (polygons) for all edges - left and right neigbour" ;
Mesh2_edge_faces:cf_role = "edge_face_connectivity" ;
Mesh2_edge_faces:start_index = 0 ;
Mesh2_edge_faces:_FillValue = -999 ;

Comment:

  1. First and second entry represent left and right neighbor polygons.
  2. "_FillValue" is used to indicate edges at boundaries with one missing neighbor polygon.

Face-node connectivity

int Mesh2_face_nodes(nMesh2_face, nMaxMesh2_face_nodes) ;

Mesh2_face_nodes:long_name = "list of nodes for all faces (polygons), counterclockwise" ;
Mesh2_face_nodes:cf_role = "face_node_connectivity" ;
mesh2_face_nodes:start_index = 0 ;
Mesh2_face_nodes:_FillValue = -999 ;

Comment:

  1. Nodes must be prescribed in counter-clockwise orientation.
  2. Missing nodes are expressed using _FillValue.
  3. Missing nodes are only allowed to be present in the last position(s).

Face-edge connectivity

int Mesh2_face_edges(nMesh2_face, nMaxMesh2_face_nodes) ;

Mesh2_face_edges:long_name = "list of edges for all faces (polygons), counterclockwise" ;
Mesh2_face_edges:cf_role = "face_edge_connectivity" ;
Meshe_face_edges:start_index = 0 ;
Mesh2_face_edges:_FillValue = -999 ;

Comment:

  1. Edges must be prescribed in counter-clockwise orientation..
  2. Missing edges are expressed using _FillValue.
  3. Missing edges are only allowed to be present in the last position(s).

Topology

int Mesh2 ;

Mesh2:long_name = "name of grid can be stored here" ;
Mesh2:cf_role = "mesh_topology" ; \\ UGRID required
Mesh2:topology_dimension = 2 ; \\ UGRID required
Mesh2:node_coordinates = "Mesh2_node_x Mesh2_node_y Mesh2_node_lon Mesh2_node_lat" ; \\ UGRID required
Mesh2:edge_coordinates = "Mesh2_edge_x Mesh2_edge_y Mesh2_edge_lon Mesh2_edge_lat" ; \\ UGRID optionally required for data at edges
Mesh2:face_coordinates = "Mesh2_face_x Mesh2_face_y Mesh2_face_lon Mesh2_face_lat Mesh2_face_center_x Mesh2_face_center_y Mesh2_face_center_lon Mesh2_face_center_lat" ; \\ UGRID optionally required for data at faces
Mesh2:face_node_connectivity = "Mesh2_face_nodes" ; \\ UGRID required
Mesh2:face_edge_connectivity = "Mesh2_face_edges" ; \\ UGRID optional
Mesh2:edge_node_connectivity = "Mesh2_edge_nodes" ; \\ UGRID optional
Mesh2:edge_face_connectivity = "Mesh2_edge_faces" ;

Comment:

  1. Not all connectivities must be available because some of them contain redundant information. But be friendly to the end-user and provide as much information as possible.
  2. Attributes face_dimension and edge_dimension from 2D flexible mesh (mixed triangles, quadrilaterals, etc.) topology are not supported by BAW. These are required only in case the dimension ordering is nonstandard in any of the connectivity variables for faces and edges, respectively.

Coordinate transformation


back to NetCDF


Overview