From 3ee4e90b31f73d6f589af957dbfe23a78cc1d7ad Mon Sep 17 00:00:00 2001 From: DXC Date: Thu, 18 Jun 2026 10:36:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20step=5Fdefault=5Foutputs=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=88=97=E8=A1=A8=E5=80=99=E9=80=89=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=8A=A8=E6=80=81=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E5=AF=BC=E8=87=B4=20OutputUpdated=20=E6=96=AD?= =?UTF-8?q?=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/workspace_manager.py | 37 +++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/core/workspace_manager.py b/src/core/workspace_manager.py index 0165f4d..ac2a9b2 100644 --- a/src/core/workspace_manager.py +++ b/src/core/workspace_manager.py @@ -25,9 +25,16 @@ class WorkspaceManager: def __init__(self): self.step_default_outputs = { - 'step1': {'water_mask': "1_water_mask/water_mask_out.dat"}, + 'step1': {'water_mask': [ + "1_water_mask/water_mask_out.dat", + "1_water_mask/water_mask_from_ndwi.dat", + "1_water_mask/water_mask_from_shp.dat", + ]}, 'step2': {'glint_mask': "2_Glint_Detection/severe_glint_area.dat"}, - 'step3': {'deglint_image': "3_deglint/deglint_image.bsq"}, + 'step3': {'deglint_image': [ + "3_deglint/deglint_image.bsq", + "3_deglint/deglint_goodman.bsq", + ]}, 'step4_sampling': {'sampling_points': "4_sampling/sampling_spectra.csv"}, 'step5_clean': {'processed_data': "5_Data_Cleaning/processed_data.csv"}, 'step6_feature': {'training_spectra': "6_Spectral_Feature_Extraction/training_spectra.csv"}, @@ -100,7 +107,12 @@ class WorkspaceManager: return candidate if output_type == 'water_mask': - if rel_path: + if isinstance(rel_path, list): + for candidate in rel_path: + mask_path = work_path / candidate + if mask_path.exists(): + return str(mask_path) + elif rel_path: mask_path = work_path / rel_path if mask_path.exists(): return str(mask_path) @@ -108,7 +120,12 @@ class WorkspaceManager: if ref_img_path and Path(ref_img_path).exists(): return ref_img_path elif output_type == 'deglint_image': - if rel_path: + if isinstance(rel_path, list): + for candidate in rel_path: + deglint_path = work_path / candidate + if deglint_path.exists(): + return str(deglint_path) + elif rel_path: deglint_path = work_path / rel_path if deglint_path.exists(): return str(deglint_path) @@ -118,7 +135,7 @@ class WorkspaceManager: return str(file_path) for file_path in deglint_dir.glob("interpolated_*.bsq"): return str(file_path) - elif rel_path: + elif isinstance(rel_path, str): if rel_path.endswith('/'): output_path = work_path / rel_path.rstrip('/') if output_path.exists() and output_path.is_dir(): @@ -208,7 +225,15 @@ class WorkspaceManager: published = {} for output_type, relative_path in step_outputs.items(): - if '*' in relative_path: + if isinstance(relative_path, list): + for candidate in relative_path: + output_path = work_path / candidate + if output_path.exists(): + path_str = str(output_path) + self.step_outputs.setdefault(step_name, {})[output_type] = path_str + published[output_type] = path_str + break + elif '*' in relative_path: pattern_path = work_path / relative_path.replace('*', '*') matching_files = list(pattern_path.parent.glob(pattern_path.name)) if matching_files: