Skip to content

Commit 6dc6a30

Browse files
authored
Update design_doc.md (#24)
* Update design_doc.md * Add multi dimensional index * BBox queries are special cases of polygon queries * Update scaleability to recommended
1 parent 7f501fd commit 6dc6a30

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

design_doc.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ Xarrays extension for DGGS. Technical specifications.
55
## Goals
66

77
The goal of the `xdggs` library is to facilitate working with multiple Discrete Global Grid Systems (DGGSs) via a unified, high-level and user-friendly API that is deeply integrated with [Xarray](https://xarray.dev).
8+
This document describes the in-memory representation of DGGS data in Python environments.
89

910
Examples of common DGGS features that `xdggs` should provide or facilitate:
1011

1112
- convert a DGGS from/to another grid (e.g., a DGGS, a latitude/longitude rectilinear grid, a raster grid, an unstructured mesh)
1213
- convert a DGGS from/to vector data (points, lines, polygons, envelopes)
1314
- convert between different cell id representations of a same DGGS (e.g., uint64 vs. string)
1415
- select data on a DGGS by cell ids or by geometries (spatial indexing)
15-
- change DGGS resolution (upgrade or downgrade)
16+
- expand and reduce the available resolutions of a DGGS using down and upsampling, respectively.
1617
- operations between similar DGGS (with auto-alignment)
1718
- re-organize cell ids (e.g., spatial shuffling / partitioning)
1819
- plotting
@@ -29,7 +30,7 @@ Conversion between DGGS and other grids or vector features may requires specific
2930

3031
`xdggs` should also try to support applications in both GIS and Earth-System communities, which may each use DGGS in slightly different ways (see examples below).
3132

32-
When possible, `xdggs` operations should scale to fine DGGS resolutions (millions of cells). This can be done vertically using backends with vectorized bindings of DGGS implementations written in low-level languages and/or horizontally leveraging Xarray interoperability with Dask. Some operations like spatial indexing may be hard to scale horizontally, though. For the latter, we should probably focus `xdggs` development first towards good vertical scaling before figuring out how they can be scaled horizontally (for reference, see [dask-geopandas](https://github.com/geopandas/dask-geopandas) and [spatialpandas](https://github.com/holoviz/spatialpandas)).
33+
When possible, `xdggs` operations should scale to fine DGGS resolutions (billions of cells). This can be done vertically using backends with vectorized bindings of DGGS implementations written in low-level languages and/or horizontally leveraging Xarray interoperability with Dask. Some operations like spatial indexing may be hard to scale horizontally, though. For the latter, we should probably focus `xdggs` development first towards good vertical scaling before figuring out how they can be scaled horizontally (for reference, see [dask-geopandas](https://github.com/geopandas/dask-geopandas) and [spatialpandas](https://github.com/holoviz/spatialpandas)).
3334

3435
## Non-Gloals
3536

@@ -63,11 +64,15 @@ Figure 3: Raster data converted as DGGS (H3) cells of mixed resolutions ([source
6364

6465
### Standards and Conventions
6566

66-
There is no released standard yet regarding DGGS. However, there is a group working on a draft of OGC API for DGGS: https://github.com/opengeospatial/ogcapi-discrete-global-grid-systems.
67+
The [OGC abstract specification topic 21](http://www.opengis.net/doc/AS/dggs/2.0) defines properties of a DGGS including the reference systems of its grids.
6768

68-
Another draft of DGGS specification can be found here: https://github.com/danlooo/dggs-data-spec.
69+
However, there is no consensus yet about the actual specification on how to work with DGGD data.
70+
[OGC API draft](https://github.com/opengeospatial/ogcapi-discrete-global-grid-systems) defines ways of how to access DGGS data.
71+
The [DGGS data specification draft](https://github.com/danlooo/dggs-data-spec). aims to specify the storage format of DGGS data.
6972

70-
There are some discrepancies between the proposed standards and popular DGGS libraries (H3, S2, HealPIX). For example regarding the term used to define a grid unit: The two specifications above use "zone", S2/H3 use "cell" and HealPIX uses "pixel". Although in this document we use "cell", the term to choose for `xdggs` is still open for discussion.
73+
There are some discrepancies between the proposed standards and popular DGGS libraries (H3, S2, HealPIX). For example regarding the term used to define a grid unit: The two specifications above use "zone", S2/H3 use "cell" and HealPIX uses "pixel".
74+
OGC abstract specification topic 21 defines the region as a zone and its boundary geometry as a cell.
75+
Although in this document we use "cell", the term to choose for `xdggs` is still open for discussion.
7176

7277
### Backends (Python)
7378

@@ -93,7 +98,7 @@ Several Python packages are currently available for handling certain DGGSs. They
9398

9499
## Representation of DGGS Data in Xdggs
95100

96-
`xdggs` represents a DGGS as an Xarray Dataset or DataArray containing a 1-dimensional coordinate with cell ids as labels and with grid name, resolution & parameters (optional) as attributes. This coordinate is indexed using a custom, Xarray-compatible `DGGSIndex`.
101+
`xdggs` represents a DGGS as an Xarray Dataset or DataArray containing a 1-dimensional coordinate with cell ids as labels and with grid name, resolution & parameters (optional) as attributes. This coordinate is indexed using a custom, Xarray-compatible `DGGSIndex`. Multiple dimensions may be used if the coordinate consists of multiple parts, e.g., polyhedron face, x, and y on that face in DGGRID PROJTRI.
97102

98103
`xdggs` does not support a Dataset or DataArray with multiple coordinates indexed with a `DGGSIndex` (only one DGGS per object is supported).
99104

@@ -146,7 +151,7 @@ DGGS data may be created from various sources, e.g.,
146151

147152
- regridded from a latitude/longitude rectilinear grid
148153
- regridded from an unstructured grid
149-
- regridded and reprojected from a raster
154+
- regridded and reprojected from a raster having a local projection
150155
- aggregated from vector point data
151156
- filled from polygon data
152157

@@ -253,9 +258,15 @@ Alternatively, we could just get away with the conversion and cell geometry extr
253258

254259
## Handling hierarchical DGGS
255260

256-
Even though the DGGS coordinate of a Dataset (DataArray) is limited to cell ids of same resolution (no mixed-resolutions), `xdggs` can still provide functionality to deal with the hierarchical aspect of DGGSs.
261+
DGGS are grid systems with grids of the same topology but different spatial resolution.
262+
There is a hierarchical relationship between grids of different resolutions.
263+
Even though the coordinate of one grid in the DGGS of a Dataset (DataArray) is limited to cell ids of same resolution (no mixed-resolutions), `xdggs` can still provide functionality to deal with the hierarchical aspect of DGGSs.
257264

258265
Selection by parent cell ids may be in example (see section above). Another example would be to have utility methods to explicitly change the grid resolution (see [issue #18](https://github.com/benbovy/xdggs/issues/18) for more details and discussion).
266+
One can also store DGGS data at all resolutions as a list of datasets.
267+
268+
However, like in hexagonal grids of aperture 3 or 4 (e.g. DGGRID ISEA4H), the parent child relationship can be also ambiguous.
269+
The actual spatial aggregation functions in the subclasses might be implemented differently depending on the selected DGGS.
259270

260271
## Operations between similar DGGS (alignment)
261272

0 commit comments

Comments
 (0)