用于DGGS单元格及其单元格集合的对象。
项目描述
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
- 分辨率/最小和最大分辨率:单元格集合的分辨率或单元格的最小/最大分辨率。
- 邻居:与单元格或单元格集合相邻的单元格,可选地包括对角线。对于单元格集合,排除单元格集合内部的相邻单元格。可指定分辨率。
- 边界:单元格或单元格集合边缘上的内部单元格集合。可指定分辨率。
- 子项:单元格或单元格集合的子单元格集合。可指定分辨率。
安装
从PyPi安装,例如使用pip或poetry。
https://pypi.ac.cn/project/rhealpix-geo/
此包没有依赖项。
使用
这些函数在文件 rheal/dggs_classes.py
中实现
这意味着它们可以像这样使用(完整工作脚本)
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())
测试
所有测试都在 tests/
中,并使用 pytest 实现。
每个单元格和单元格集合操作都有单独的测试。
贡献
通过GitHub,问题 & 拉取请求
许可证
此代码根据 LICENSE 使用BSD 3条款许可。
引用
@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}
}
联系
创建者 & 维护者
David Habgood
应用程序架构师
SURROUND Australia Pty Ltd
david.habgood@surroundaustrlaia.com
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。