From 382a0128afeebf74e3a2780cc1c057eb09f735ed Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Mon, 8 Dec 2025 13:58:40 -0800 Subject: [PATCH 1/2] Set pitch_corrected_instr = "navigation" for only seabird25p on i2map. --- src/data/resample.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/resample.py b/src/data/resample.py index 424a0be..b4f7569 100755 --- a/src/data/resample.py +++ b/src/data/resample.py @@ -1807,7 +1807,7 @@ def resample_align_file( # noqa: C901, PLR0912, PLR0915, PLR0913 # 'seabird25p' if needed for i2map missions. Early LRAUV missions # had only CTD_NeilBrown instruments, later ones had CTD_Seabird. pitch_corrected_instr = self._get_pitch_corrected_instrument() - if pitch_corrected_instr in instrs_to_pad: + if pitch_corrected_instr == "seabird25p" and pitch_corrected_instr in instrs_to_pad: # Use navigation if seabird25p failed to record # data all the way to the end of the mission pitch_corrected_instr = "navigation" From 70962a3329c47cd6cc4229680213f1784e837121 Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Mon, 8 Dec 2025 13:59:44 -0800 Subject: [PATCH 2/2] Remove exception handing in functions, let the decorator (wrapper) handle them. --- .vscode/launch.json | 6 +++++- src/data/process.py | 29 ++++------------------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3e4f8f9..019a6db 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -376,7 +376,11 @@ //"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250903_20250903/20250903T202626/202509032026_202509032030.nc4", "--no_cleanup"] // Fails in nudge_positions, maybe bad GPS data? //"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250909_20250915/20250911T073640/202509110736_202509120809.nc4", "--no_cleanup"] - "args": ["-v", "1", "--auv_name", "brizo", "--start", "20250901T000000", "--end", "20251001T000000", "--noinput", "--num_cores", "1", "--no_cleanup"] + // Raises InvalidCombinedFile error + //"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250916_20250922/20250921T001456/202509210014_202509221430.nc4", "--no_cleanup"] + // A depth coordinate was not found for instrument navigation in + //"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250903_20250903/20250903T175939/202509031759_202509032026.nc4", "--no_cleanup"] + "args": ["-v", "1", "--auv_name", "brizo", "--start", "20250901T000000", "--end", "20251001T000000", "--no_cleanup"] }, ] diff --git a/src/data/process.py b/src/data/process.py index cd947ef..15f4eca 100755 --- a/src/data/process.py +++ b/src/data/process.py @@ -106,6 +106,8 @@ def wrapper(self, log_file: str): return func(self, log_file) except (TestMission, FailedMission, EOFError) as e: self.logger.info(str(e)) + except (FileNotFoundError, InvalidCalFile, InvalidCombinedFile, InvalidAlignFile) as e: + self.logger.warning(str(e)) except Exception: # Catch all other exceptions and log full traceback self.logger.exception("Exception occurred while processing %s", log_file) @@ -525,9 +527,8 @@ def calibrate(self, mission: str) -> None: try: netcdf_dir = cal_netcdf.process_logs() cal_netcdf.write_netcdf(netcdf_dir) - except (FileNotFoundError, EOFError) as e: - cal_netcdf.logger.error("%s %s", mission, e) # noqa: TRY400 - cal_netcdf.logger.removeHandler(self.log_handler) + finally: + cal_netcdf.logger.removeHandler(self.log_handler) def align(self, mission: str = "", log_file: str = "") -> None: self.logger.info("Alignment steps for %s", mission or log_file) @@ -548,15 +549,6 @@ def align(self, mission: str = "", log_file: str = "") -> None: else: netcdf_dir = align_netcdf.process_cal() align_netcdf.write_combined_netcdf(netcdf_dir) - except (FileNotFoundError, EOFError) as e: - align_netcdf.logger.error("%s %s", mission or log_file, e) # noqa: TRY400 - error_message = f"{mission or log_file} {e}" - raise InvalidCalFile(error_message) from e - except Exception: - align_netcdf.logger.exception( - "Exception occurred during alignment of %s", mission or log_file - ) - raise finally: align_netcdf.logger.removeHandler(self.log_handler) @@ -611,13 +603,6 @@ def resample(self, mission: str = "", log_file: str = "") -> None: subprocess.run([wget_path, dap_file_str, "-O", nc_file_str], check=True) # noqa: S603 try: resamp.resample_align_file(nc_file) - except (FileNotFoundError, InvalidAlignFile) as e: - self.logger.error("%s %s", nc_file, e) # noqa: TRY400 - except Exception: - resamp.logger.exception( - "Exception occurred during resampling of %s", mission or log_file - ) - raise finally: resamp.logger.removeHandler(self.log_handler) @@ -1001,9 +986,6 @@ def extract(self, log_file: str) -> None: extract.logger.info("Downloading %s", url) input_file = extract.download_with_pooch(url, output_dir) return extract.extract_groups_to_files_netcdf4(input_file) - except Exception: - extract.logger.exception("Exception occurred during extraction of %s", log_file) - raise finally: extract.logger.removeHandler(self.log_handler) @@ -1025,9 +1007,6 @@ def combine(self, log_file: str) -> None: try: combine.combine_groups() combine.write_netcdf() - except Exception: - combine.logger.exception("Exception occurred during combine of %s", log_file) - raise finally: combine.logger.removeHandler(self.log_handler)