diff --git a/src/data/create_products.py b/src/data/create_products.py index b446dd2..a0a8659 100755 --- a/src/data/create_products.py +++ b/src/data/create_products.py @@ -3250,7 +3250,7 @@ def plot_cbit_2column(self) -> str: ax_section.set_xlabel("Distance along track (km)") # Time series - ax_time.plot(times, cbit_vals, color="tab:red", linewidth=1) + ax_time.plot(times, cbit_vals, color="tab:red", linewidth=1, marker=".", markersize=3) ax_time.set_xlabel("Time (UTC)") ax_time.set_ylabel(ylabel) ax_time.set_title("Ah Used vs. Time") diff --git a/src/data/lrauv_deployment_plots.py b/src/data/lrauv_deployment_plots.py index 01ea875..7eed756 100755 --- a/src/data/lrauv_deployment_plots.py +++ b/src/data/lrauv_deployment_plots.py @@ -864,6 +864,27 @@ def _provenance_link_html(self, html_path: Path, nc_files: list[str], nt: str) - ) return f'Full provenance details in SSDS' + def _other_plots_line( + self, + nt: str, + sibling_html_paths: list[Path] | None, + other_png_paths: list[str] | None, + ) -> str: + """Return an HTML paragraph linking to sibling deployment plots, or empty string.""" + if sibling_html_paths: + links = [f'{p.stem}.png' for p in sibling_html_paths] + elif other_png_paths: + links = [ + f'{Path(p).name}' + for p in other_png_paths + if Path(p).exists() + ] + else: + return "" + if not links: + return "" + return "
Other plots for this deployment: " + " | ".join(links) + "
\n" + def _write_per_png_html( # noqa: C901, PLR0913 self, html_path: Path, @@ -876,6 +897,7 @@ def _write_per_png_html( # noqa: C901, PLR0913 png_file_path: Path | None = None, other_png_paths: list[str] | None = None, nc_durations: dict[str, int] | None = None, + sibling_html_paths: list[Path] | None = None, ) -> None: """Write a plain HTML page for one deployment PNG. @@ -953,17 +975,7 @@ def _write_per_png_html( # noqa: C901, PLR0913 " \n" ) - other_plots_line = "" - if other_png_paths: - sibling_links = [ - f'{Path(p).name}' - for p in other_png_paths - if Path(p).exists() - ] - if sibling_links: - other_plots_line = ( - "Other plots for this deployment: " + " | ".join(sibling_links) + "
\n" - ) + other_plots_line = self._other_plots_line(nt, sibling_html_paths, other_png_paths) stoqs_line = "" if stoqs_url: diff --git a/src/data/process_lrauv_sbd.py b/src/data/process_lrauv_sbd.py index ac4daf0..ff4ad3f 100755 --- a/src/data/process_lrauv_sbd.py +++ b/src/data/process_lrauv_sbd.py @@ -309,10 +309,11 @@ def _make_products( nc_durations[url] = int( (times[-1] - times[0]).astype("timedelta64[m]").astype(int) ) - html_paths = [] - for png_path in png_paths: - html_path = png_path.with_suffix(".html") - other_pngs = [str(p) for p in png_paths if p != png_path] + html_paths = [ + png_path.with_name(f"{png_path.stem.removeprefix(f'{args.auv_name}_')}.html") + for png_path in png_paths + ] + for png_path, html_path in zip(png_paths, html_paths, strict=True): dp._write_per_png_html( html_path=html_path, title=html_title, @@ -322,10 +323,9 @@ def _make_products( nc_files=nc_file_strs, auv_name=args.auv_name, png_file_path=png_path, - other_png_paths=other_pngs, + sibling_html_paths=[p for p in html_paths if p != html_path], nc_durations=nc_durations, ) - html_paths.append(html_path) dp._update_index_html( output_dir,