Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cell hierarchy operations #38

Open
1 task
keewis opened this issue Dec 12, 2023 · 2 comments
Open
1 task

cell hierarchy operations #38

keewis opened this issue Dec 12, 2023 · 2 comments

Comments

@keewis
Copy link
Collaborator

keewis commented Dec 12, 2023

We've mostly been working with hierarchical DGGS, so it might be good to have functions that allow working with that hierarchy. Those would be (I can only think of a single one right now, but I'm sure there's more):

  • computing the parent cell at a given cell ids and a target resolution
@strobpr
Copy link

strobpr commented Mar 19, 2024

All DGGSs are hierarchical, below is a list of query functions a DGGS API has to provide (from ISO 19170/OGC AS Topic 21):

8.3.3.2. Summary of operations in ZoneQuery

The following operations have the same topological meaning as their equivalent operations in ISO 19107:2019 Geometry::Query2D and Geometry::Query3D: distance, contains, crosses, disjoint, equals, intersects, overlaps, touches, within, withinDistance, difference, intersection, symDifference, union, and relate.

  • relativePosition: A.relativePosition(B, projectTo), returns the relativePosition enumerator that describes B‘s relative position to A with respect to the direction defined by projectTo.
    
  • relatePosition: A.relatePosition(B, relation, projectTo) returns whether B has the relative position to A given by relation with respect to the direction projectTo
    
  • parentOf: A.parentOf(B, inheritID, projectTo), returns whether A is a parent cell of B, optionally filtered by inheritID and projectTo.
    
  • childOf: A.childOf(B, inheritID, projectTo), returns whether A is a child cell of B, optionally filtered by inheritID and projectTo.
    
  • siblingOf: A.siblingOf(B, inheritID, projectTo), returns whether A is a sibling cell of B, optionally filtered by inheritID and projectTo.
    
  • parent: A.parent(inheritID, projectTo, levels), returns the unique «set» of zoneIdentifiers for zones that satisfy A.parentOf(B, inheritID, projectTo) applied recursively levels times up the parent hierarchy. The «set» will have at most one member from each level of the hierarchy if inheritID is True, and may have more than one if the cell refinementStrategy is not nested.
    
  • child: A.child(inheritID, projectTo, levels), returns the unique «set» of zoneIdentifiers for zones that satisfy A.parentOf(B, inheritID, projectTo) applied recursively levels times down the parent hierarchy.
    
  • sibling: A.sibling(inheritID, projectTo, levels), returns the unique «set» of zoneIdentifiers for zones that satisfy A.parentOf(B, inheritID, projectTo) applied recursively levels times outward on zones at the same refinement level. Multiple levels of sibling can also be thought of as the children of its parent(s) the specified number of levels up the hierarchy.
    

image

Figure 15 — Examples of parent, child, and sibling query operations

EXAMPLES

Parent, sibling and child queries for zone 40:
40.parent() returns {4}
40.sibling(inheritID=true) returns {40, 41, 42, 43}
40.sibling() returns {13, 22, 23, 31, 40, 41, 42, 43}
40.child(inheritID=true) returns {400, 401, 402, 403}

Parent, sibling and child tests for zone 40:
40.parentOf(400) returns true
40.siblingOf(41) returns true
40.siblingOf(31, inheritID=true) returns false
40.siblingOf(41) returns true
40.childOf(4) returns true

Parent and child tests for zones 31 and 33 with multiple parents:
31.childOf(4, inheritID=true) returns false
31.childOf(4) returns true
31.parent(inheritID=true) returns {3}
31.parent() returns {3, 4}
33.parent() returns {3, 4, 5, 6}

Parent and child queries with levels set to a value greater than 1:
400.parent(inheritID=true, level=2) returns {40, 4}
4.child(inheritID=true, 2) returns {40, 41, 42, 43, 400, 401, 402, 403, 410, 411, 412, 413, 420, 421, 422, 423, 430, 431, 432, 433}
400.sibling(inheritID=true, levels=2) returns {400, 401, 402, 403, 410, 411, 412, 413, 420, 421, 422, 423, 430, 431, 432, 433}
While some of these results extend to zones that are not drawn in the figure, the location indicated by their zonal identifier should be readily apparent from the pattern.

NOTE In all examples the optional parameters inheritID and levels take their default values of false and 1 respectively, unless they are specified. Since these are two-dimensional examples without any depth or time, projectTo has no influence.

Further query and analysis functions may then be applied to the returned data through additional software bindings. This abstract specification does not specify any requirements for the binding or implementation of further, extension, query or analytic functions.

Figure 16 — Components of Topological Zonal Query Functions module

@benbovy
Copy link
Member

benbovy commented May 22, 2024

See also #18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants