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 @@ -334,7 +334,8 @@
//"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250909_20250915/20250914T080941/202509140809_202509150109.nc4"]
//"args": ["-v", "2", "--log_file", "brizo/missionlogs/2025/20250909_20250915/20250914T080941/202509140809_202509150109.nc4", "--clobber"]
//"args": ["-v", "2", "--log_file", "brizo/missionlogs/2025/20250909_20250915/20250914T080941/202509140809_202509150109.nc4", "--clobber", "--no_cleanup"]
"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250916_20250922/20250916T230652/202509162306_202509180305.nc4", "--no_cleanup"]
//"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250916_20250922/20250916T230652/202509162306_202509180305.nc4", "--no_cleanup"]
"args": ["-v", "1", "--log_file", "brizo/missionlogs/2025/20250916_20250922/20250916T230652/202509162306_202509180305.nc4", "--no_cleanup", "--clobber"]
//"args": ["-v", "1", "--auv_name", "tethys", "--start", "20120901", "--end", "20121101", "--noinput"]
},

Expand Down
2 changes: 1 addition & 1 deletion src/data/AUV.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def nudge_positions( # noqa: C901, PLR0912, PLR0913, PLR0915
seg_min = float(lat.cf["T"].data[segi][-1] - lat.cf["T"].data[segi][0]) / 1.0e9 / 60

logger.info(
f"{seg_count + 1:4d}: {'-':>12} {'-':>12} {'-':>12} {len(segi):-9d} {seg_min:9.2f} {'-':>14} {'-':>14}", # noqa: E501, G004
f"{seg_count + 1:5d}: {'-':>12} {'-':>12} {'-':>12} {len(segi):-9d} {seg_min:9.2f} {'-':>14} {'-':>14}", # noqa: E501, G004
)
segment_count = seg_count
segment_minsum = seg_minsum
Expand Down
17 changes: 15 additions & 2 deletions src/data/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def copy_to_AUVTCD(self, nc_file_base: Path, freq: str = FREQ) -> None: # noqa:
def copy_to_M3(self, resampled_nc_file: str) -> None:
pass

def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None:
def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None: # noqa: C901, PLR0912
"Copy the intermediate and resampled netCDF file(s) to the archive LRAUV location"
src_dir = Path(BASE_LRAUV_PATH, Path(log_file).parent)
dst_dir = Path(LRAUV_VOL, Path(log_file).parent)
Expand All @@ -196,7 +196,7 @@ def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None:
"%-75s exists, but is not being archived because --clobber is not specified.",
src_file.name,
)
for ftype in (f"{freq}.nc", "cal.nc", "align.nc"):
for ftype in (f"{freq}.nc", "combined.nc", "align.nc"):
src_file = Path(src_dir, f"{Path(log_file).stem}_{ftype}")
dst_file = Path(dst_dir, src_file.name)
if self.args.clobber:
Expand All @@ -211,6 +211,19 @@ def copy_to_LRAUV(self, log_file: str, freq: str = FREQ) -> None:
"%-36s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_file.name,
)
# Copy the processing.log file last so that we get everything
src_file = Path(src_dir, f"{Path(log_file).stem}_{LOG_NAME}")
dst_file = Path(dst_dir, src_file.name)
if src_file.exists():
if self.args.clobber:
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:
self.logger.info(
"%26s exists, but is not being archived because --clobber is not specified.", # noqa: E501
src_file.name,
)

def process_command_line(self):
parser = argparse.ArgumentParser(
Expand Down
2 changes: 1 addition & 1 deletion src/data/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def process_log_file(self, log_file: str) -> None:
netcdfs_dir = Path(BASE_LRAUV_PATH, Path(log_file).parent)
Path(netcdfs_dir).mkdir(parents=True, exist_ok=True)
self.log_handler = logging.FileHandler(
Path(BASE_LRAUV_PATH, f"{log_file}_extract.log"), mode="w+"
Path(netcdfs_dir, f"{Path(log_file).stem}_processing.log"), mode="w+"
)
self.log_handler.setLevel(self._log_levels[self.args.verbose])
self.log_handler.setFormatter(AUV_NetCDF._formatter)
Expand Down
13 changes: 12 additions & 1 deletion src/data/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ def _build_global_metadata(self) -> None:
)
gitcommit = "<failed to get git commit>"
iso_now = datetime.now(tz=UTC).isoformat().split(".")[0] + "Z"

# Ensure that only the latitude and longitude variables have
# standard_name attributes equal to "latitude" and "longitude" so that
# the .cf[] accessor works correctly
for var in self.resampled_nc.data_vars:
if self.resampled_nc[var].attrs.get("standard_name") in ["latitude", "longitude"]:
if var in {"latitude", "longitude"}:
continue
self.logger.info("Removing standard_name attribute from variable %s", var)
del self.resampled_nc[var].attrs["standard_name"]

# Common dynamic attributes for all auv platforms
self.metadata["time_coverage_start"] = str(min(self.resampled_nc.time.values))
self.metadata["time_coverage_end"] = str(max(self.resampled_nc.time.values))
Expand Down Expand Up @@ -1050,7 +1061,7 @@ def resample_variable( # noqa: PLR0913
.resample(freq.lower())
.mean()
)
self.df_r[variable].loc[instr_data.index] = instr_data
self.df_r.loc[instr_data.index, variable] = instr_data
else:
self.df_r[variable] = (
self.df_o[f"{variable}_mf"]
Expand Down