From 82be448da1bae752e0ef6f53a8b61e5769a560b6 Mon Sep 17 00:00:00 2001 From: christian Date: Mon, 6 Nov 2023 15:36:44 -0500 Subject: [PATCH] Addressing comments from pull request, basic clean-up, added info about UTM reprojections --- cerulean_cloud/cloud_run_orchestrator/handler.py | 6 +++--- cerulean_cloud/cloud_run_orchestrator/merging.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cerulean_cloud/cloud_run_orchestrator/handler.py b/cerulean_cloud/cloud_run_orchestrator/handler.py index c5032614..65de98ec 100644 --- a/cerulean_cloud/cloud_run_orchestrator/handler.py +++ b/cerulean_cloud/cloud_run_orchestrator/handler.py @@ -340,7 +340,7 @@ async def _orchestrate( print(f"Offset 2 offset_group_bounds: {offset_2_group_bounds}") print( - f"Original tiles are {len(base_tiles)}, {len(offset_group_bounds)}, {len(offset_2_group_bounds)}" + f"Original tiles are {len(base_tiles)}, {len(offset_tiles_bounds)}, {len(offset_2_tiles_bounds)}" ) # Filter out land tiles @@ -425,7 +425,7 @@ async def _orchestrate( offset_2_tiles_inference = await perform_inference( offset_2_tiles_bounds, - cloud_run_inference.get_offset_tile_inference, # THIS FUNCTION NEEDS TO BE EDITTED + cloud_run_inference.get_offset_tile_inference, 20, "offset2 tiles", ) @@ -551,7 +551,7 @@ async def _orchestrate( async with db_client.session.begin(): orchestrator_run.success = True orchestrator_run.inference_end_time = end_time - # XXXC >> reduce num variables to a list of featureCollection, ala the merging approach + orchestrator_result = OrchestratorResult( classification_base=out_fc, classification_offset=out_fc_offset, diff --git a/cerulean_cloud/cloud_run_orchestrator/merging.py b/cerulean_cloud/cloud_run_orchestrator/merging.py index 14231e42..86678def 100644 --- a/cerulean_cloud/cloud_run_orchestrator/merging.py +++ b/cerulean_cloud/cloud_run_orchestrator/merging.py @@ -28,7 +28,6 @@ def merge_inferences( Parameters: - feature_collections: A list of FeatureCollecitons to be merged, a primary and any secondary FeatureCollections - - isolated_conf_multiplier: A multiplier for the confidence of isolated features (default is 1 / len(feature_collections)). - proximity_meters: The distance to check for neighboring features and expand the geometries (default is 500m). - closing_meters: The distance to apply the morphological 'closing' operation (default is 0m). - opening_meters: The distance to apply the morphological 'opening' operation (default is 0m). @@ -36,6 +35,9 @@ def merge_inferences( Returns: A merged geojson FeatureCollection. """ + # We reproject to UTM for processing. This assumes that all offset images will either be in the same UTM zone as + # the input image chip, or that the difference that arise from an offset crossing into a second UTM zone will + # have little or no impact on comparison to the origina image. gdfs_for_processing = [ reproject_to_utm( gpd.GeoDataFrame.from_features(fc["features"], crs=4326).assign(fc_index=i)