From 0a09d1be298921d628173312fa2564f17462a1d2 Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Mon, 27 Apr 2026 16:29:59 -0700 Subject: [PATCH 1/3] Use short output file name (without path) in the Processrun name. --- src/data/process.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/process.py b/src/data/process.py index 6f36812..3810dcb 100755 --- a/src/data/process.py +++ b/src/data/process.py @@ -839,7 +839,7 @@ def _submit_provenance( # noqa: PLR0913 if not Path(full_nc).exists(): self.logger.debug("Output %s not found, skipping provenance", full_nc) return - log_url = get_dods_url(log_file) if log_file else None + log_url = get_web_url(log_file) if log_file else None import xarray as xr # noqa: PLC0415 try: @@ -852,7 +852,7 @@ def _submit_provenance( # noqa: PLR0913 submit_process_run( producer_name=( f"auv-python - Execution of {Path(script_name).name}" - f" to produce {Path(output_nc)}" + f" to produce {Path(output_nc).name}" ), producer_description=self.commandline, nc_file_path=full_nc, From bd4e0fb797c565058dc9bf6697e8593e236a8cba Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Mon, 27 Apr 2026 16:30:41 -0700 Subject: [PATCH 2/3] Fix uristring Resource paths. --- src/data/provenance.py | 46 +++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/data/provenance.py b/src/data/provenance.py index 4f94629..503a920 100644 --- a/src/data/provenance.py +++ b/src/data/provenance.py @@ -11,10 +11,10 @@ import argparse import logging import os +import re import sys from datetime import UTC, datetime from pathlib import Path -from socket import gethostname import git import requests @@ -88,16 +88,26 @@ def build_authenticated_session( return session +_MISSION_NETCDFS_RE = re.compile(r"[^/]+/missionnetcdfs/(\d{4})\.[^/]+/(.+)$") +_MISSION_IMAGES_RE = re.compile(r"[^/]+/missionimages/(\d{4})\.[^/]+/(.+)$") + + def get_dods_url(nc_file_path: str) -> str: """Translate a local NetCDF path to its OPeNDAP URL. - Walks ``PATH_TO_URL_MAP`` looking for a matching prefix in the - *resolved* path string. Returns the original path unchanged if no - match is found. + Dorado/i2map NetCDF files are stored locally under + ``{auv_name}/missionnetcdfs/{YYYY}.{DDD}.{SS}/`` but are archived to + ``surveys/{YYYY}/netcdf/`` on the OPeNDAP server, so that mapping is + applied when the pattern is detected. """ resolved = str(Path(nc_file_path).resolve()) for local_prefix, url_prefix in PATH_TO_URL_MAP.items(): if resolved.startswith(local_prefix): + rel = resolved[len(local_prefix) :].lstrip("/") + m = _MISSION_NETCDFS_RE.match(rel) + if m: + year, filename = m.group(1), m.group(2) + return f"{url_prefix}/surveys/{year}/netcdf/{filename}" return resolved.replace(local_prefix, url_prefix, 1) return resolved @@ -105,14 +115,25 @@ def get_dods_url(nc_file_path: str) -> str: def get_web_url(file_path: str) -> str: """Translate a local file path to its web-accessible URL (no OPeNDAP prefix). - Use this for PNG, HTML, and other static files served over HTTP. - Walks ``_PATH_TO_WEB_MAP`` looking for a matching prefix in the - *resolved* path string. Returns the original path unchanged if no - match is found. + Use this for PNG, HTML, log, and other static files served over HTTP. + + Dorado/i2map files are stored locally under mission-specific subdirectories + but are archived to a flat ``surveys/{YYYY}/`` layout on the web server: + - ``{auv_name}/missionnetcdfs/{YYYY}.*/`` → ``surveys/{YYYY}/netcdf/`` + - ``{auv_name}/missionimages/{YYYY}.*/`` → ``surveys/{YYYY}/images/`` """ resolved = str(Path(file_path).resolve()) for local_prefix, url_prefix in _PATH_TO_WEB_MAP.items(): if resolved.startswith(local_prefix): + rel = resolved[len(local_prefix) :].lstrip("/") + m = _MISSION_NETCDFS_RE.match(rel) + if m: + year, filename = m.group(1), m.group(2) + return f"{url_prefix}/surveys/{year}/netcdf/{filename}" + m = _MISSION_IMAGES_RE.match(rel) + if m: + year, filename = m.group(1), m.group(2) + return f"{url_prefix}/surveys/{year}/images/{filename}" return resolved.replace(local_prefix, url_prefix, 1) return resolved @@ -221,14 +242,7 @@ def submit_process_run( # noqa: PLR0913 "description": f"Processing script: {script_name}", }, ] - if cmd_line_args: - resources.append( - { - "name": "command_line", - "uristring": f"urn:cmdline:{gethostname()}", - "description": cmd_line_args, - } - ) + if log_file_url: resources.append( { From 2c8abe66884ae651dd443c7c949074e9c3593192 Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Mon, 27 Apr 2026 16:53:09 -0700 Subject: [PATCH 3/3] Decrease sample marker size and turn off clipping for them. --- src/data/create_products.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/data/create_products.py b/src/data/create_products.py index 42f02c8..bb9b383 100755 --- a/src/data/create_products.py +++ b/src/data/create_products.py @@ -1155,11 +1155,12 @@ def _overlay_gulper_on_map(self, map_ax: matplotlib.axes.Axes, transformer) -> N gx, gy, "o", - markersize=7, + markersize=5, zorder=7, markerfacecolor="white", markeredgecolor="black", label="Gulper" if first else "", + clip_on=False, ) map_ax.annotate( str(bottle), @@ -1170,6 +1171,7 @@ def _overlay_gulper_on_map(self, map_ax: matplotlib.axes.Axes, transformer) -> N ha="left", va="center", color="black", + annotation_clip=False, ) first = False @@ -1208,11 +1210,12 @@ def _overlay_sipper_on_map(self, map_ax: matplotlib.axes.Axes, transformer) -> N sx, sy, "o", - markersize=7, + markersize=5, zorder=7, markerfacecolor="white", markeredgecolor="black", label="Sipper" if first else "", + clip_on=False, ) map_ax.annotate( str(sample), @@ -1223,6 +1226,7 @@ def _overlay_sipper_on_map(self, map_ax: matplotlib.axes.Axes, transformer) -> N ha="left", va="center", color="black", + annotation_clip=False, ) first = False @@ -1797,10 +1801,11 @@ def _plot_var_scatter( # noqa: C901, PLR0912, PLR0913, PLR0915 dist, depth, "o", - markersize=7, + markersize=5, zorder=5, markerfacecolor="white", markeredgecolor="black", + clip_on=False, ) curr_ax.annotate( str(bottle), @@ -1813,6 +1818,7 @@ def _plot_var_scatter( # noqa: C901, PLR0912, PLR0913, PLR0915 color="black", fontweight="bold", zorder=6, + annotation_clip=False, ) # Only show y-label on left column or top of right column @@ -2052,10 +2058,11 @@ def _plot_var_contour( # noqa: C901, PLR0912, PLR0913, PLR0915 dist, depth, "o", - markersize=7, + markersize=5, zorder=5, markerfacecolor="white", markeredgecolor="black", + clip_on=False, ) curr_ax.annotate( str(bottle), @@ -2068,6 +2075,7 @@ def _plot_var_contour( # noqa: C901, PLR0912, PLR0913, PLR0915 color="black", fontweight="bold", zorder=6, + annotation_clip=False, ) # Only show y-label on left column or top of right column