# Discrete Global Grid Systems (DGGS) use with Pangeo

**URL:** <https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274>\
**Category:** Data\
**Created:** [February 25, 2022, 11:56am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274 "2022-02-25T11:56:17Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [September 1, 2022, 1:35pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/21 "2022-09-01T13:35:58Z")

</div>

Hey Dan, thanks for the info. Yes, the Global Grids I am referring to have reliably defined resolutions down to meters. But there the challenge is also scale, depending on how large areas you want to represent and that fine resolution. I have checked GeoBoundaries, a great resource. How could I help you, do you have some specific test case we could play through?

---

<div class="post-metadata">

**Author:** ![darothen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/darothen/32/58_2.png) [@darothen](https://discourse.pangeo.io/u/darothen)\
**Post date:** [September 4, 2022, 9:54pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/22 "2022-09-04T21:54:17Z")

</div>

@DanRufola you may want to check out the links to Uber H3 and Google S2 earlier in this thread. Both of these technologies are designed to solve global addressing down to very fine spatial resolutions.

Using either global discretization, you should be able to compute “coverings” of an arbitrary geospatial polygon. [Here](https://s2.sidewalklabs.com/regioncoverer/) is an example app that lets you compute S2 coverings for simply polgyons; it’s not too difficult to work with a library exposing interfaces for S2/H3 to extend this to arbitrary polygons (at least simple ones). You can then uniquely compute a set of cells on each grid that define the cover for a polygon, and then hash that… although to be honest what you’re describing is kind of the purpose of S2/H3 in the first place, so hopefully you can just compute the list of cell IDs that cover a polygon directly and save that.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [September 8, 2022, 7:28am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/23 "2022-09-08T07:28:18Z")

</div>

Hi all, for those interested, there was a webinar organised by the Global Forum for Geography and Statistics on using Discrete Global Grid Systems:

## [Global Grids for Statistical Data](https://statswiki.unece.org/display/GFGS/Coffee+Talk+6)

[Recording (on YouTube)](https://youtu.be/wm82EF8XitY)

1. Kevin Sahr (Southern Oregon University) and Richard Barnes – “Getting Started with DGGRID: Everything you need to know to begin using hexagonal DGGS”

2. Alexander Kmoch (University of Tartu) – “SAGEGRID - Spatial Analysis and Areal Statistics as a Service with Discrete Global Grid Systems”

---

<div class="post-metadata">

**Author:** ![darothen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/darothen/32/58_2.png) [@darothen](https://discourse.pangeo.io/u/darothen)\
**Post date:** [September 9, 2022, 3:17pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/24 "2022-09-09T15:17:54Z")

</div>

Thank you for sharing @allixender! Looks like a great talk, added to my queue for later today.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [December 5, 2022, 11:52am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/25 "2022-12-05T11:52:57Z")

</div>

Hi all, picking up the slack here a bit. We had a great discussion on the Pangeo Europe weekly coffee chat and discussed how to compare/integrate use cases of unstructured grids and DGGS grids, @annefou @tinaok . We would like to build/demonstrate a few simple and more complex workflows from some typical unstructured grids analysis steps trying to replicate those with DGGS and everything that we might stumble upon, e.g. regridding, summaries etc.

Please let’s collate some tangible examples here, which I could then try to build out on GitHub and Binder.

In addition, I would really appreciate some help from folks who have experience in building and distributing binary conda packages that require C/C++ compilation targets @benbovy @ocefpaf : I have a cmake C++ project [DGGRID](https://github.com/sahrk/DGGRID) that requires GDAL installed as well. and creates a single executable binary. I have read lots of the conda packaging docs but I struggle. Who can help set-up a feedstock with me?

UPDATE1: I have made a [reproducible docker build](https://github.com/allixender/DGGRID/tree/master/dockerfiles) for DGGRID, with and without a Python base. The Python base is for subsequent testing with available open source DGGS such as H3, rHEALPix and the DGGRID Python wrapper dggrid4py.

---

<div class="post-metadata">

**Author:** ![benbovy](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/benbovy/32/592_2.png) [@benbovy](https://discourse.pangeo.io/u/benbovy)\
**Post date:** [December 6, 2022, 8:41am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/26 "2022-12-06T08:41:54Z")

</div>

Hi @allixender, I had a quick look at the DGGRID source. One issue is that at least three of its dependencies are vendored: proj4, clipper and shapelib. I’ll let @ocefpaf confirm, but I think this is not allowed (or at least not recommended) [Guidelines — conda-forge 2022.12.06 documentation](https://conda-forge.org/docs/orga/guidelines.html#generalities).

- for proj4 it seems that only a small part of it has been copied and adapted, so maybe it is OK to use the vendored code (with the license file included)?
- for clipper it’s probably OK too (see [pyclipper-feedstock](https://github.com/conda-forge/pyclipper-feedstock))
- for shapelib there are already packages available on conda-forge, so I guess it should be enough to patch the CMakeLists.txt file (or even better submit it to DGGRID) in order to get the dependency externally.

For setting up the feedstock, you can have a look at this one: [GitHub - conda-forge/richdem-feedstock: A conda-smithy repository for richdem.](https://github.com/conda-forge/richdem-feedstock), which also depends on GDAL. It is a little bit more complex than for DGGRID (you don’t need all the python-related dependencies) but the `build.sh` and `bld.bat` should look pretty similar.

---

<div class="post-metadata">

**Author:** ![strobpr](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/strobpr/32/326_2.png) [@strobpr](https://discourse.pangeo.io/u/strobpr)\
**Post date:** [December 6, 2022, 9:47am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/27 "2022-12-06T09:47:47Z")

</div>

Thanks for the initiative @allixender! I would be very interested in a robust framework for comparing and benchmarking global grids of all sorts. First thing I would like to clarify is what you mean by ‘unstructured grid’ and generally which definition for ‘grid’ you propose to use.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [December 6, 2022, 9:54am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/28 "2022-12-06T09:54:35Z")

</div>

We were thinking of doing that a bit more systematically. Unstructured grids I’d refer here to the previously mentioned ones 🙂 We now just need a place to build this out, happy to do this in public. Even better if we can get funding.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [December 6, 2022, 10:15am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/29 "2022-12-06T10:15:54Z")

</div>

Thanks a lot for the guidance. So I’ll try to get this working for DGGRID.

Do I need to have a special conda environment with the build tools, smithy etc?

How do I get this eventually into the conda-forge ecosystem? Is it similar to publishing to PyPI or are there other mechanisms.

---

<div class="post-metadata">

**Author:** ![benbovy](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/benbovy/32/592_2.png) [@benbovy](https://discourse.pangeo.io/u/benbovy)\
**Post date:** [December 6, 2022, 10:31am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/30 "2022-12-06T10:31:38Z")

</div>

All you need is forking [GitHub - conda-forge/staged-recipes: A place to submit conda recipes before they become fully fledged conda-forge feedstocks](https://github.com/conda-forge/staged-recipes) and submit a PR with a new folder in the `recipes` directory with at least `meta.yaml` and `build.sh` (and `bld.bat` if you want Windows packages). Once all CI passes and the PR is merged, a new feedstock repository will be created automatically for you.

There’s a `build-locally.py` helper script in the repository that is useful in case you don’t want to iterate too much with CI build jobs. It only needs Python (and maybe Docker).

[https://conda-forge.org/docs/maintainer/adding\_pkgs.html#staging-test-locally](https://conda-forge.org/docs/maintainer/adding_pkgs.html#staging-test-locally)

---

<div class="post-metadata">

**Author:** ![ocefpaf](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/ocefpaf/32/24_2.png) [@ocefpaf](https://discourse.pangeo.io/u/ocefpaf)\
**Post date:** [December 12, 2022, 7:39pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/31 "2022-12-12T19:39:58Z")

</div>

Sorry I missed the ping here. Still not sure how discourse works.  
@benbovy is correct but it is not that it isn’t allowed but more like “not recommended.” Vendoring can happen if the package is careful enough to isolate the vendored parts and avoid breaking other packages that rely on the same dependencies.

It is usually easier to un-vendor and add them as dependencies.

---

<div class="post-metadata">

**Author:** ![maawoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/maawoo/32/1972_2.png) [@maawoo](https://discourse.pangeo.io/u/maawoo)\
**Post date:** [December 14, 2022, 2:55pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/32 "2022-12-14T14:55:44Z")

</div>

Hi all,  
I recently came across this project: [STARE SpatioTemporal Adaptive Resolution Encoding · GitHub](https://github.com/SpatioTemporal)  
I’m not affiliated and have only basic knowledge of DGGS, but it seems to be very relevant to this discussion. Here are two publications: [1](https://doi.org/10.1007/s12145-021-00568-8), [2](https://doi.org/10.1145/3397536.3422346). The second one also specifically mentions Pangeo.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [March 8, 2023, 8:55am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/33 "2023-03-08T08:55:30Z")

</div>

Thanks for the update on STARE. I actually met on the EGU conference last year myself 👍

By the way, I see great potential, e.g. to experiment with [Xvec](https://github.com/xarray-contrib/xvec/) and Xoak in the space of DGGS. Unfortunately, we still haven’t moved much. We are currently, trying to bring [DGGRID onto conda-forge](https://github.com/conda-forge/staged-recipes/pull/21947).

We are trying to get a demo project off the ground with Tina and some Ocean data.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [April 21, 2023, 7:04am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/34 "2023-04-21T07:04:30Z")

</div>

Hi, I hope the DGGRID package will be soon available in conda-forge. I have been working on the packaging in the last weeks, but mostly waiting on the package admins feedback. [Pull request](https://github.com/conda-forge/staged-recipes/pull/21947).

Also, DGGS paper that uses DGGRID and a multi-resolution hexagonal ISEA3H grids for [Extraction of ocean tidal information based on global equal-area grid and satellite altimeter data](https://www.tandfonline.com/doi/full/10.1080/17538947.2022.2158240)

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [May 28, 2023, 12:55pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/35 "2023-05-28T12:55:49Z")

</div>

Hi, for everyone interested, I finally got DGGRID building through conda-forge. It seems I even managed to get the Windows build right.

[DGGRID Feedstock](https://anaconda.org/conda-forge/dggrid)

This is the latest release from Kevin Sahr’s DDGRID tool. I am now working with him trying to design some Python bindings, which should become as easily installable through conda. In the meantime, [dggrid4py](https://github.com/allixender/dggrid4py) and [DGGRID](https://anaconda.org/conda-forge/dggrid) should now be nicely useable together in a conda environment.

We also made a dockerized version for a commandline use: [Package dggrid · GitHub](https://github.com/sahrk/DGGRID/pkgs/container/dggrid)

As a side note, the package is also being developed with in Julia:

- [GitHub - danlooo/dggrid-julia: Julia bindings for the DGGRID library](https://github.com/danlooo/dggrid-julia)

---

<div class="post-metadata">

**Author:** ![changliao](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/changliao/32/2303_2.png) [@changliao](https://discourse.pangeo.io/u/changliao)\
**Post date:** [June 20, 2023, 4:35pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/36 "2023-06-20T16:35:32Z")

</div>

@allixender This is a nice discussion! I work in the computational hydrology/land surface domain, and we developed a mesh-independent framework (HexWatershed: [GitHub - changliao1025/pyhexwatershed: The Python interface to HexWatershed a mesh independent flow direction model for hydrologic models](https://github.com/changliao1025/pyhexwatershed)) for some hydrology-related studies. We currently support MPAS mesh as the unstructured mesh, but DGGRID support is on the way. The indexing system is definitely a key factor as we need to run some simulations on a global scale. AABB tree and cython are targeted for performance improvement.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [June 25, 2023, 11:37am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/37 "2023-06-25T11:37:37Z")

</div>

Hi @changliao thanks for the comment. You might want to check out the new Z3 index for ISEA3H hexagonal grids in DGGRID 👍 It is super new and Kevin Sahr has already added some examples in the GitHub repository. Hoping to also get an H3 equivalent ISEA7H based index into DGGRID in the course of this year maybe. Exciting opportunities.

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [July 3, 2023, 8:16am UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/38 "2023-07-03T08:16:36Z")

</div>

Hi, some updates: DGGRID is on conda-forge and the lead developer is restructuring the internal API. It should become easier now to develop bindings to other languages such as Python and Julia. We would then want to explore various interop/indexing/analysis schemes with xarray, such as xoak and xvec, and then also moving between unstructured grids and dggs grids. There will be a code sprint in November at the Vienna BIDS 2023 conference. Would be great to have some Pangeo core devs there 🙂

[https://www.bigdatafromspace2023.org/paper-poster-submission](https://www.bigdatafromspace2023.org/paper-poster-submission)

---

<div class="post-metadata">

**Author:** ![allixender](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/allixender/32/1501_2.png) [@allixender](https://discourse.pangeo.io/u/allixender)\
**Post date:** [September 4, 2023, 2:30pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/39 "2023-09-04T14:30:06Z")

</div>

Apologies for cross-posting:

[Pangeo topics at BiDS code sprint](https://github.com/pangeo-data/bids2023_codesprint)

[OSGEO BiDS Code Sprint General Event Wiki page](https://wiki.osgeo.org/wiki/OSGeo_Community_Sprint_2023#Project_Plans)

@martinfleis Could there by European NumFocus support set up for Pangeo folks and to support the BiDS event?

@acocac Already more details on the parallel Turing Institute event?

---

<div class="post-metadata">

**Author:** ![martinfleis](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/martinfleis/32/1945_2.png) [@martinfleis](https://discourse.pangeo.io/u/martinfleis)\
**Post date:** [September 4, 2023, 2:43pm UTC](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274/40 "2023-09-04T14:43:16Z")

</div>

> Could there by European NumFocus support set up for Pangeo folks and to support the BiDS event?

@allixender I have no clue, you’ll have to speak to NumFOCUS, probably via Arliss Collins ([arliss@numfocus.org](mailto:arliss@numfocus.org)).

[Previous page](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274.md?page=1)

[Next page](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274.md?page=3)
