From 64d4b69ce349984ef18f52e2e6bed05d8b7001af Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Wed, 6 May 2026 09:24:14 -0700 Subject: [PATCH 1/3] Increase font size for most y-axis labels. --- src/data/create_products.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/data/create_products.py b/src/data/create_products.py index 55b3ec2..76e8f7f 100755 --- a/src/data/create_products.py +++ b/src/data/create_products.py @@ -1617,14 +1617,15 @@ def _setup_no_data_axes( # noqa: PLR0913 cb = fig.colorbar(dummy_im, ax=curr_ax, pad=0.01) cb.set_ticks([]) + fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) if scale == "log" and units: - cb.set_label(f"{long_name}\n[log10({units})]", fontsize=7) + cb.set_label(f"{long_name}\n[log10({units})]", fontsize=fs) elif scale == "log": - cb.set_label(f"{long_name}\n[log10]", fontsize=7) + cb.set_label(f"{long_name}\n[log10]", fontsize=fs) elif units: - cb.set_label(f"{long_name}\n[{units}]", fontsize=8) + cb.set_label(f"{long_name}\n[{units}]", fontsize=fs) else: - cb.set_label(long_name, fontsize=8) + cb.set_label(long_name, fontsize=fs) def _plot_var( # noqa: C901, PLR0912, PLR0913, PLR0915 self, @@ -1872,14 +1873,15 @@ def _plot_var_scatter( # noqa: C901, PLR0912, PLR0913, PLR0915 long_name, units, _ = self._resolve_label(var) + fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) if scale == "log" and units: - cb.set_label(f"{long_name}\n[log10({units})]", fontsize=7) + cb.set_label(f"{long_name}\n[log10({units})]", fontsize=fs) elif scale == "log": - cb.set_label(f"{long_name}\n[log10]", fontsize=7) + cb.set_label(f"{long_name}\n[log10]", fontsize=fs) elif units: - cb.set_label(f"{long_name}\n[{units}]", fontsize=8) + cb.set_label(f"{long_name}\n[{units}]", fontsize=fs) else: - cb.set_label(long_name, fontsize=8) + cb.set_label(long_name, fontsize=fs) # Add CTD label for density, temperature, and salinity plots if best_ctd and (var == "density" or "_temperature" in var or "_salinity" in var): @@ -2150,14 +2152,15 @@ def _plot_var_contour( # noqa: C901, PLR0912, PLR0913, PLR0915 long_name, units, _ = self._resolve_label(var) + fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) if scale == "log" and units: - cb.set_label(f"{long_name}\n[log10({units})]", fontsize=7) + cb.set_label(f"{long_name}\n[log10({units})]", fontsize=fs) elif scale == "log": - cb.set_label(f"{long_name}\n[log10]", fontsize=7) + cb.set_label(f"{long_name}\n[log10]", fontsize=fs) elif units: - cb.set_label(f"{long_name}\n[{units}]", fontsize=8) + cb.set_label(f"{long_name}\n[{units}]", fontsize=fs) else: - cb.set_label(long_name, fontsize=8) + cb.set_label(long_name, fontsize=fs) # Add CTD label for density, temperature, and salinity plots if best_ctd and (var == "density" or "_temperature" in var or "_salinity" in var): From dbe8760fc33d37f9d09b1c0cf4c8d0825da0e4d7 Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Wed, 6 May 2026 11:12:28 -0700 Subject: [PATCH 2/3] Make y-axis labels larger, add short labels to bottom of plot areas. --- .vscode/launch.json | 4 +- src/data/create_products.py | 109 ++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 810a4a0..01345b7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -491,7 +491,7 @@ // tethys CANON September 2012 (classic test case) //"args": ["-v", "1", "--dlist", "tethys/missionlogs/2012/20120908_20120920.dlist"] // ahi planktivore deployment April 2025 add --update_ssds_provenance - //"args": ["-v", "1", "--dlist", "ahi/missionlogs/2025/20250414_20250418.dlist", "--update_ssds_provenance"] + "args": ["-v", "1", "--dlist", "ahi/missionlogs/2025/20250414_20250418.dlist", "--update_ssds_provenance", "--force"] // Test time range of DeploymentPlots with ahi planktivore deployment April 2025 //"args": ["-v", "1", "--auv_name", "ahi", "--start", "20250401", "--end", "20250501", "--update_ssds_provenance", "--force"] // Test web page building with a short deployment @@ -511,7 +511,7 @@ // Test ESP data presentation //"args": ["-v", "1", "--dlist", "makai/missionlogs/2024/20240607_20240615.dlist", "--update_ssds_provenance", "--force", "--notify"] // Test of using dotenv for command line execution and INFO log of provenance submission - short failed mission - "args": ["-v", "1", "--dlist", "daphne/missionlogs/2026/20260423_20260423.dlist", "--update_ssds_provenance", "--force"] + //"args": ["-v", "1", "--dlist", "daphne/missionlogs/2026/20260423_20260423.dlist", "--update_ssds_provenance", "--force"] }, diff --git a/src/data/create_products.py b/src/data/create_products.py index 76e8f7f..7662ed3 100755 --- a/src/data/create_products.py +++ b/src/data/create_products.py @@ -22,6 +22,7 @@ import contextily as ctx import gsw import matplotlib # noqa: ICN001 +import matplotlib.patheffects as pe import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -219,6 +220,66 @@ def __init__( # noqa: PLR0913 # Override labels for variables whose name is not a good y-axis label. variable_display_names: dict[str, str] = {"density": "Sigma-t"} # noqa: RUF012 + # Maps dataset variable name → short human-readable label for use in plots and UIs. + variable_short_labels: dict[str, str] = { # noqa: RUF012 + # ── core oceanography ───────────────────────────────────────────────── + "density": "Density", + "ctd1_temperature": "Temperature", + "ctd2_temperature": "Temperature", + "ctd1_salinity": "Salinity", + "ctd2_salinity": "Salinity", + "isus_nitrate": "Nitrate", + "ctd1_oxygen_mll": "Oxygen", + "ctd2_oxygen_mll": "Oxygen", + # ── HS2 backscatter / fluorescence ──────────────────────────────────── + "hs2_bbp420": "Backscatter 420nm", + "hs2_bbp470": "Backscatter 470nm", + "hs2_bbp676": "Backscatter 676nm", + "hs2_bbp700": "Backscatter 700nm", + "hs2_fl676": "Fluorescence 676nm", + "hs2_fl700": "Fluorescence 700nm", + "ecopuck_chla": "Chlorophyll", + # ── bioluminescence (Dorado) ─────────────────────────────────────────── + "biolume_flow": "Flow", + "biolume_avg_biolume": "Bioluminescence", + "biolume_intflash": "Integrated Flash", + "biolume_bg_biolume": "Background Biolum.", + "biolume_nbflash_high": "High Flash Count", + "biolume_nbflash_low": "Low Flash Count", + "biolume_proxy_diatoms": "Diatom Proxy", + "biolume_proxy_adinos": "A-Dino Proxy", + "biolume_proxy_hdinos": "H-Dino Proxy", + # ── LRAUV CTD Seabird ───────────────────────────────────────────────── + "ctdseabird_sea_water_temperature": "Temperature", + "ctdseabird_sea_water_salinity": "Salinity", + "ctdseabird_mass_concentration_of_oxygen_in_sea_water": "Oxygen", + # ── LRAUV other ─────────────────────────────────────────────────────── + "onboard_platform_average_current": "Current", + "bpc1_platform_battery_charge": "Battery", + "universals_platform_pitch_angle": "Pitch", + # ── LRAUV WetLabs BB2FL ─────────────────────────────────────────────── + "wetlabsbb2fl_particulatebackscatteringcoeff470nm": "Backscatter 470nm", + "wetlabsbb2fl_particulatebackscatteringcoeff650nm": "Backscatter 650nm", + "wetlabsbb2fl_mass_concentration_of_chlorophyll_in_sea_water": "Chlorophyll", + # ── LRAUV UBAT bioluminescence ──────────────────────────────────────── + "wetlabsubat_flow_rate": "Flow", + "wetlabsubat_flow": "Flow", + "wetlabsubat_average_bioluminescence": "Bioluminescence", + "wetlabsubat_intflash": "Integrated Flash", + "wetlabsubat_bg_biolume": "Background Biolum.", + "wetlabsubat_nbflash_high": "High Flash Count", + "wetlabsubat_nbflash_low": "Low Flash Count", + "wetlabsubat_proxy_diatoms": "Diatom Proxy", + "wetlabsubat_proxy_adinos": "A-Dino Proxy", + "wetlabsubat_proxy_hdinos": "H-Dino Proxy", + # ── Planktivore ─────────────────────────────────────────────────────── + "backseat_planktivore_hm_avgrois": "HM Avg ROIS", + "backseat_planktivore_lm_avgrois": "LM Avg ROIS", + "backseat_planktivore_casetemp": "Case Temp", + "backseat_planktivore_casehumidity": "Case Humidity", + "backseat_planktivore_casepress": "Case Pressure", + } + # Fallback display metadata for variables that may be absent from the dataset # or whose NetCDF attributes are missing. Each entry is (units, colormap). variable_fallback_metadata: dict[str, tuple[str, str]] = { # noqa: RUF012 @@ -1617,6 +1678,22 @@ def _setup_no_data_axes( # noqa: PLR0913 cb = fig.colorbar(dummy_im, ax=curr_ax, pad=0.01) cb.set_ticks([]) + short_label = self.variable_short_labels.get(var, "") + if short_label: + curr_ax.text( + 0.5, + 0.02, + short_label, + transform=curr_ax.transAxes, + ha="center", + va="bottom", + fontsize=10, + color="white", + alpha=0.7, + zorder=10, + path_effects=[pe.withStroke(linewidth=1, foreground=(0, 0, 0, 0.3))], + ) + fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) if scale == "log" and units: cb.set_label(f"{long_name}\n[log10({units})]", fontsize=fs) @@ -1873,6 +1950,22 @@ def _plot_var_scatter( # noqa: C901, PLR0912, PLR0913, PLR0915 long_name, units, _ = self._resolve_label(var) + short_label = self.variable_short_labels.get(var, "") + if short_label: + curr_ax.text( + 0.5, + 0.02, + short_label, + transform=curr_ax.transAxes, + ha="center", + va="bottom", + fontsize=10, + color="white", + alpha=0.7, + zorder=10, + path_effects=[pe.withStroke(linewidth=1, foreground=(0, 0, 0, 0.3))], + ) + fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) if scale == "log" and units: cb.set_label(f"{long_name}\n[log10({units})]", fontsize=fs) @@ -2152,6 +2245,22 @@ def _plot_var_contour( # noqa: C901, PLR0912, PLR0913, PLR0915 long_name, units, _ = self._resolve_label(var) + short_label = self.variable_short_labels.get(var, "") + if short_label: + curr_ax.text( + 0.5, + 0.02, + short_label, + transform=curr_ax.transAxes, + ha="center", + va="bottom", + fontsize=10, + color="white", + alpha=0.7, + zorder=10, + path_effects=[pe.withStroke(linewidth=1, foreground=(0, 0, 0, 0.3))], + ) + fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) if scale == "log" and units: cb.set_label(f"{long_name}\n[log10({units})]", fontsize=fs) From ef885a82bd01c94505935fca1d23fa45c78cad00 Mon Sep 17 00:00:00 2001 From: Mike McCann Date: Wed, 6 May 2026 13:02:35 -0700 Subject: [PATCH 3/3] Put transparent box behind black text to make readable in more situations. --- .vscode/launch.json | 2 +- src/data/create_products.py | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 01345b7..2ebdba1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -507,7 +507,7 @@ // Test --notify with no argument to a message to the Slack web hook in the LRAUV_NOTIFY environment variable //"args": ["-v", "1", "--dlist", "ahi/missionlogs/2025/20251022_20251024.dlist", "--force", "--notify"] // Test Sipper data presentation - //"args": ["-v", "1", "--dlist", "daphne/missionlogs/2026/20260316_20260318.dlist", "--force", "--notify"] + //"args": ["-v", "1", "--dlist", "daphne/missionlogs/2026/20260316_20260318.dlist", "--force", "--notify", "mccann@mbari.org"] // Test ESP data presentation //"args": ["-v", "1", "--dlist", "makai/missionlogs/2024/20240607_20240615.dlist", "--update_ssds_provenance", "--force", "--notify"] // Test of using dotenv for command line execution and INFO log of provenance submission - short failed mission diff --git a/src/data/create_products.py b/src/data/create_products.py index 7662ed3..bf420b3 100755 --- a/src/data/create_products.py +++ b/src/data/create_products.py @@ -22,7 +22,6 @@ import contextily as ctx import gsw import matplotlib # noqa: ICN001 -import matplotlib.patheffects as pe import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -1687,11 +1686,16 @@ def _setup_no_data_axes( # noqa: PLR0913 transform=curr_ax.transAxes, ha="center", va="bottom", - fontsize=10, - color="white", + fontsize=14, + color="black", alpha=0.7, zorder=10, - path_effects=[pe.withStroke(linewidth=1, foreground=(0, 0, 0, 0.3))], + bbox={ + "boxstyle": "round,pad=0.15", + "facecolor": "white", + "alpha": 0.7, + "edgecolor": "none", + }, ) fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) @@ -1959,11 +1963,16 @@ def _plot_var_scatter( # noqa: C901, PLR0912, PLR0913, PLR0915 transform=curr_ax.transAxes, ha="center", va="bottom", - fontsize=10, - color="white", + fontsize=14, + color="black", alpha=0.7, zorder=10, - path_effects=[pe.withStroke(linewidth=1, foreground=(0, 0, 0, 0.3))], + bbox={ + "boxstyle": "round,pad=0.15", + "facecolor": "white", + "alpha": 0.7, + "edgecolor": "none", + }, ) fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9) @@ -2254,11 +2263,16 @@ def _plot_var_contour( # noqa: C901, PLR0912, PLR0913, PLR0915 transform=curr_ax.transAxes, ha="center", va="bottom", - fontsize=10, - color="white", + fontsize=14, + color="black", alpha=0.7, zorder=10, - path_effects=[pe.withStroke(linewidth=1, foreground=(0, 0, 0, 0.3))], + bbox={ + "boxstyle": "round,pad=0.15", + "facecolor": "white", + "alpha": 0.7, + "edgecolor": "none", + }, ) fs = 7 if "particulatebackscatter" in var else (8 if scale == "log" else 9)