From bf3f594e1a0a2791ab670d6e505edd5263ea5311 Mon Sep 17 00:00:00 2001 From: Jona Date: Fri, 20 Oct 2023 15:56:32 -0400 Subject: [PATCH] Remove dynamic rescaling, and fix to (0,255) --- cerulean_cloud/cloud_run_orchestrator/clients.py | 4 ++-- cerulean_cloud/cloud_run_orchestrator/handler.py | 6 +++--- cerulean_cloud/titiler_client.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cerulean_cloud/cloud_run_orchestrator/clients.py b/cerulean_cloud/cloud_run_orchestrator/clients.py index edfbdb2f..3737f895 100644 --- a/cerulean_cloud/cloud_run_orchestrator/clients.py +++ b/cerulean_cloud/cloud_run_orchestrator/clients.py @@ -70,7 +70,7 @@ def __init__( self.inference_parms = inference_parms async def get_base_tile_inference( - self, tile: morecantile.Tile, semaphore: asyncio.Semaphore, rescale=(0, 100) + self, tile: morecantile.Tile, semaphore: asyncio.Semaphore, rescale=(0, 255) ) -> InferenceResultStack: """fetch inference for base tiles""" async with semaphore: @@ -99,7 +99,7 @@ async def get_base_tile_inference( return InferenceResultStack(**res.json()) async def get_offset_tile_inference( - self, bounds: List[float], semaphore: asyncio.Semaphore, rescale=(0, 100) + self, bounds: List[float], semaphore: asyncio.Semaphore, rescale=(0, 255) ) -> InferenceResultStack: """fetch inference for offset tiles""" async with semaphore: diff --git a/cerulean_cloud/cloud_run_orchestrator/handler.py b/cerulean_cloud/cloud_run_orchestrator/handler.py index 6f1d36c7..a618c9d0 100644 --- a/cerulean_cloud/cloud_run_orchestrator/handler.py +++ b/cerulean_cloud/cloud_run_orchestrator/handler.py @@ -295,7 +295,7 @@ async def _orchestrate( scene_info, titiler_client.get_base_tile_url( payload.sceneid, - rescale=(scene_stats["min"], scene_stats["max"]), + rescale=(0, 255), ), ) orchestrator_run = await db_client.add_orchestrator( @@ -343,7 +343,7 @@ async def _orchestrate( *[ cloud_run_inference.get_base_tile_inference( tile=base_tile, - rescale=(scene_stats["min"], scene_stats["max"]), + rescale=(0, 255), semaphore=base_tile_semaphore, ) for base_tile in base_tiles @@ -357,7 +357,7 @@ async def _orchestrate( *[ cloud_run_inference.get_offset_tile_inference( bounds=offset_tile_bounds, - rescale=(scene_stats["min"], scene_stats["max"]), + rescale=(0, 255), semaphore=offset_tile_semaphore, ) for offset_tile_bounds in offset_tiles_bounds diff --git a/cerulean_cloud/titiler_client.py b/cerulean_cloud/titiler_client.py index c3baddd0..33d8a1da 100644 --- a/cerulean_cloud/titiler_client.py +++ b/cerulean_cloud/titiler_client.py @@ -66,7 +66,7 @@ def get_base_tile_url( band: str = "vv", img_format: Optional[str] = None, scale: int = 1, - rescale: Tuple[int, int] = (0, 1000), + rescale: Tuple[int, int] = (0, 255), z="{z}", x="{x}", y="{y}", @@ -103,7 +103,7 @@ async def get_base_tile( band: str = "vv", img_format: str = "png", scale: int = 1, - rescale: Tuple[int, int] = (0, 1000), + rescale: Tuple[int, int] = (0, 255), ) -> np.ndarray: """get base tile as numpy array @@ -144,7 +144,7 @@ async def get_offset_tile( height: int = 256, band: str = "vv", img_format: str = "png", - rescale: Tuple[int, int] = (0, 1000), + rescale: Tuple[int, int] = (0, 255), ) -> np.ndarray: """get offset tile as numpy array (with bounds)