Skip to content

Commit 4e909a7

Browse files
adds tuple type check when compacting
1 parent 9d29e11 commit 4e909a7

File tree

7 files changed

+15
-5
lines changed

7 files changed

+15
-5
lines changed

raster2dggs/h3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"--parent_res",
2828
required=False,
2929
type=click.Choice(list(map(str, range(const.MIN_H3, const.MAX_H3 + 1)))),
30-
help="H3 Parent resolution to index and aggregate to. Defaults to resolution - 6",
30+
help="H3 parent resolution to index and aggregate to. Defaults to resolution - 6",
3131
)
3232
@click.option(
3333
"-u",

raster2dggs/indexers/geohashrasterindexer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def compaction(
132132
list(parent_cells)
133133
)
134134
for parent, group in parent_groups:
135+
if isinstance(parent, tuple) and len(parent) == 1:
136+
parent = parent[0]
135137
if parent in compaction_map:
136138
continue
137139
expected_count = self.cell_to_children_size(parent, precision)

raster2dggs/indexers/h3rasterindexer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def parent_groupby(
6868
self, df, resolution: int, aggfunc: Union[str, Callable], decimals: int
6969
) -> pd.DataFrame:
7070
"""
71-
Function for aggregating the h3 resolution values per parent partition. Each partition will be run through with a
72-
pandas .groupby function. This step is to ensure there are no duplicate h3 values, which will happen when indexing a
73-
high resolution raster at a coarser h3 resolution.
71+
Function for aggregating the H3 resolution values per parent partition. Each partition will be run through with a
72+
pandas .groupby function. This step is to ensure there are no duplicate H3 values, which will happen when indexing a
73+
high resolution raster at a coarser H3 resolution.
7474
7575
Implementation of interface function.
7676
"""
@@ -126,6 +126,8 @@ def compaction(
126126
list(parent_cells)
127127
)
128128
for parent, group in parent_groups:
129+
if isinstance(parent, tuple) and len(parent) == 1:
130+
parent = parent[0]
129131
if parent in compaction_map:
130132
continue
131133
expected_count = self.cell_to_children_size(parent, resolution)

raster2dggs/indexers/maidenheadrasterindexer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ def compaction(
135135
list(parent_cells)
136136
)
137137
for parent, group in parent_groups:
138+
if isinstance(parent, tuple) and len(parent) == 1:
139+
parent = parent[0]
138140
if parent in compaction_map:
139141
continue
140142
expected_count = self.cell_to_children_size(parent, level)

raster2dggs/indexers/rhprasterindexer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def compaction(
123123
list(parent_cells)
124124
)
125125
for parent, group in parent_groups:
126+
if isinstance(parent, tuple) and len(parent) == 1:
127+
parent = parent[0]
126128
if parent in compaction_map:
127129
continue
128130
expected_count = self.cell_to_children_size(parent, resolution)

raster2dggs/indexers/s2rasterindexer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def compaction(
146146
list(parent_cells)
147147
)
148148
for parent, group in parent_groups:
149+
if isinstance(parent, tuple) and len(parent) == 1:
150+
parent = parent[0]
149151
if parent in compaction_map:
150152
continue
151153
expected_count = self.cell_to_children_size(

raster2dggs/rHP.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"--parent_res",
3030
required=False,
3131
type=click.Choice(list(map(str, range(const.MIN_RHP, const.MAX_RHP + 1)))),
32-
help="rHEALPix Parent resolution to index and aggregate to. Defaults to resolution - 6",
32+
help="rHEALPix parent resolution to index and aggregate to. Defaults to resolution - 6",
3333
)
3434
@click.option(
3535
"-u",

0 commit comments

Comments
 (0)