Skip to main content

Objects for DGGS Cells and collections of Cells.

Project description

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

Coming to PyPI.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rhealpix-geo-0.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

rhealpix_geo-0.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file rhealpix-geo-0.2.tar.gz.

File metadata

  • Download URL: rhealpix-geo-0.2.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for rhealpix-geo-0.2.tar.gz
Algorithm Hash digest
SHA256 fd14c1595fb31d934754e9cb597aa45703e1a39843f2e7128e19f88f7af03bc3
MD5 881e6e37e9c9d92652f2bdaf7c58c426
BLAKE2b-256 f002a8caab00ab56943f9086f25a796c50eda11978c07ecf8ba4ee51d82383d8

See more details on using hashes here.

Provenance

File details

Details for the file rhealpix_geo-0.2-py3-none-any.whl.

File metadata

  • Download URL: rhealpix_geo-0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for rhealpix_geo-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 abfb95604f5a233d3d2cf970366c535f2d6bf631eb6c068464f904b1c06ad20d
MD5 3a3d79e74730e916cb438f2bda22daaf
BLAKE2b-256 d9cb25fb881db9932fc6b575b93321e9a8908f43453d4838ce805f44cfbaf197

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page