@@ -7,6 +7,8 @@ Convention interface
77.. contents ::
88 :local:
99
10+ .. currentmodule :: emsarray.conventions
11+
1012Each supported convention implements
1113the :class: `~emsarray.conventions.Convention ` interface.
1214
@@ -25,8 +27,37 @@ the :class:`~emsarray.conventions.Convention` interface.
2527.. autoclass :: emsarray.conventions.SpatialIndexItem
2628 :members:
2729
28- .. autodata :: emsarray.conventions._base.GridKind
29- .. autodata :: emsarray.conventions._base.Index
30+ .. type :: GridKind
31+
32+ Some type that can enumerate the different :ref: `grid types <grids >`
33+ present in a dataset.
34+ This can be an :class: `enum.Enum ` listing each different kind of grid.
35+
36+ :type: `Index ` values will be included in the feature properties
37+ of exported geometry from :mod: `emsarray.operations.geometry `.
38+ If the index type includes the grid kind,
39+ the grid kind needs to be JSON serializable.
40+ The easiest way to achieve this is to make your GridKind type subclass :class: `str `:
41+
42+ .. code-block :: python
43+
44+ class MyGridKind (str , enum .Enum ):
45+ face = ' face'
46+ edge = ' edge'
47+ node = ' node'
48+
49+ For cases where the convention only supports a single grid,
50+ a singleton enum can be used.
51+
52+ More esoteric cases involving datasets with a potentially unbounded numbers of grids
53+ can use a type that supports this instead.
54+
55+ .. type :: Index
56+
57+ An :ref: `index <indexing >` to a specific point on a grid in this convention.
58+ For conventions with :ref: `multiple grids <grids >` (e.g. cells, edges, and nodes),
59+ this should be a tuple whos first element is :type: `.GridKind `.
60+ For conventions with a single grid, :type: `.GridKind ` is not required.
3061
3162.. autoclass :: emsarray.conventions.Specificity
3263 :members:
0 commit comments