Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVerhaert committed Dec 24, 2024
1 parent 3753fb1 commit 23248c2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- `split_job_s2sphere` function to split jobs into S2cells of the s2sphere package. More info: http://s2geometry.io/. This job splitter recursively splits cells until the number of points in each cell is less than a given threshold.

### Changed
- `ouput_path_generator` in `GFMapJobManager.on_job_done` now requires `asset_id` as a keyword argument
### Removed
Expand Down
1 change: 1 addition & 0 deletions src/openeo_gfmap/manager/job_splitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def split_job_s2sphere(
:param start_level: Starting S2 cell level
:return: List of GeoDataFrames containing the split groups
"""

if "geometry" not in gdf.columns:
raise ValueError("The GeoDataFrame must contain a 'geometry' column.")

Expand Down
15 changes: 12 additions & 3 deletions tests/tests_unit/manager/test_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import geopandas as gpd
from shapely.geometry import Point, Polygon

from openeo_gfmap.manager.job_splitters import split_job_hex, split_job_s2grid, split_job_s2sphere
from openeo_gfmap.manager.job_splitters import (
split_job_hex,
split_job_s2grid,
split_job_s2sphere,
)


def test_split_job_s2grid():
Expand Down Expand Up @@ -92,6 +96,7 @@ def test_split_job_hex():
len(result[0]) == 3
), "The number of geometries in the first split should be 3."


def test_split_job_s2sphere():
# Create a mock GeoDataFrame with points
# The points are located in two different S2 tiles
Expand Down Expand Up @@ -135,5 +140,9 @@ def test_split_job_s2sphere():
assert gdf.crs == 4326, "The original CRS should be preserved."
for _, geom in gdf.iterrows():
geom_type = geom.geometry.geom_type
original_type = polygons[polygons.id == geom.id].geometry.geom_type.values[0]
assert geom_type == original_type, "Original geometries should be preserved."
original_type = polygons[polygons.id == geom.id].geometry.geom_type.values[
0
]
assert (
geom_type == original_type
), "Original geometries should be preserved."

0 comments on commit 23248c2

Please sign in to comment.