From 75b36bb47205a97abfbc112f7fbc10e11c3f26fe Mon Sep 17 00:00:00 2001 From: Jona Date: Mon, 30 Oct 2023 11:01:53 -0400 Subject: [PATCH] Should have listened to Christian --- cerulean_cloud/cloud_run_orchestrator/handler.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cerulean_cloud/cloud_run_orchestrator/handler.py b/cerulean_cloud/cloud_run_orchestrator/handler.py index 387f7693..5500a578 100644 --- a/cerulean_cloud/cloud_run_orchestrator/handler.py +++ b/cerulean_cloud/cloud_run_orchestrator/handler.py @@ -477,14 +477,16 @@ async def _orchestrate( async with db_client.session.begin(): LAND_MASK_BUFFER_M = 1000 for feat in merged_inferences.get("features"): - slick_gdf = ( - gpd.GeoDataFrame( - geometry=[shape(feat["geometry"])], crs="EPSG:4326" - ) - .to_crs("EPSG:3857") - .buffer(LAND_MASK_BUFFER_M) + buffered_gdf = gpd.GeoDataFrame( + geometry=[shape(feat["geometry"])], crs="EPSG:4326" ) - if get_landmask_gdf().intersects(slick_gdf).any(): + buffered_gdf["geometry"] = buffered_gdf.to_crs( + "EPSG:3857" + ).buffer(LAND_MASK_BUFFER_M) + intersecting_land = gpd.sjoin( + landmask_gdf, buffered_gdf, how="inner", op="intersects" + ) + if not intersecting_land.empty: feat["properties"]["inf_idx"] = 0 slick = await db_client.add_slick( orchestrator_run,