.. DRAFT .. DRAFT ..
Status : First Draft
Hopefully, this can evolve into an agreed final form
by the time of the next UGRID release. Contributions are welcome.
Conformance rules for UGRID Conventions v1.x
This information is intended to follow the practice established by the CF conformance pages, as attached to the CF conventions.
In that spirit, this is likewise “intended to be a concise summary” of the main convention, and “if there are any discrepancies … the conventions document is the ultimate authority.”
Each reference statement is provided with a short code :
“Rxxx” for requirements and “Axxx” for advisory recommendations,
in the manner of the Flake8 error and warning codes, and the PyCodeStyle ones.
Future editions will maintain these reference numbers, but possibly add new ones. They can be used as definitive
references by a conformance-checker utility. 10
This version is consistent with :
- UGRID v1.0
- CF version 1.11
Preamble : Terms and Definitions
- A mesh variable is a variable with a
cf_roleattribute of"mesh_topology". 2 - A varlist is a string attribute consisting of a space-separated list of variable names
- these must be names of variables existing in the same dataset : this is implicit in all uses
- A coordinate attribute of a mesh is a varlist with one of the following names 2 4
node_coordinatesedge_coordinatesface_coordinates
- A connectivity attribute of a mesh is a varlist with one of the following names 2 4
edge_node_connectivityface_node_connectivityface_edge_connectivityedge_face_connectivityface_face_connectivityboundary_node_connectivity
- A mesh coordinate is a variable listed in a coordinate attribute of a mesh
- A mesh connectivity is a variable listed in a connectivity attribute of a mesh 2
- A mesh is the parent mesh of those mesh coordinates or mesh connectivities which are included in any of its coordinate or connectivity attributes : This defines the “parent mesh” of any mesh coordinate or mesh connectivity. 1
- The parent mesh of a location index set is that named in its
meshattribute - the element dimensions of a mesh are those indexing its elements (i.e. nodes, edges or faces),
or mesh boundaries, within any of its mesh coordinates and mesh connectivities.
- the node dimension is the single dimension of the node coordinates (should all be the same)
- if there is an
edge_node_connectivity, then there is an edge dimension (see below for how this is determined) - if there is a
face_node_connectivity, then there is a face dimension (see below for how this is determined) - if there is a
boundary_node_connectivity, then there is a boundary dimension (see below for how this is determined)
- the element dimension of a mesh connectivity or mesh coordinate is that one of its dimensions which is an element dimension of its parent mesh. N.B. there can only be one : see R201 / R304
- A location index set is a variable with a
cf_roleattribute of"location_index_set"2 - A mesh data variable is a CF data variable with either a
meshor alocation_index_setattribute.
Mesh variables
Mesh variable requirements
For any mesh variable ..
- R101 it must have a
cf_roleattribute,- R102 with the value
"mesh_topology"
- R102 with the value
- R103 it must have a
topology_dimensionattribute, - all mesh connectivity and coordinate attributes must be varlists, that is ..
- R107 all mesh connectivity attributes must contain a single variable name
- R108 all elements of all mesh coordinate attributes must be valid mesh coordinates
- R109 all mesh connectivity attributes must be valid mesh connectivities
- R110 it must have a
node_coordinatesattribute - an
edge_node_connectivityattribute .. - R113 a
face_node_connectivityattribute must be present if and only iftopology_dimensionis 2 - R114 a
boundary_node_connectivityattribute may be present, only iftopology_dimensionis 2 6 - if the mesh has an
edge_node_connectivity, then it has an edge dimension, which- either is given by the
edge_dimensionattribute, if there is one, in which case- R115
edge_dimensionmust be the name of a dataset dimension
- R115
- or, if there is no
edge_dimensionattribute, the edge dimension is the first dimension of theedge_node_connectivity - when an edge dimension exists ..
- R116 if any edge connectivity has the edge dimension as its second dimension,
(instead of its first), then the mesh must have an
edge_dimensionattribute
- R116 if any edge connectivity has the edge dimension as its second dimension,
(instead of its first), then the mesh must have an
- either is given by the
- if the mesh has a
face_node_connectivity, then it has a face dimension, which ..- either is given by the
face_dimensionattribute, if there is one, in which case- R117
face_dimensionmust be the name of a dataset dimension
- R117
- or, if there is no
face_dimensionattribute, the edge dimension is the first dimension of theface_node_connectivity - when a face dimension exists ..
- R118 if any face connectivity has the face dimension as its second dimension,
(instead of its first), then the mesh must have a
face_dimensionattribute
- R118 if any face connectivity has the face dimension as its second dimension,
(instead of its first), then the mesh must have a
- either is given by the
- if the mesh has a
boundary_node_connectivity, then it has a boundary dimension, which is the first dimension of theboundary_node_connectivityvariable 7 - R119 a
face_face_connectivityattribute may only exist if the mesh has a face dimension - R120 a
face_edge_connectivityattribute may only exist if the mesh has both a face dimension and an edge dimension - R121 an
edge_face_connectivityattribute may only exist if the mesh has both a face dimension and an edge dimension - R122 a
face_dimensionattribute may only exist if the mesh has a face dimension - R123 an
edge_dimensionattribute may only exist if the mesh has an edge dimension
Mesh variable recommendations
- A101 it should have no dimensions
- A102 it should not have a
standard_nameattribute - A103 it should not have a
unitsattribute - A104 it should not share any of its element dimensions with other meshes 11
- A105 if it has multiple element dimensions, they should all be different
- A106 it should not have any attributes ending in “_connectivity”, “_coordinates” or “_dimension” which are not valid UGRID terms 12
Mesh coordinate variables
For any mesh coordinate variable ..
Mesh coordinate variable requirements
- R201 it must map a single dimension
- R202 which is the appropriate element dimension of the parent mesh
- R203 any
boundsattribute must refer to a suitable CF bounds variable matching its own properties and dimensions
Mesh coordinate variable recommendations
- A201 it should have one and only one parent mesh 1
- A202 it should have a floating-point data type
- A203 it should have a
standard_nameattribute which is a valid CF standard-name
(see : CF conformance section 3.3) - A204 it should have a
unitsattribute which is a valid CF unit
(see CF conformance section 3.1) - if it has a
boundsattribute, then - A206 if its location is ‘node’, then it should not have a
boundsattribute.
Mesh connectivity variables
Mesh connectivity variable requirements
For any mesh connectivity variable ..
- R301 it must have a
cf_roleattribute, which - R304 it must exactly have two dimensions, of which
- R307 its element dimension must be that of the first location named in its
cf_role13 - R308 if it has a
cf_role13 ofedge_node_connectivityorboundary_node_connectivity, then its non-element dimension must have length 2 - R309 any
start_indexattribute must have one of the values (0, 1). - R310 if it has a
cf_roleofedge_node_connectivityorboundary_node_connectivity, then it must not contain any ‘missing’ indices - R311 if it has a
cf_roleofface_node_connectivity, then each face index must contain at least 3 non-‘missing’ indices
Mesh connectivity variable recommendations
- A301 it should have one and only one parent mesh 1
- A302 it should have an integer type
- A303 any
start_indexattribute should have an integer type - A304 if it has a
cf_roleofedge_node_connectivityorboundary_node_connectivity, then it should not have a_FillValueattribute - A305 if it contains any “missing” indices, then it should have a
_FillValueattribute :
I.E. it does not rely on a netcdf “default fill-value” - if there is a
_FillValueattribute, then - A308 all its non-missing values should be valid indices into the relevant dimension of
the parent mesh, i.e. the second location named in the
cf_role3 8.
Location index set variables
For any location index set variable ..
Location index set variable requirements
- R401 it must have a
cf_roleattribute with the value"location_index_set" - R402 it must have a
meshattribute, which is a string containing the name of a valid mesh variable in the dataset - R403 it must have a
locationattribute, which is one offace,edgeornode, and- R404 the corresponding location must exist in the parent mesh
- R405 it must have a single dimension
- R406 any
start_indexattribute must have one of the values (0, 1).
Location index set variable recommendations
- A401 it should have an integer type
- A402 it should not contain any missing points
- A403 it should not have a
_FillValueattribute - A404 the length of its single dimension should be less than or equal to the corresponding element dimension of its parent mesh
- A405 its values should all be distinct, and
- A407 any
start_indexattribute should have an integer type
Mesh data variables
Mesh data variable requirements
- if there is a
meshattribute - if there is a
location_index_setattribute - its dimensions ..
Other
Other recommendations
- A901 all dataset contents (dimension, variables and their attributes) should also be CF compliant – see: CF conventions.
- A902 there should be a global
Conventionsattribute, - A904 no netcdf variable should have a
cf_roleequal to any of the values defined here, unless it is one of the UGRID variable types defined here to use one
– i.e. a mesh, location index set or connectivity variable - A905 no dataset variable should have a
cf_rolewhich is not either one of the valid terms described here, or one of the CF-definedcf_rolevalues 14
-
From the given definitions, any mesh connectivity or -coordinate must logically have a parent mesh. We intend that it should always have exactly and only one. ↩↩↩
-
for correctness testing (only), we may broaden the definitions of these items in order to detect some obvious errors. For example, we will attempt to check as a mesh variable any variable that either has a
cf_roleofmesh_topologyor is named in themeshattribute of a data variable or location index set variable. ↩↩↩↩↩ -
“valid” element indices are values within the range of the corresponding element dimension of the parent mesh, allowing for any
start_indexoffset. ↩↩ -
For now at least, we exclude mention of full-3d meshes, whose status is currently in question : cf. this GitHub discussion, as this would add considerable complexity here. ↩↩↩
-
For now, we allow 0-d meshes (those with nodes only). Though, this is not explicitly mentioned in the UGRID v1.0 pages. ↩↩
-
It is not supported to have boundaries in a 1-D mesh (I.E. one with only edges), though this is not logically impossible. If a specific need arises, this could change in future. ↩
-
Since there is no provision for a
boundary_dimensionattribute, the boundary dimension is always the first dimension of aboundary_node_connectivity, and its second dimension must always be 2 (i.e. it cannot be transposed). If a specific need arises, this could change in future. ↩ -
Requirements on values of variables may not always be practical to check, since this requires loading all of their data. ↩↩↩
-
The form of the global
Conventionsattribute is determined by the CF conformance pages, section 2.6.1. However, the definition of UGRID release numbers is not yet finalised. ↩ -
Providing stable statement references allows conformance statements to evolve without invalidating earlier versions of a checker program. We also provide a linkable web anchor for each one. ↩
-
if a mesh does not share any element dimensions with other meshes, it follows that it also will not share any element coordinates or connectivities with other meshes. ↩
-
invalid ‘lookalike’ attributes, which are not defined by UGRID, include such as : “node_face_connectivity”, “boundary_coordinates”, “boundary_dimension” or “node_dimension”. ↩
-
for checking purposes, the identity of a connectivity is actually defined by the referring attribute in the parent mesh. However, if the connectivity is correctly formed, then its
cf_rolevalue will always be the same as this – cf:R303. ↩↩ -
in the present latest CF version the only
cf_roleterms defined are the discrete-geometry types :timeseries_id,profile_idandtrajectory_id↩