NetCDF unstructured grid with subgrid
From BAWiki
Introduction
A grid made out of arbitrary faces (triangles, quadrilaterals) is described. A topographic subgrid is available in addition to the computational grid. 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 with subgrid). Furthermore no information on open or closed edges, boundary conditions 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.
All deviations/extensions from the UGRID conventions are highlighted in darkorange color.
Computational grid
The description of the computational grid is almost identical with NetCDF unstructured grid for an unstructured grid without subgrid. With respect to the computational grid only those variables are repeated here which deviate from their definition for an unstructured grid.
Grid with subgrid
In addition to the variables defining the computational grid all additional variables are presented which define the topographic subgrid. Because these informations are i. e. relevant for visualization, this type of grid is also referred to as plot-subgrid.
Combined grid
The two grids - computational grid plus subgrid - are part of the combined grid or parent mesh. In this context additional contact variables are required. They describe the relationship or cennectivity between the two grids. This concept (parent mesh, contact variables) is esentially based on ideas worked out by Bert Jagers (Deltares) (see Deltares Conventions).
File contents
Dimensions
- nMesh2_node : number of nodes.
- nMesh2_edge : number of edges.
- nMesh2_face : number of faces (polygons).
- nMaxMesh2_face_nodes : maximum number of nodes/edges within a face (polygon)
- nSubMesh2_edge : number of plot-subedges.
- nSubMesh2_face : number of plot-subfaces (plot-subpolygons).
- nMaxSubMesh2_face_nodes : maximum number of plot-subnodes/plot-subedges within a plot-subface (-subpolygon).
- two : constant ( = 2 ).
Comment:
- Plot-subedges and plot-subfaces (-subpolygons) are mainly used for visualization purposes.
- The numerical model UNTRIM2 uses exclusively subface as well as subedge depth classes (not presented here).
- The total number of plot-subfaces and plot-subedges may be equal or larger than the respective number of depth classes.
Local coordinates
The definition for the local coordinates of the computational grid is identical to the description given for an unstructured computational grid without subgrid details. See NetCDF unstructured grid "local coordinates".
Local coordinates of the plot-subgrid
Edges
double SubMesh2_edge_x(nSubMesh2_edge) ;
- SubMesh2_edge_x:long_name = "x-coordinate of 2D sub-mesh edges (center)" ;
- SubMesh2_edge_x:units = "m" ;
- SubMesh2_edge_x:name_id = 1650 ;
- SubMesh2_edge_x:bounds = "SubMesh2_edge_x_bnd" ;
- SubMesh2_edge_x:standard_name = "projection_x_coordinate" ;
double SubMesh2_edge_y(nSubMesh2_edge) ;
- SubMesh2_edge_y:long_name = "y-coordinate of 2D sub-mesh edges (center)" ;
- SubMesh2_edge_y:units = "m" ;
- SubMesh2_edge_y:name_id = 1651 ;
- SubMesh2_edge_y:bounds = "SubMesh2_edge_y_bnd" ;
- SubMesh2_edge_y:standard_name = "projection_y_coordinate" ;
Comment:
- "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.
Faces (polygons)
double SubMesh2_face_x(nSubMesh2_face) ;
- SubMesh2_face_x:long_name = "x-coordinate of 2D sub-mesh faces (arbitrary point inside face)" ;
- SubMesh2_face_x:units = "m" ;
- SubMesh2_face_x:name_id = 1650 ;
- SubMesh2_face_x:bounds = "SubMesh2_face_x_bnd" ;
- SubMesh2_face_x:standard_name = "projection_x_coordinate" ;
double SubMesh2_face_y(nSubMesh2_face) ;
- SubMesh2_face_y:long_name = "y-coordinate of 2D sub-mesh faces (arbitrary point inside face)" ;
- SubMesh2_face_y:units = "m" ;
- SubMesh2_face_y:name_id = 1651 ;
- SubMesh2_face_y:bounds = "SubMesh2_face_y_bnd" ;
- SubMesh2_face_y:standard_name = "projection_y_coordinate" ;
Comment:
- "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.
- An arbitrary point inside each face can be chosen.
Bounds for edges
double SubMesh2_edge_x_bnd(nSubMesh2_edge, two) ; \\ no metadata required
double SubMesh2_edge_y_bnd(nSubMesh2_edge, two) ; \\ no metadata required
Bounds for faces (polygons)
double SubMesh2_face_x_bnd(nSubMesh2_face, nMaxSubMesh2_face_nodes) ; \\ _FillValue required, not all nMaxSubMesh2_face_nodes must be present in one (sub-) face
- SubMesh2_face_x_bnd:_FillValue = fillvalue ;
double SubMesh2_face_y_bnd(nSubMesh2_face, nMaxSubMesh2_face_nodes) ; \\ _FillValue required, not all nMaxSubMesh2_face_nodes must be present in one (sub-) face
- SubMesh2_face_y_bnd:_FillValue = fillvalue ;
Comment:
- Coordinates of (sub-) faces (sub-polygons) must be prescribed in counter-clockwise orientation.
- Invalid coordinates are allowed to be present in the last position(s) in case there are less than nMaxSubMesh2_face_nodes nodes in a face.
Geographic coordinates
The definition for the geographic coordinates of the computational grid is identical to the description given for an unstructured computational grid without subgrid details. See NetCDF unstructured grid "geographic coordinates".
Geographic coordinates of the plot-subgrid
Edges
double SubMesh2_edge_lon(nSubMesh2_edge) ;
- SubMesh2_edge_lon:long_name = "longitude of 2D sub-mesh edges (center)" ;
- SubMesh2_edge_lon:units = "degrees_east" ;
- SubMesh2_edge_lon:name_id = 1653 ;
- SubMesh2_edge_lon:bounds = "SubMesh2_edge_lon_bnd" ;
- SubMesh2_edge_lon:standard_name = "longitude" ;
double SubMesh2_edge_lat(nSubMesh2_edge) ;
- SubMesh2_edge_lat:long_name = "latitude of 2D sub-mesh edges (center)" ;
- SubMesh2_edge_lat:units = "degrees_north" ;
- SubMesh2_edge_lat:name_id = 1652 ;
- SubMesh2_edge_lat:bounds = "SubMesh2_edge_lat_bnd" ;
- SubMesh2_edge_lat:standard_name = "latitude" ;
Comment:
- "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.
Faces (polygons)
double SubMesh2_face_lon(nSubMesh2_face) ;
- SubMesh2_face_lon:long_name = "longitude of 2D sub-mesh faces (arbitrary point inside face)" ;
- SubMesh2_face_lon:units = "degrees_east" ;
- SubMesh2_face_lon:name_id = 1653 ;
- SubMesh2_face_lon:bounds = "SubMesh2_face_lon_bnd" ;
- SubMesh2_face_lon:standard_name = "longitude" ;
double SubMesh2_face_lat(nSubMesh2_face) ;
- SubMesh2_face_lat:long_name = "latitude of 2D sub-mesh faces (arbitrary point inside face)" ;
- SubMesh2_face_lat:units = "degrees_north" ;
- SubMesh2_face_lat:name_id = 1652 ;
- SubMesh2_face_lat:bounds = "SubMesh2_face_lat_bnd" ;
- SubMesh2_face_lat:standard_name = "latitude" ;
Comment:
- "name_id" corresponds to the so-called PHYDEF-Code of variables which is used internally at BAW.
- An arbitrary point inside each face can be chosen.
Bounds for edges
double SubMesh2_edge_lon_bnd(nSubMesh2_edge, two) ; \\ no metadata required
double SubMesh2_edge_lat_bnd(nSubMesh2_edge, two) ; \\ no metadata required
Bounds for faces (Polygone)
double SubMesh2_face_lon_bnd(nSubMesh2_face, nMaxSubMesh2_face_nodes) ; \\ _FillValue required, not all nMaxSubMesh2_face_nodes must be present in one (sub-) face
- SubMesh2_face_lon_bnd:_FillValue = fillvalue ;
double SubMesh2_face_lat_bnd(nSubMesh2_face, nMaxSubMesh2_face_nodes) ; \\ _FillValue required, not all nMaxSubMesh2_face_nodes must be present in one (sub-) face
- SubMesh2_face_lat_bnd:_FillValue = fillvalue ;
Comment:
- Coordinates of (sub-) faces (sub-polygons) must be prescribed in counter-clockwise orientation.
- Invalid coordinates are allowed to be present in the last position(s) in case there are less than nMaxSubMesh2_face_nodes nodes in a face.
Connectivities
Computational grid
Connectivity tables for the computational grid are identical to those used for an unstructured grid without subgrid. See NetCDF unstructured grid "Connectivities".
Grid with subgrid
The subgrid does not require any connectivity table. Inter-relation between neighbors is not required at all.
Topology
Computational grid
int Mesh2 ;
- Mesh2:long_name = "computational grid" ;
- 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" ;
- Mesh2:parent_mesh = "Combined_Mesh2_and_SubMesh2" ;
Comment:
- 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.
- 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.
- Attribute "parent_mesh" refers to the combined mesh (parent mesh). The computational mesh is the first part of the parent mesh.
Grid with subgrid
int SubMesh2 ;
- SubMesh2:long_name = "SubGrid" ;
- SubMesh2:cf_role = "mesh_topology" ;
- SubMesh2:topology_dimension = 2 ;
- SubMesh2:edge_coordinates = "SubMesh2_edge_x SubMesh2_edge_y SubMesh2_edge_lon SubMesh2_edge_lat" ;
- SubMesh2:face_coordinates = "SubMesh2_face_x SubMesh2_face_y SubMesh2_face_lon SubMesh2_face_lat" ;
- SubMesh2:parent_mesh = "Combined_Mesh2_and_SubMesh2" ;
Hinweise:
- Other topological data are not available for the submesh.
- This variable is not compliant with UGRID Conventions, because the subgrid requires no connectivity tables.
- Attribute "parent_mesh" refers to the combined mesh (parent mesh). The subgrid is the second part of the parent mesh.
Combined grid
int Combined_Mesh2_and_SubMesh2 ;
- Combined_Mesh2_and_SubMesh2:long_name = "combined grid" ;
- Combined_Mesh2_and_SubMesh2:cf_role = "mesh_topology" ;
- Combined_Mesh2_and_SubMesh2:sub_meshes = "Mesh2 SubMesh2" ;
- Combined_Mesh2_and_SubMesh2:mesh_contacts = "SubMesh2_face_contact SubMesh2_edge_contact" ;
Comment:
- The Parent Mesh concept is so far not supported by the UGRID Conventions.
- Attribute "sub_meshes" refers to the two meshes (computational grid, subgrid) which constitute the Parent Mesh.
- Attribute "mesh_contacts" refers to variables (contact lists) which describe the inter-relation between the child meshes..
Contact lists
Contact lists describe the inter-relation between the different components (child meshes) of the parent mesh. In this example they are used to describe all connexions between computational grid and subgrid.
Contact list plot-subedges <-> edges
int SubMesh2_edge_contact(nSubMesh2_edge, two) ;
- SubMesh2_edge_contact:long_name = "contact list between plot-subedges and edges in the computational grid" ;
- SubMesh2_edge_contact:valid_range = 0, 4279 ;
- SubMesh2_edge_contact:_FillValue = -999 ;
- SubMesh2_edge_contact:coordinates = "SubMesh2_edge_x SubMesh2_edge_y SubMesh2_edge_lon SubMesh2_edge_lat" ;
- SubMesh2_edge_contact:grid_mapping = "Mesh2_crs" ;
- SubMesh2_edge_contact:cf_role = "mesh_topology_contact" ;
- SubMesh2_edge_contact:contact_meshes = "SubMesh2 Mesh2" ;
- SubMesh2_edge_contact:contact_type = "edge edge" ;
- SubMesh2_edge_contact:start_index = 0 ;
Comment:
- The mesh topology contact concept is so far not supported by the UGRID Conventions.
- Indices start with zero..
- Each plot-subedge refers to an edge in the computational grid.
- Each edge of the computational grid typically refers to more than one plot-subedge.
Conatct list plot-subfaces <-> faces
int SubMesh2_face_contact(nSubMesh2_face, two) ;
- SubMesh2_face_contact:long_name = "contact list between plot-subfaces and faces in the computational grid" ;
- SubMesh2_face_contact:valid_range = 0, 10271 ;
- SubMesh2_face_contact:_FillValue = -999 ;
- SubMesh2_face_contact:coordinates = "SubMesh2_face_x SubMesh2_face_y SubMesh2_face_lon SubMesh2_face_lat" ;
- SubMesh2_face_contact:grid_mapping = "Mesh2_crs" ;
- SubMesh2_face_contact:cf_role = "mesh_topology_contact" ;
- SubMesh2_face_contact:contact_meshes = "SubMesh2 Mesh2" ;
- SubMesh2_face_contact:contact_type = "face face" ;
- SubMesh2_face_contact:start_index = 0 ;
Comment:
- The mesh topology contact concept is so far not supported by the UGRID Conventions.
- Indices start with zero..
- Each plot-subface refers to a face in the computational grid.
- Each face of the computational grid typically refers to more than one plot-subface.
Coordinate transformation
back to NetCDF