Skip to content

Commit

Permalink
Merge branch 's1-extraction-fixes-PR2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinBabe committed Sep 4, 2024
2 parents 0a6e65c + f7016e4 commit 18afacc
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/openeo_gfmap/manager/job_splitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
form of a GeoDataFrames.
"""

from functools import lru_cache
from pathlib import Path
from typing import List

Expand Down Expand Up @@ -72,37 +71,25 @@ def split_job_s2grid(
if polygons.crs is None:
raise ValueError("The GeoDataFrame must contain a CRS")

<<<<<<< HEAD
polygons = polygons.to_crs(epsg=4326)
polygons["geometry"] = polygons.geometry.centroid
=======
epsg = 3857 if web_mercator else 4326

original_crs = polygons.crs

polygons = polygons.to_crs(epsg=epsg)

polygons["centroid"] = polygons.geometry.centroid
>>>>>>> 1110e4aa35cfbe72a9dbd9b56e40048ea40ca2d8

# Dataset containing all the S2 tiles, find the nearest S2 tile for each point
s2_grid = load_s2_grid(web_mercator)
s2_grid["geometry"] = s2_grid.geometry.centroid

<<<<<<< HEAD
# Filter tiles on CDSE availability
s2_grid = s2_grid[s2_grid.cdse_valid]

polygons = gpd.sjoin_nearest(polygons, s2_grid[["tile", "geometry"]]).drop(
columns=["index_right"]
)
=======
polygons = gpd.sjoin_nearest(
polygons.set_geometry("centroid"), s2_grid[["tile", "geometry"]]
).drop(columns=["index_right", "centroid"])

polygons = polygons.set_geometry("geometry").to_crs(original_crs)
>>>>>>> 1110e4aa35cfbe72a9dbd9b56e40048ea40ca2d8

split_datasets = []
for _, sub_gdf in polygons.groupby("tile"):
Expand Down

0 comments on commit 18afacc

Please sign in to comment.