Skip to content
24 changes: 21 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,30 @@
// Test ESP markers - Shallow log file from Denmark deployment in June 2024, has large depth values in self.ds.depth.values[6500:6800]
//"args": ["-v", "1", "--log_file", "makai/missionlogs/2024/20240607_20240615/20240611T082709/202406110827_202406111026.nc4", "--update_ssds_provenance", "--clobber"]
// Test making engineering plot with a short log file
"args": ["-v", "1", "--log_file", "ahi/missionlogs/2025/20250128_20250131/20250129T145420/202501291454_202501292233.nc4", "--update_ssds_provenance", "--clobber"]
"args": ["-v", "1", "--log_file", "ahi/missionlogs/2025/20250128_20250131/20250129T145420/202501291454_202501292233.nc4"]
// and for the rest of the log files of this deployment
//"args": ["-v", "1", "--auv_name", "ahi", "--start", "20250127T000000", "--end", "20250201T000000", "--update_ssds_provenance", "--clobber", "--no_cleanup"]
// Test having a better y-max that puts data instead of white space at the bottom
//"args": ["-v", "1", "--log_file", "ahi/missionlogs/2026/20260406_20260412/20260410T010521/202604100105_202604100800.nc4"]
},
{
"name": "process_lrauv_sbd",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/src/data/process_lrauv_sbd.py",
"console": "integratedTerminal",
// ahi CFE deployment March 2026 - large shore.nc4 file, good test case
//"args": ["--auv_name", "ahi", "--start", "20260317", "--end", "20260318", "-v", "--noproducts"]
// ahi 47 CFE deployment April 2026
//"args": ["--auv_name", "ahi", "--start", "20260406", "--end", "20260412", "-v"]
//"args": ["--auv_name", "ahi", "--start", "20260303", "--end", "20260331", "-v", "2", "--clobber"]
// Test a month with fewer plots to make
//"args": ["--auv_name", "daphne", "--start", "20260101", "--end", "20260131", "-v", "2", "--clobber"]
// Test pyxis
"args": ["--auv_name", "pyxis", "--start", "20260501", "--end", "20260531", "-v", "1", "--clobber"]
// Test --current_month
//"args": ["--current_month", "-v", "1"]
},
{
"name": "lrauv_deployment_plots",
"type": "debugpy",
Expand Down Expand Up @@ -525,9 +543,9 @@
// Test --build_index for 2026 to test a fixed layout
//"args": ["-v", "1", "--build_index", "--start", "20260101", "--end", "20261231", "--force"]
// Test fixing the "folded" bathymetry
//"args": ["-v", "1", "--dlist", "ahi/missionlogs/2026/20260218_20260220.dlist", "--force", "--update_ssds_provenance", "--notify", "mccann@mbari.org"]
"args": ["-v", "1", "--dlist", "ahi/missionlogs/2026/20260218_20260220.dlist", "--force", "--update_ssds_provenance", "--notify", "mccann@mbari.org"]
// Repair a badly plotted deployment with fixed bathymetry plotting - Pontus 54 Docking
"args": ["-v", "1", "--dlist", "pontus/missionlogs/2025/20250604_20250616.dlist"]
//"args": ["-v", "1", "--dlist", "pontus/missionlogs/2025/20250604_20250616.dlist"]
},

]
Expand Down
44 changes: 44 additions & 0 deletions src/data/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,50 @@ def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None: # noqa: C901,
src_file.name,
)

def copy_sbd_to_LRAUV(self, sbd_nc_path: Path) -> None:
"""Copy SBD resampled netCDF and any product files to the LRAUV archive volume.

Maps:
data/lrauv_data/{auv}/realtime/sbdlogs/{YYYY}/{date_range}/
→ /Volumes/LRAUV/{auv}/realtime/sbdlogs/{YYYY}/{date_range}/

Args:
sbd_nc_path: Absolute path to the *_sbd_1S.nc output file.
"""
src_dir = sbd_nc_path.parent
# Derive the destination by replacing BASE_LRAUV_PATH prefix with LRAUV_VOL
try:
rel = src_dir.relative_to(BASE_LRAUV_PATH)
except ValueError:
self.logger.exception(
"SBD path %s is not under BASE_LRAUV_PATH %s", src_dir, BASE_LRAUV_PATH
)
return
dst_dir = Path(LRAUV_VOL) / rel
try:
dst_dir.stat()
except FileNotFoundError:
self.logger.warning("Destination %s not found — is %s mounted?", dst_dir, LRAUV_VOL)
return

stem = sbd_nc_path.stem # e.g. ahi_20260317_20260318_sbd_1S
for pattern in (f"{stem}.nc", f"{stem}_*.png", f"{stem}_*.txt"):
for src_file in sorted(src_dir.glob(pattern)):
dst_file = dst_dir / src_file.name
if self.clobber:
if dst_file.exists():
self.logger.info("Removing %s", dst_file)
dst_file.unlink()
self.logger.info("copyfile %s %s", src_file, dst_dir)
shutil.copyfile(src_file, dst_file)
self.logger.info("copyfile %s %s done.", src_file, dst_dir)
elif not dst_file.exists():
self.logger.info("copyfile %s %s", src_file, dst_dir)
shutil.copyfile(src_file, dst_file)
self.logger.info("copyfile %s %s done.", src_file, dst_dir)
else:
self.logger.info("%s exists, not overwriting (use --clobber)", dst_file.name)

def copy_lrauv_deployment(self, deployment_dir: Path, plot_name_stem: str) -> None:
"""Copy LRAUV deployment plots and HTML index to the LRAUV archive volume.

Expand Down
17 changes: 17 additions & 0 deletions src/data/common_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@
DEFAULT_FREQ = "1S" # 1 Hz resampling frequency
DEFAULT_MF_WIDTH = 3 # Median filter width

ALL_LRAUV_NAMES = (
"ahi",
"aku",
"brezo",
"brizo",
"daphne",
"galene",
"makai",
"opah",
"polaris",
"pontus",
"pyxis",
"tethys",
"triton",
"whoidhs",
)


class CommonArgumentParser:
"""Shared argument parser factory for all AUV processing modules."""
Expand Down
Loading
Loading