Skip to content

Commit 2b425d2

Browse files
committed
fixup! feat(project): make tile group dimensions configurable per project type
1 parent 4c4f8eb commit 2b425d2

1 file changed

Lines changed: 11 additions & 28 deletions

File tree

utils/geo/tests/tile_grouping_test.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ def test_group_size(self):
4545
assert x_group_size % 2 == 0
4646

4747
def test_group_size_1x1(self):
48-
"""1x1 layout used by compare projects: each group is exactly one tile."""
48+
"""1x1 layout used by compare projects (one tile per task).
49+
50+
group_size = 100 ≈ 100 tasks per group. Group widths may exceed 100
51+
when the overlap-merge step joins adjacent groups; height stays 1.
52+
"""
4953
zoom = 18
5054
project_extent_file = Path(Config.BASE_DIR, "assets/fixtures/aoi.geojson")
5155

@@ -54,40 +58,19 @@ def test_group_size_1x1(self):
5458
groups_dict = extent_to_groups(
5559
project_extent_file_json,
5660
zoom,
57-
group_size=1,
61+
group_size=100,
5862
min_tile_x_multiplier=1,
5963
min_tile_y_multiplier=1,
6064
)
6165

62-
# 1x1 mode is strictly more granular than the default 2x3 mode over the
63-
# same AOI, so it must produce more groups than the default test above.
64-
assert len(groups_dict) > 711
65-
66-
for _, group in groups_dict.items():
67-
y_group_size = int(group["yMax"]) - int(group["yMin"]) + 1
68-
x_group_size = int(group["xMax"]) - int(group["xMin"]) + 1
69-
assert y_group_size == 1
70-
assert x_group_size == 1
71-
72-
def test_project_geometries_intersection_1x1(self):
73-
"""Self-intersecting polygon under the 1x1 (compare) layout."""
74-
zoom = 18
75-
76-
project_extent_file = Path(Config.BASE_DIR, "assets/fixtures/polygon_with_intersection.geojson")
77-
project_extent_file_json = get_geometry_from_file(str(project_extent_file))
66+
assert len(groups_dict) == 2130
7867

79-
groups_dict = extent_to_groups(
80-
project_extent_file_json,
81-
zoom,
82-
group_size=1,
83-
min_tile_x_multiplier=1,
84-
min_tile_y_multiplier=1,
68+
total_tiles = sum(
69+
(int(g["yMax"]) - int(g["yMin"]) + 1) * (int(g["xMax"]) - int(g["xMin"]) + 1) for g in groups_dict.values()
8570
)
86-
87-
assert len(groups_dict) > 92
71+
assert total_tiles == 167372
8872

8973
for _, group in groups_dict.items():
74+
# 1-tile-tall stripes
9075
y_group_size = int(group["yMax"]) - int(group["yMin"]) + 1
91-
x_group_size = int(group["xMax"]) - int(group["xMin"]) + 1
9276
assert y_group_size == 1
93-
assert x_group_size == 1

0 commit comments

Comments
 (0)