Skip to content

Commit

Permalink
Add note indicating that there is no guaranteed ordering of cells for…
Browse files Browse the repository at this point in the history
… many functions
  • Loading branch information
ajfriend committed Mar 9, 2024
1 parent eea303c commit e329dab
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions src/h3/api/basic_int/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def cell_to_boundary(h):

def grid_disk(h, k=1):
"""
Return unordered set of cells with H3 distance ``<= k`` from ``h``.
Return unordered collection of cells with H3 distance ``<= k`` from ``h``.
That is, the 'filled-in' disk.
Parameters
Expand All @@ -269,6 +269,10 @@ def grid_disk(h, k=1):
Returns
-------
unordered collection of H3Cell
Notes
-----
There is currently no guaranteed order of the output cells.
"""
mv = _cy.grid_disk(_in_scalar(h), k)

Expand All @@ -277,7 +281,7 @@ def grid_disk(h, k=1):

def grid_ring(h, k=1):
"""
Return unordered set of cells with H3 distance ``== k`` from ``h``.
Return unordered collection of cells with H3 distance ``== k`` from ``h``.
That is, the "hollow" ring.
Parameters
Expand All @@ -289,6 +293,10 @@ def grid_ring(h, k=1):
Returns
-------
unordered collection of H3Cell
Notes
-----
There is currently no guaranteed order of the output cells.
"""
mv = _cy.grid_ring(_in_scalar(h), k)

Expand All @@ -297,7 +305,7 @@ def grid_ring(h, k=1):

def cell_to_children(h, res=None):
"""
Children of a cell.
Children of a cell as an unordered collection.
Parameters
----------
Expand All @@ -309,6 +317,10 @@ def cell_to_children(h, res=None):
Returns
-------
unordered collection of H3Cell
Notes
-----
There is currently no guaranteed order of the output cells.
"""
mv = _cy.cell_to_children(_in_scalar(h), res)

Expand All @@ -329,6 +341,10 @@ def compact_cells(cells):
Returns
-------
unordered collection of H3Cell
Notes
-----
There is currently no guaranteed order of the output cells.
"""
# todo: does compact_cells work on mixed-resolution collections?
hu = _in_collection(cells)
Expand Down Expand Up @@ -358,6 +374,10 @@ def uncompact_cells(cells, res):
todo: add test to make sure an error is returned when input
contains cell smaller than output res.
https://github.com/uber/h3/blob/master/src/h3lib/lib/h3Index.c#L425
Notes
-----
There is currently no guaranteed order of the output cells.
"""
hc = _in_collection(cells)
hu = _cy.uncompact_cells(hc, res)
Expand Down Expand Up @@ -395,6 +415,10 @@ def h3shape_to_cells(h3shape, res):
'862830947ffffff',
'862830957ffffff',
'86283095fffffff'}
Notes
-----
There is currently no guaranteed order of the output cells.
"""

# todo: not sure if i want this dispatch logic here. maybe in the objects?
Expand Down Expand Up @@ -456,6 +480,10 @@ def geo_to_cells(geo, res):
Both H3Poly and H3MultiPoly implement the interface.
res : int
Resolution of desired output cells.
Notes
-----
There is currently no guaranteed order of the output cells.
"""
h3shape = geo_to_h3shape(geo)
return h3shape_to_cells(h3shape, res)
Expand Down Expand Up @@ -728,6 +756,10 @@ def get_res0_cells():
Returns
-------
unordered collection of H3Cell
Notes
-----
There is currently no guaranteed order of the output cells.
"""
mv = _cy.get_res0_cells()

Expand Down

0 comments on commit e329dab

Please sign in to comment.