Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/data/create_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
34 changes: 23 additions & 11 deletions src/data/lrauv_deployment_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,27 @@ def _provenance_link_html(self, html_path: Path, nc_files: list[str], nt: str) -
)
return f'<small><a href="{ssds_url}" {nt}>Full provenance details in SSDS</a></small>'

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'<a href="{p.name}" {nt}>{p.stem}.png</a>' for p in sibling_html_paths]
elif other_png_paths:
links = [
f'<a href="{Path(p).with_suffix(".html").name}" {nt}>{Path(p).name}</a>'
for p in other_png_paths
if Path(p).exists()
]
else:
return ""
if not links:
return ""
return "<p>Other plots for this deployment: " + " | ".join(links) + "</p>\n"

def _write_per_png_html( # noqa: C901, PLR0913
self,
html_path: Path,
Expand All @@ -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.

Expand Down Expand Up @@ -953,17 +975,7 @@ def _write_per_png_html( # noqa: C901, PLR0913
" </table>\n"
)

other_plots_line = ""
if other_png_paths:
sibling_links = [
f'<a href="{Path(p).with_suffix(".html").name}" {nt}>{Path(p).name}</a>'
for p in other_png_paths
if Path(p).exists()
]
if sibling_links:
other_plots_line = (
"<p>Other plots for this deployment: " + " | ".join(sibling_links) + "</p>\n"
)
other_plots_line = self._other_plots_line(nt, sibling_html_paths, other_png_paths)

stoqs_line = ""
if stoqs_url:
Expand Down
12 changes: 6 additions & 6 deletions src/data/process_lrauv_sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Loading