diff --git a/.vscode/launch.json b/.vscode/launch.json index 810a4a0..2ebdba1 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 @@ -507,11 +507,11 @@ // 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 - "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 55b3ec2..bf420b3 100755 --- a/src/data/create_products.py +++ b/src/data/create_products.py @@ -219,6 +219,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,14 +1677,36 @@ 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=14, + color="black", + alpha=0.7, + zorder=10, + 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) 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 +1954,36 @@ 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=14, + color="black", + alpha=0.7, + zorder=10, + 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) 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 +2254,36 @@ 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=14, + color="black", + alpha=0.7, + zorder=10, + 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) 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):