From 21f4bbe500247e11885e08568257de1091c976ae Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 15 Jun 2026 12:42:10 +0800 Subject: [PATCH] fix: disable dltb priors for gf3 water workflow --- .env.example | 3 ++- backend/app/config.py | 1 + backend/app/services/gf3_water_extraction_service.py | 12 +++++++++--- docs/GF3_WATER_EXTRACTION_INTEGRATION_20260615.md | 11 +++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index de07c7e..bcf27a5 100644 --- a/.env.example +++ b/.env.example @@ -119,7 +119,8 @@ IDL_DINSAR_DEM_BASE_FILE=D:\SRTM30m\SRTMDEM_RSP_SARscape SRTM_DEM_DIR=D:\SRTM30m GF3_GEO_DEM_PATH=D:\DEM\gf3_dem.jp2 WATER_RESULTS_DIR=D:\WaterResult -GF3_WATER_DLTB_CACHE_DIR=D:\production_assets\gf3_water\priors\dltb_cache\heilongjiang +GF3_WATER_USE_DLTB=false +GF3_WATER_DLTB_CACHE_DIR= GF3_WATER_DEM_PATH= GF3_WATER_DEFAULT_CARTOGRAPHIC=true GF3_WATER_DEFAULT_OUT_VECTOR=true diff --git a/backend/app/config.py b/backend/app/config.py index 020be19..5b32b52 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -215,6 +215,7 @@ class Settings(BaseSettings): RADAR_PREVIEW_BUILD_ON_DEMAND: bool = True WATER_RESULTS_DIR: str = "" + GF3_WATER_USE_DLTB: bool = False GF3_WATER_DLTB_CACHE_DIR: str = "" GF3_WATER_DEM_PATH: str = "" GF3_WATER_DEFAULT_CARTOGRAPHIC: bool = True diff --git a/backend/app/services/gf3_water_extraction_service.py b/backend/app/services/gf3_water_extraction_service.py index c542795..b119e83 100644 --- a/backend/app/services/gf3_water_extraction_service.py +++ b/backend/app/services/gf3_water_extraction_service.py @@ -134,9 +134,14 @@ def run_gf3_hh_hv_water_extraction( hh = _existing_path(hh_path, label="HH input") hv = _existing_path(hv_path, label="HV input") - dltb_cache_dir = _optional_existing_path( - params.get("dltb_cache_dir") or settings.GF3_WATER_DLTB_CACHE_DIR, - label="GF3_WATER_DLTB_CACHE_DIR", + use_dltb = _as_bool(params.get("use_dltb"), bool(settings.GF3_WATER_USE_DLTB)) + dltb_cache_dir = ( + _optional_existing_path( + params.get("dltb_cache_dir") or settings.GF3_WATER_DLTB_CACHE_DIR, + label="GF3_WATER_DLTB_CACHE_DIR", + ) + if use_dltb + else None ) dem = _optional_existing_path( params.get("dem") or params.get("dem_path") or settings.GF3_WATER_DEM_PATH, @@ -224,6 +229,7 @@ def run_gf3_hh_hv_water_extraction( "dltb_cache_dir": str(dltb_cache_dir) if dltb_cache_dir else None, }, "runtime": { + "dltb_enabled": use_dltb and dltb_cache_dir is not None, "vector_requested": out_vector, "vector_runtime_available": vector_runtime_available, "vector_output_enabled": vector_output_enabled, diff --git a/docs/GF3_WATER_EXTRACTION_INTEGRATION_20260615.md b/docs/GF3_WATER_EXTRACTION_INTEGRATION_20260615.md index 2987fd7..16a1279 100644 --- a/docs/GF3_WATER_EXTRACTION_INTEGRATION_20260615.md +++ b/docs/GF3_WATER_EXTRACTION_INTEGRATION_20260615.md @@ -86,12 +86,14 @@ System integration should be written around existing services: Do not store runtime data in Git. -Required/valuable runtime assets: +Current integration does not use DLTB priors. The GF-3 HH/HV processor runs from SAR backscatter, morphology and optional vector/DEM inputs only. + +Optional future runtime assets: - `D:\Code\Water\data\priors\dltb_cache\heilongjiang` - Current size observed: 25 files, about 8.5 GB. - - Transfer to a managed runtime asset path, for example `D:\production_assets\gf3_water\priors\dltb_cache\heilongjiang`. - - Configure by `GF3_WATER_DLTB_CACHE_DIR`. + - Do not transfer for the current workflow. + - If DLTB is re-enabled later, transfer to a managed runtime asset path, for example `D:\production_assets\gf3_water\priors\dltb_cache\heilongjiang`, then set `GF3_WATER_USE_DLTB=true` and `GF3_WATER_DLTB_CACHE_DIR`. Optional runtime assets: @@ -116,6 +118,7 @@ These are large model artifacts and should stay outside the application until a Add configuration keys: +- `GF3_WATER_USE_DLTB=false` - `GF3_WATER_DLTB_CACHE_DIR` - `GF3_WATER_DEM_PATH` - `GF3_WATER_DEFAULT_CARTOGRAPHIC=true` @@ -153,5 +156,5 @@ flowchart TD ## Open Decisions - Whether runtime execution should be in-process Python API first or always subprocess CLI. Initial integration should use in-process API because it fits the existing worker model and keeps job accounting simple. -- Whether to transfer the 8.5 GB DLTB cache automatically. This should be a deployment operation, not a Git operation. +- DLTB priors are disabled for the current workflow. Re-enabling them later should be a deployment decision because the cache is about 8.5 GB. - Whether legacy AI4G U-Net should be supported later. It should not block the current HH/HV production chain.