Skip to main content

DGGS Classes for Cells and Cell Collections for parametrisations of rHEALPix grids

This library contains classes for representing DGGS Cells and collections of these ("CellCollection") according to parametrisations of the rHEALPix Discrete Global Grid System. This provides a convenient low level API to work with Cells and CellCollections. An example of a library that utilises these objects for higher level geospatial operations is the rhealpix-sf library which provides a set of Simple Feature relation operations for DGGS Cells.

Validation is provided for Cell and CellCollections. CellCollections have the following operations performed on instantiation:

  • compression (where all children of a parent are present, replace with their parent)
  • deduplication (removal of repeated cells)
  • absorb (where a child and its parent are present, remove the child/children)
  • ordering (alphabetical and numerical based on suids)

These operations provide a consistent representation of collections of Cells, allowing higher level operations to work with a simplified, valid, and consistent set of cells.

Cells and CellCollections have the following attributes or methods:

  • add: Add two sets of Cell or CellCollections, returning a CellCollection
  • subtract: Subtract a Cell or CellCollection from an other, returning a CellCollection
  • equal: Test two Cells or CellCollections for equivalence
  • len: the number of Cells in a Cell (1) or CellCollection (N)
  • area: to be implemented
  • resolution / min and max resolution for CellCollections: the resolution or minimum / maximum resolution for Cells or CellCollections respectively.
  • neighbours: the Cells immediately neighbouring a Cell or CellCollection, optionally including diagonals. For CellCollections, excludes neighbouring cells interior to the CellCollection. Resolution specifiable.
  • border: the set of interior Cells along the edges of a Cell or CellCollection. Resolution specifiable.
  • children: the set of child Cells for a Cell or CellCollection. Resolution specifiable.

Installation

Install from PyPi, for example using pip or poetry.

https://pypi.org/project/rhealpix-geo/

This package has no dependencies.

Use

These functions are implemented in the file rheal/dggs_classes.py

This means they can be used like this (full working script):

from rheal import Cell, CellCollection

a = Cell("R1")
b = Cell("R11")
c = CellCollection("R1 R2")
print(a + b)
# b is within a, so a CellCollection equivalent to a is returned
print(a - b)
# b is within a, so a subset of a is returned
print(a + c)
# c contains a, so a CellCollection equivalent to c is returned 
print(a == b)
# a's border at a resolution two levels higher than a's resolution
print(a.border(a.resolution+2))
# a's children at a resolution one level higher (default) than a's resolution
print(a.children())
# a's neighbours at a's resolution (default) including diagonals (default). Note only 7 neighbours due to the shape of the north hemisphere cell.
print(a.neighbours())

Testing

All tests are in tests/ and implemented using pytest.

There are individual tests for each of the Cell and CellCollection operations.

Contributing

Via GitHub, Issues & Pull Requests:

License

This code is licensed with the BSD 3-clause license as per LICENSE.

Citation

@software{https://github.com/surroundaustralia/rhealpix-geo,
  author = {{David Habgood}},
  title = {Objects for DGGS Cells and collections of Cells},
  version = {0.0.1},
  date = {2021},
  url = {https://github.com/surroundaustralia/rhealpix-geo}
}

Contact

Creator & maintainer:
David Habgood
Application Architect
SURROUND Australia Pty Ltd
david.habgood@surroundaustrlaia.com

https://orcid.org/0000-0002-3322-1868

Release files for rhealpix-geo 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rhealpix-geo 0.3.0
File Size Uploaded
rhealpix-geo-0.3.0.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rhealpix-geo 0.3.0
File Interpreter ABI Platform
rhealpix_geo-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / rhealpix-geo-0.3.0.tar.gz

Download URL rhealpix-geo-0.3.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b11aaa3562e0e37386c432fb5fc9e060cd961e8013f98626d5fe774c3c6ec73e
BLAKE2b-256 checksum
How to use checksums
4ae77cd64c88e98ec88d68176321475e3af758835b7d7e9766fcd742210d1f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.10 CPython/3.8.10 Linux/5.8.0-63-generic

Release files / rhealpix_geo-0.3.0-py3-none-any.whl

Download URL rhealpix_geo-0.3.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bde8d7cdfc27b82f755be81d9cbeca72fe33d8d4c46d3fe472b58adaf0994a30
BLAKE2b-256 checksum
How to use checksums
e45263a7162faead2eb13980f8a8eed08c213916c741b2e5982a100cca411aaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.10 CPython/3.8.10 Linux/5.8.0-63-generic

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page