Skip to content

Commit 54877e7

Browse files
keewispre-commit-ci[bot]dcherian
authored
Add xdggs (#8)
* move xdggs to earth sciences * setup * describe the xdggs index * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * point to the new location in `index.md` * show the H3 grid * visualize the result * mention healpix and h3 as examples for DGGS * reference the logo correctly * actually add the grid image * avoid using a slider, which would break for rendered notebooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
1 parent 0b99bbc commit 54877e7

File tree

5 files changed

+71
-2
lines changed

5 files changed

+71
-2
lines changed

docs/agnostic/xdggs.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"rasterix": ("https://rasterix.readthedocs.io/en/latest/", None),
114114
"shapely": ("https://shapely.readthedocs.io/en/latest/", None),
115115
"xvec": ("https://xvec.readthedocs.io/en/stable/", None),
116+
"xdggs": ("https://xdggs.readthedocs.io/en/latest/", None),
116117
"geopandas": ("https://geopandas.readthedocs.io/en/stable/", None),
117118
"pint-xarray": ("https://pint-xarray.readthedocs.io/en/latest/", None),
118119
"pint": ("https://pint.readthedocs.io/en/stable/", None),

docs/earth/h3.png

287 KB
Loading

docs/earth/xdggs.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
jupytext:
3+
text_representation:
4+
format_name: myst
5+
kernelspec:
6+
display_name: Python 3
7+
name: python
8+
---
9+
10+
# xdggs: DGGSIndex
11+
12+
````{grid}
13+
```{grid-item}
14+
:columns: 3
15+
```{image} https://xdggs.readthedocs.io/en/latest/_static/xdggs_logo.png
16+
---
17+
alt: xdggs logo
18+
width: 200px
19+
align: center
20+
---
21+
```
22+
```{grid-item}
23+
:columns: 9
24+
```{seealso}
25+
Learn more at the [xdggs](https://xdggs.readthedocs.io/en/latest/) documentation page.
26+
```
27+
````
28+
29+
## Highlights
30+
31+
xdggs provides a unified API for interacting with various Discrete Global Grid Systems (DGGS), like [HEALPix](https://healpix.sourceforge.io/html/intro.htm) or [H3](https://h3geo.org). It does so by parsing out grid metadata from the spatial coordinate containing the cell ids and persisting it on a "meta-index", an index that wraps another index (most commonly a `pandas` index).
32+
33+
```{figure} h3.png
34+
The H3 grid, a hexagonal DGGS designed for navigation on land.
35+
```
36+
37+
## Example
38+
39+
Here's a dataset on a HEALPix grid:
40+
41+
```{code-cell} python
42+
import xdggs
43+
44+
ds = xdggs.tutorial.open_dataset("air_temperature", "healpix")
45+
ds
46+
```
47+
48+
with that, we can decode the metadata:
49+
50+
```{code-cell} python
51+
decoded = ds.dggs.decode()
52+
decoded
53+
```
54+
55+
Note how the `cell_ids` coordinate is now associated with a `HealpixIndex`? This makes it harder to lose the parsed information, and thus having to parse it again.
56+
57+
We can also have a look at the parsed metadata:
58+
59+
```{code-cell} python
60+
decoded.dggs.grid_info
61+
```
62+
63+
Here's how the dataset looks:
64+
65+
```{code-cell} python
66+
decoded["air"].isel(time=0).dggs.explore(alpha=0.8)
67+
```
68+
69+
In a future version of `xdggs` this may also support more operations, like alignment, selection using parent cell ids, or lazy coordinates for cell centers / cell boundaries.

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ blocks/ndpoint
2727
caption: Domain Agnostic
2828
hidden:
2929
---
30-
agnostic/xdggs
3130
agnostic/pint
3231
```
3332

@@ -39,6 +38,7 @@ hidden:
3938
earth/xproj
4039
earth/raster
4140
earth/xvec
41+
earth/xdggs
4242
earth/forecast
4343
earth/cfvertical
4444
```

0 commit comments

Comments
 (0)