Skip to content

Commit 229e383

Browse files
committed
dev
1 parent 4250b11 commit 229e383

2 files changed

Lines changed: 136 additions & 48 deletions

File tree

cf/cellconnectivity.py

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,57 @@
66
class CellConnectivity(mixin.PropertiesData, cfdm.CellConnectivity):
77
"""A cell connectivity construct of the CF data model.
88
9-
TODOUGRID
10-
11-
A cell measure construct provides information that is needed about
12-
the size or shape of the cells and that depends on a subset of the
13-
domain axis constructs. Cell measure constructs have to be used
14-
when the size or shape of the cells cannot be deduced from the
15-
dimension or auxiliary coordinate constructs without special
16-
knowledge that a generic application cannot be expected to have.
17-
18-
The connectivity measure construct consists of a numeric array of the
19-
metric data which spans a subset of the domain axis constructs,
20-
and properties to describe the data. The connectivity measure construct
21-
specifies a "measure" to indicate which metric of the space it
22-
supplies, e.g. connectivity horizontal areas, and must have a units
23-
property consistent with the measure, e.g. square metres. It is
24-
assumed that the metric does not depend on axes of the domain
25-
which are not spanned by the array, along which the values are
26-
implicitly propagated. CF-netCDF connectivity measure variables correspond
27-
to connectivity measure constructs.
9+
A cell connectivity construct defines explicitly how cells
10+
arranged in two or three dimensions in real space but indexed by a
11+
single domain (discrete) axis are connected. Connectivity can only
12+
be provided when the domain axis construct also has a domain
13+
topology construct, and two cells can only be connected if they
14+
also have a topological relationship. For instance, the
15+
connectivity of two-dimensional face cells could be characterised
16+
by whether or not they have shared edges, where the edges are
17+
defined by connected nodes of the domain topology construct.
18+
19+
The cell connectivity construct consists of an array recording the
20+
connectivity, and properties to describe the data. There must be a
21+
property indicating the condition by which the connectivity is
22+
derived from the domain topology. The array spans the domain axis
23+
construct with the addition of a ragged dimension that indexes a
24+
unique identity for the cell as well as the identities of all
25+
other cells to which it is connected. The cell identity must be
26+
recorded in the first element of the ragged dimension, otherwise
27+
the order is arbitrary. Note that the connectivity array for point
28+
cells is, by definition, equivalent to the array of the domain
29+
topology construct.
30+
31+
When cell connectivity constructs are present they are considered
32+
to be definitive and must be used in preference to the
33+
connectivities implied by inspection of any other constructs,
34+
apart from the domain topology construct, which are not guaranteed
35+
to be the same.
36+
37+
In CF-netCDF a cell topology construct can only be provided by a
38+
UGRID mesh topology variable. The construct array is supplied
39+
either indirectly by any of the UGRID variables that are used to
40+
define a domain topology construct, or directly by the UGRID
41+
"edge_edge_connectivity" variable (for edge cells) or
42+
"face_face_connectivity" variable (for face cells). In the direct
43+
case, the integer indices contained in the UGRID variable may be
44+
used as the cell identities, although the CF data model attaches
45+
no significance to the values other than the fact that some values
46+
are the same as others.
47+
48+
Restricting the types of connectivity to those implied by the
49+
geospatial topology of the cells precludes connectivity derived
50+
from any other sources, but is consistent with UGRID encoding
51+
within CF-netCDF.
52+
53+
See CF Appendix I "The CF Data Model".
2854
2955
**NetCDF interface**
3056
3157
{{netCDF variable}}
3258
33-
.. versionadded:: TODOUGRIDVER
59+
.. versionadded:: UGRIDVER
3460
3561
"""
3662

@@ -44,9 +70,14 @@ def __repr__(self):
4470

4571
@property
4672
def connectivity(self):
47-
"""TODOUGRID Measure which indicates the metric of space supplied.
73+
"""The connectivity type.
4874
49-
.. versionadded:: TODOUGRIDVER
75+
{{cell connectivity type}}
76+
77+
.. versionadded:: UGRIDVER
78+
79+
.. seealso:: `del_connectivity`, `get_connectivity`,
80+
`has_connectivity`, `set_connectivity`
5081
5182
"""
5283
return self.get_connectivity(default=AttributeError())
@@ -78,7 +109,7 @@ def identity(
78109
* The netCDF variable name, preceded by ``'ncvar%'``.
79110
* The value of the *default* parameter.
80111
81-
.. versionadded:: TODOUGRIDVER
112+
.. versionadded:: UGRIDVER
82113
83114
.. seealso:: `id`, `identities`, `long_name`, `connectivity`,
84115
`nc_get_variable`, `standard_name`

cf/domaintopology.py

Lines changed: 82 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,84 @@
66
class DomainTopology(mixin.PropertiesData, cfdm.DomainTopology):
77
"""A domain topology construct of the CF data model.
88
9-
TODOUGRID
10-
11-
A cell measure construct provides information that is needed about
12-
the size or shape of the cells and that depends on a subset of the
13-
domain axis constructs. Cell measure constructs have to be used
14-
when the size or shape of the cells cannot be deduced from the
15-
dimension or auxiliary coordinate constructs without special
16-
knowledge that a generic application cannot be expected to have.
17-
18-
The cell measure construct consists of a numeric array of the
19-
metric data which spans a subset of the domain axis constructs,
20-
and properties to describe the data. The cell measure construct
21-
specifies a "measure" to indicate which metric of the space it
22-
supplies, e.g. cell horizontal areas, and must have a units
23-
property consistent with the measure, e.g. square metres. It is
24-
assumed that the metric does not depend on axes of the domain
25-
which are not spanned by the array, along which the values are
26-
implicitly propagated. CF-netCDF cell measure variables correspond
27-
to cell measure constructs.
9+
A domain topology construct defines the geospatial topology of
10+
cells arranged in two or three dimensions in real space but
11+
indexed by a single (discrete) domain axis construct, and at most
12+
one domain topology construct may be associated with any such
13+
domain axis. The topology describes topological relationships
14+
between the cells - spatial relationships which do not depend on
15+
the cell locations - and is represented by an undirected graph,
16+
i.e. a mesh in which pairs of nodes are connected by links. Each
17+
node has a unique arbitrary identity that is independent of its
18+
spatial location, and different nodes may be spatially co-located.
19+
20+
The topology may only describe cells that have a common spatial
21+
dimensionality, one of:
22+
23+
* Point: A point is zero-dimensional and has no boundary vertices.
24+
* Edge: An edge is one-dimensional and corresponds to a line
25+
connecting two boundary vertices.
26+
* Face: A face is two-dimensional and corresponds to a surface
27+
enclosed by a set of edges.
28+
29+
Each type of cell implies a restricted topology for which only
30+
some kinds of mesh are allowed. For point cells, every node
31+
corresponds to exactly one cell; and two cells have a topological
32+
relationship if and only if their nodes are connected by a mesh
33+
link. For edge and face cells, every node corresponds to a
34+
boundary vertex of a cell; the same node can represent vertices in
35+
multiple cells; every link in the mesh connects two cell boundary
36+
vertices; and two cells have a topological relationship if and
37+
only if they share at least one node.
38+
39+
A domain topology construct contains an array defining the mesh,
40+
and properties to describe it. There must be a property indicating
41+
the spatial dimensionality of the cells. The array values comprise
42+
the node identities, and all array elements that refer to the same
43+
node must contain the same value, which must differ from any other
44+
value in the array. The array spans the domain axis construct and
45+
also has a ragged dimension, whose function depends on the spatial
46+
dimensionality of the cells.
47+
48+
For point cells, the array's ragged dimension values are composed
49+
of the node identity of each cell in the first element, followed
50+
in arbitrary order by the identity of each node to which it is
51+
connected by a mesh link.
52+
53+
For edge and face cells, the array's ragged dimension values are
54+
the node identities of the boundary vertices of each cell, in the
55+
same order that the boundary vertices are stored by the auxiliary
56+
coordinate constructs. Each boundary vertex except the last is
57+
connected by a mesh link to the next vertex along the ragged
58+
dimension, and the last vertex is connected to the first.
59+
60+
When a domain topology construct is present it is considered to be
61+
definitive and must be used in preference to the topology implied
62+
by inspection of any other constructs, which is not guaranteed to
63+
be the same.
64+
65+
In CF-netCDF a domain topology construct can only be provided for
66+
a UGRID mesh topology variable. The information in the construct
67+
array is supplied by the UGRID "edge_nodes_connectivity" variable
68+
(for edge cells) or "face_nodes_connectivity" variable (for face
69+
cells). The topology for node cells may be provided by any of
70+
these three UGRID variables. The integer indices contained in the
71+
UGRID variable may be used as the mesh node identities, although
72+
the CF data model attaches no significance to the values other
73+
than the fact that some values are the same as others. The spatial
74+
dimensionality property is provided by the "location" attribute of
75+
a variable that references the UGRID mesh topology variable,
76+
i.e. a data variable or a UGRID location index set variable.
77+
78+
See CF Appendix I "The CF Data Model".
2879
2980
**NetCDF interface**
3081
31-
{{netCDF variable}}
82+
The netCDF variable name of the UGRID mesh topology variable may
83+
be accessed with the `nc_set_variable`, `nc_get_variable`,
84+
`nc_del_variable`, and `nc_has_variable` methods.
3285
33-
.. versionadded:: TODOUGRIDVER
86+
.. versionadded:: UGRIDVER
3487
3588
"""
3689

@@ -44,15 +97,19 @@ def __repr__(self):
4497

4598
@property
4699
def cell(self):
47-
"""TODOUGRID Measure which indicates the metric of space supplied.
100+
"""The cell type.
48101
49-
.. versionadded:: TODOUGRIDVER
102+
{{cell type}}
103+
104+
.. versionadded:: UGRIDVER
105+
106+
.. seealso:: `del_cell`, `get_cell`, `has_cell`, `set_cell`
50107
51108
"""
52109
return self.get_cell(default=AttributeError())
53110

54111
@cell.setter
55-
def cell(self, value):
112+
def cell(self, value):
56113
self.set_cell(value)
57114

58115
@cell.deleter
@@ -78,7 +135,7 @@ def identity(
78135
* The netCDF variable name, preceded by ``'ncvar%'``.
79136
* The value of the *default* parameter.
80137
81-
.. versionadded:: TODOUGRIDVER
138+
.. versionadded:: UGRIDVER
82139
83140
.. seealso:: `id`, `identities`, `long_name`, `cell`,
84141
`nc_get_variable`, `standard_name`

0 commit comments

Comments
 (0)