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
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@
//"args": ["--auv_name", "dorado", "--mission", "2017.347.00", "-v", "1"],
//"args": ["-v", "1", "--log_file", "pontus/missionlogs/2025/20250909_20250912/20250911T051742/202509110517_202509112217.nc4"],
//"args": ["-v", "1", "--log_file", "pontus/missionlogs/2025/20250107_20250123/20250109T233911/202501092339_202501100203.nc4"],
"args": ["-v", "1", "--log_file", "pontus/missionlogs/2025/20250623_20250707/20250628T041514/202506280415_202506281230.nc4"],
//"args": ["-v", "1", "--log_file", "pontus/missionlogs/2025/20250623_20250707/20250628T041514/202506280415_202506281230.nc4"],
"args": ["-v", "1", "--log_file", "pontus/missionlogs/2025/20250604_20250616/20250609T222747/202506092228_202506101928.nc4"],
},
{
"name": "5.0 - archive.py",
Expand Down
20 changes: 16 additions & 4 deletions src/data/create_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _get_lrauv_plot_variables(self) -> list:
def _get_dorado_biolume_variables(self) -> list:
"""Get Dorado-specific bioluminescence plot variables for plot_biolume_2column()."""
return [
("density", "linear"),
("biolume_flow", "linear"),
("biolume_avg_biolume", "log"),
("biolume_intflash", "linear"),
("biolume_bg_biolume", "log"),
Expand All @@ -374,10 +374,22 @@ def _get_dorado_biolume_variables(self) -> list:
("biolume_proxy_hdinos", "linear"),
]

def _get_lrauv_ubat_flow_variable(self) -> str:
"""Get the preferred LRAUV UBAT flow variable name.

Newer datasets use wetlabsubat_flow_rate; some older datasets use wetlabsubat_flow.
"""
if hasattr(self, "ds"):
if "wetlabsubat_flow_rate" in self.ds:
return "wetlabsubat_flow_rate"
if "wetlabsubat_flow" in self.ds:
return "wetlabsubat_flow"
return "wetlabsubat_flow_rate"

def _get_lrauv_biolume_variables(self) -> list:
"""Get LRAUV-specific bioluminescence plot variables for plot_biolume_2column()."""
return [
("density", "linear"),
(self._get_lrauv_ubat_flow_variable(), "linear"),
("wetlabsubat_average_bioluminescence", "log"),
("wetlabsubat_intflash", "linear"),
("wetlabsubat_bg_biolume", "log"),
Expand Down Expand Up @@ -1684,10 +1696,10 @@ def plot_2column(self) -> str: # noqa: C901, PLR0912, PLR0915
return str(output_file)

def plot_biolume_2column(self) -> str: # noqa: C901, PLR0912, PLR0915
"""Create 2-column bioluminescence plot with map, sigma-t, and all biolume proxy variables.
"""Create 2-column bioluminescence plot with map, flow, and biolume proxies.

Layout (5 rows x 2 columns, column-major order):
(0,0) track map (0,1) density (sigma-t)
(0,0) track map (0,1) flow
(1,0) avg_biolume (1,1) intflash
(2,0) bg_biolume (2,1) nbflash_high
(3,0) nbflash_low (3,1) proxy_diatoms
Expand Down
14 changes: 8 additions & 6 deletions src/data/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,22 +1292,24 @@ def add_wetlabsubat_proxies( # noqa: PLR0913, PLR0915, C901, PLR0912
)
self.logger.info("Using wetlabsubat_flow for flow calculations")

# Flow sensor is not always on or may not be present, fill in 0.0 values with 350 ml/s
# Flow sensor is not always on or may not be present, fill in 0.0 values with 0.35 l/s
# (wetlabsubat_flow_rate is in l/s; 0.35 l/s == 350 mL/s, the Dorado equivalent)
FALLBACK_FLOW_L_PER_S = 0.35
zero_note = ""
if flow is None:
self.logger.info("No flow data found - using constant 350 ml/s")
self.logger.info("No flow data found - using constant %.2f l/s", FALLBACK_FLOW_L_PER_S)
# Create flow series with same index as resampled data
flow = pd.Series(350.0, index=nbflash_high_counts.index)
zero_note = "No flow data available - used constant 350 ml/s"
flow = pd.Series(FALLBACK_FLOW_L_PER_S, index=nbflash_high_counts.index)
zero_note = f"No flow data available - used constant {FALLBACK_FLOW_L_PER_S} l/s"
else:
num_zero_flow = len(np.where(flow == 0)[0])
if num_zero_flow > 0:
zero_note = (
f"Zero flow values found: {num_zero_flow} of {len(flow)} "
f"- replaced with 350 ml/s"
f"- replaced with {FALLBACK_FLOW_L_PER_S} l/s"
)
self.logger.info(zero_note)
flow = flow.replace(0.0, 350.0)
flow = flow.replace(0.0, FALLBACK_FLOW_L_PER_S)

# Compute flashes per liter - pandas.Series.divide() will match indexes
self.logger.info(
Expand Down
Loading