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
8 changes: 5 additions & 3 deletions src/data/lrauv_deployment_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def _build_and_write_html( # noqa: PLR0913
per_png_html,
html_title,
Path(png_path).name,
get_dods_url(png_path),
stoqs_url,
nc_files,
auv_name=dlist.split("/")[0],
Expand Down Expand Up @@ -559,14 +560,15 @@ def _write_per_png_html( # noqa: C901, PLR0913
html_path: Path,
title: str,
png_name: str,
png_url: str,
stoqs_url: str | None,
nc_files: list[str],
auv_name: str = "",
) -> None:
"""Write a plain HTML page for one deployment PNG.

Embeds the full-size PNG, links to the STOQS database, then lists
per-log image / data / STOQS links — no CSS.
Embeds the full-size PNG (via fully-qualified *png_url*), links to the
STOQS database, then lists per-log image / data / STOQS links — no CSS.
"""
# Group nc_files by log directory (second-to-last path component)
grouped: dict[str, list[str]] = {}
Expand Down Expand Up @@ -624,7 +626,7 @@ def _write_per_png_html( # noqa: C901, PLR0913
"</head>\n"
"<body>\n"
f" <h1>{html_title_single}</h1>\n"
f' <img src="{png_name}" alt="{png_name}">\n'
f' <img src="{png_url}" alt="{png_name}">\n'
f" {stoqs_line}"
" <h2>Log files</h2>\n"
" <ul>\n"
Expand Down
16 changes: 15 additions & 1 deletion src/data/test_lrauv_deployment_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
_OPENDAP_BASE = "http://dods.mbari.org/opendap/data/lrauv"
_NC_URL = f"{_OPENDAP_BASE}/ahi/missionlogs/2025/20250414_20250418/20250414T120000/ahi_1S.nc"
_STOQS_URL = "https://tethysviz.shore.mbari.org/stoqs_lrauv_apr2025/query/?permalink_id=abc123"
_PNG_URL = (
"https://dods.mbari.org/opendap/data/lrauv/ahi/missionlogs/2025/20250414_20250418/depl.png"
)

_DLIST_CONTENT = """\
# Deployment name: CANON April 2025
Expand Down Expand Up @@ -82,6 +85,7 @@ def test_basic_structure(self, dp, tmp_path):
html_path,
"Test Deployment\nApril 2025",
"deployment_2column_cmocean.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand All @@ -100,11 +104,12 @@ def test_png_embedded_as_img(self, dp, tmp_path):
html_path,
"Title",
"depl_cmocean.png",
_PNG_URL,
None,
[_NC_URL],
)
html = html_path.read_text()
assert '<img src="depl_cmocean.png"' in html # noqa: S101
assert '<img src="' + _PNG_URL + '"' in html # noqa: S101

def test_stoqs_link_present_when_url_given(self, dp, tmp_path):
html_path = tmp_path / "depl.html"
Expand All @@ -116,6 +121,7 @@ def test_stoqs_link_present_when_url_given(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
_STOQS_URL,
[_NC_URL],
)
Expand All @@ -133,6 +139,7 @@ def test_stoqs_link_absent_when_no_url(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand All @@ -148,6 +155,7 @@ def test_opendap_link_present(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand All @@ -163,6 +171,7 @@ def test_log_directory_listed(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand All @@ -179,6 +188,7 @@ def test_multiple_log_dirs_listed(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
None,
[_NC_URL, nc_url_b],
)
Expand All @@ -196,6 +206,7 @@ def test_per_log_html_link_when_url_exists(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand All @@ -217,6 +228,7 @@ def test_per_log_png_links_included(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand All @@ -233,6 +245,7 @@ def test_per_log_stoqs_url_used_per_log(self, dp, tmp_path):
html_path,
"Title",
"depl.png",
_PNG_URL,
_STOQS_URL,
[_NC_URL],
auv_name="ahi",
Expand All @@ -250,6 +263,7 @@ def test_footer_contains_script_link_and_timestamp(self, dp, tmp_path):
html_path,
"Title",
"depl_cmocean.png",
_PNG_URL,
None,
[_NC_URL],
)
Expand Down
Loading