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
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@
// File "/src/data/create_products.py", line 806, ValueError: max() iterable argument is empty
//"args": ["-v", "1", "--mission", "2013.079.00", "--noinput", "--no_cleanup" ],
// Add --add_seconds argument for 2025.316.02 mission when procss_missions is used
"args": ["-v", "1", "--noinput", "--start_year", "2025", "--end_year", "2025", "--start_yd", "316", "--num_cores", "1", "--no_cleanup"]
//"args": ["-v", "1", "--noinput", "--start_year", "2025", "--end_year", "2025", "--start_yd", "316", "--num_cores", "1", "--no_cleanup"]
// Do not write _1S.nc file if it has no time data
"args": ["-v", "1", "--mission", "2006.338.11", "--noinput", "--no_cleanup" ],


},
Expand Down
12 changes: 6 additions & 6 deletions src/data/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def copy_to_AUVTCD(self, nc_file_base: Path, freq: str = FREQ) -> None: # noqa:
if src_file.exists():
shutil.copyfile(src_file, dst_file)
self.logger.info("copyfile %s %s done.", src_file, surveynetcdfs_dir)
else:
elif src_file.exists():
self.logger.info(
"%26s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_file.name,
Expand All @@ -145,7 +145,7 @@ def copy_to_AUVTCD(self, nc_file_base: Path, freq: str = FREQ) -> None: # noqa:
if src_file.exists():
shutil.copyfile(src_file, missionnetcdfs_dir / src_file.name)
self.logger.info("copyfile %s %s done.", src_file, missionnetcdfs_dir)
else:
elif src_file.exists():
self.logger.info(
"%26s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_file.name,
Expand Down Expand Up @@ -178,7 +178,7 @@ def copy_to_AUVTCD(self, nc_file_base: Path, freq: str = FREQ) -> None: # noqa:
# src_dir, dst_dir, dirs_exist_ok=True, copy_function=shutil.copy
# )
# self.logger.info("copytree %s/* %s done.", src_dir, dst_dir)
else:
elif src_dir.exists():
self.logger.info(
"%26s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_dir.name,
Expand All @@ -200,7 +200,7 @@ def copy_to_AUVTCD(self, nc_file_base: Path, freq: str = FREQ) -> None: # noqa:
self.logger.info("copyfile %s %s", src_file, surveynetcdfs_dir)
shutil.copyfile(src_file, dst_file)
self.logger.info("copyfile %s %s done.", src_file, surveynetcdfs_dir)
else:
elif src_file.exists():
self.logger.info(
"%26s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_file.name,
Expand Down Expand Up @@ -228,7 +228,7 @@ def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None: # noqa: C901,
if src_file.exists():
shutil.copyfile(src_file, dst_file)
self.logger.info("copyfile %s %s done.", src_file, dst_dir)
else:
elif src_file.exists():
self.logger.info(
"%-75s exists, but is not being archived because --clobber is not specified.",
src_file.name,
Expand Down Expand Up @@ -256,7 +256,7 @@ def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None: # noqa: C901,
self.logger.info("copyfile %s %s", src_file, dst_dir)
shutil.copyfile(src_file, dst_file)
self.logger.info("copyfile %s %s done.", src_file, dst_dir)
else:
elif src_file.exists():
self.logger.info(
"%26s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_file.name,
Expand Down
13 changes: 8 additions & 5 deletions src/data/create_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _grid_dims(self) -> tuple:

try:
utm_zone = int(31 + (self.ds.cf["longitude"].mean() // 6))
except ValueError:
except (KeyError, ValueError):
self.logger.warning(
"Cannot compute mean longitude for UTM zone calculation, "
"longitude data may be empty or contain NaNs",
Expand Down Expand Up @@ -1157,7 +1157,7 @@ def plot_2column(self) -> str: # noqa: C901, PLR0912, PLR0915

try:
profile_bottoms = self._profile_bottoms(distnav)
except ValueError as e: # noqa: BLE001
except (TypeError, ValueError) as e:
self.logger.warning("Error computing profile bottoms: %s", e) # noqa: TRY400
profile_bottoms = None

Expand Down Expand Up @@ -1230,7 +1230,7 @@ def plot_2column(self) -> str: # noqa: C901, PLR0912, PLR0915
self.logger.info("Saved 2column plot to %s", output_file)
return str(output_file)

def plot_biolume(self) -> str: # noqa: C901
def plot_biolume(self) -> str: # noqa: C901, PLR0912
"""Create bioluminescence plot showing raw signal and proxy variables"""
# Skip plotting in pytest environment - too many prerequisites for CI
if "pytest" in sys.modules:
Expand All @@ -1249,8 +1249,11 @@ def plot_biolume(self) -> str: # noqa: C901
if idist is None or iz is None or distnav is None:
self.logger.warning("Skipping plot_biolume due to missing gridding dimensions")
return None

profile_bottoms = self._profile_bottoms(distnav)
try:
profile_bottoms = self._profile_bottoms(distnav)
except (TypeError, ValueError) as e:
self.logger.warning("Error computing profile bottoms: %s", e) # noqa: TRY400
profile_bottoms = None

# Create figure with subplots for biolume variables
num_plots = min(len(biolume_vars), 6) # Limit to 6 most important variables
Expand Down
10 changes: 8 additions & 2 deletions src/data/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -2054,8 +2054,14 @@ def resample_align_file( # noqa: C901, PLR0912, PLR0915, PLR0913
# Append flash_threshold to output filename
ft_ending = f"_ft{self.flash_threshold:.0E}.nc".replace("E+", "E")
out_fn = out_fn.replace(".nc", ft_ending)
self.resampled_nc.to_netcdf(path=out_fn, format="NETCDF4_CLASSIC")
self.logger.info("Saved resampled mission to %s", out_fn)
if self.resampled_nc["time"].any():
self.resampled_nc.to_netcdf(path=out_fn, format="NETCDF4_CLASSIC")
self.logger.info("Saved resampled mission to %s", out_fn)
else:
self.logger.warning(
"No resampled time data available - not saving resampled file %s",
out_fn,
)

def process_command_line(self):
"""Process command line arguments using shared parser infrastructure."""
Expand Down