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
10 changes: 5 additions & 5 deletions src/data/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ def process_cal(self) -> Path: # noqa: C901, PLR0912, PLR0915
"""Process calibrated netCDF file using instance attributes."""
if self.mission and self.auv_name:
netcdfs_dir = Path(self.base_path, self.auv_name, MISSIONNETCDFS, self.mission)
src_file = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_cal.nc")
src_file = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_cal.nc4")
elif self.log_file:
netcdfs_dir = Path(BASE_LRAUV_PATH, f"{Path(self.log_file).parent}")
src_file = Path(netcdfs_dir, f"{Path(self.log_file).stem}_cal.nc")
src_file = Path(netcdfs_dir, f"{Path(self.log_file).stem}_cal.nc4")
else:
msg = "Must provide either mission and vehicle or log_file"
raise ValueError(msg)
Expand Down Expand Up @@ -712,9 +712,9 @@ def write_combined_netcdf(self, netcdfs_dir: Path) -> None:
"""Write aligned combined data to NetCDF file"""
if self.log_file:
# For LRAUV log files, use the log file stem for output name
out_fn = Path(netcdfs_dir, f"{Path(self.log_file).stem}_align.nc")
out_fn = Path(netcdfs_dir, f"{Path(self.log_file).stem}_align.nc4")
else:
out_fn = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_align.nc")
out_fn = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_align.nc4")

self.aligned_nc.attrs = self.global_metadata()
self.logger.info("Writing aligned combined data to %s", out_fn)
Expand All @@ -730,7 +730,7 @@ def write_combined_netcdf(self, netcdfs_dir: Path) -> None:
def write_netcdf(self, netcdfs_dir: Path) -> None:
"""Write aligned netCDF file using instance attributes."""
self.aligned_nc.attrs = self.global_metadata()
out_fn = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_align.nc")
out_fn = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_align.nc4")
self.logger.info("Writing aligned data to %s", out_fn)
if out_fn.exists():
self.logger.debug("Removing file %s", out_fn)
Expand Down
2 changes: 1 addition & 1 deletion src/data/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3297,7 +3297,7 @@ def _process(self, sensor, logs_dir, netcdfs_dir): # noqa: C901, PLR0912
def write_netcdf(self, netcdfs_dir: Path) -> None:
"""Write calibrated netCDF file using instance attributes."""
self.combined_nc.attrs = self.global_metadata()
out_fn = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_cal.nc")
out_fn = Path(netcdfs_dir, f"{self.auv_name}_{self.mission}_cal.nc4")
self.logger.info("Writing calibrated instrument data to %s", out_fn)
if Path(out_fn).exists():
Path(out_fn).unlink()
Expand Down
4 changes: 2 additions & 2 deletions src/data/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,10 @@ def resample(self, mission: str = "", log_file: str = "") -> None:
)
resamp.logger.setLevel(self._log_levels[self.config["verbose"]])
resamp.logger.addHandler(self.log_handler)
file_name = f"{resamp.auv_name}_{resamp.mission}_align.nc"
file_name = f"{resamp.auv_name}_{resamp.mission}_align.nc4"
if resamp.log_file:
netcdfs_dir = Path(BASE_LRAUV_PATH, Path(resamp.log_file).parent)
nc_file = Path(netcdfs_dir, f"{Path(resamp.log_file).stem}_align.nc")
nc_file = Path(netcdfs_dir, f"{Path(resamp.log_file).stem}_align.nc4")
else:
nc_file = Path(
self.config["base_path"],
Expand Down
8 changes: 4 additions & 4 deletions src/data/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def resample_coordinates(self, instr: str, mf_width: int, freq: str) -> None:
if self.log_file:
msg = f"A CTD depth was not found in {self.ds.encoding['source']}"
else:
msg = f"{instr}_depth not found in {self.auv_name}_{self.mission}_align.nc"
msg = f"{instr}_depth not found in {self.auv_name}_{self.mission}_align.nc4"
raise InvalidAlignFile(msg) from None
try:
self.df_o[f"{instr}_latitude"] = self.ds[f"{instr}_latitude"].to_pandas()
Expand Down Expand Up @@ -1831,7 +1831,7 @@ def resample_mission( # noqa: C901, PLR0912, PLR0915, PLR0913
"standard_name": "time",
"long_name": "Time (UTC)",
}
out_fn = str(nc_file).replace("_align.nc", f"_{freq}.nc")
out_fn = str(nc_file).replace("_align.nc4", f"_{freq}.nc")
if self.flash_threshold and self.flash_threshold != FLASH_THRESHOLD:
# Append flash_threshold to output filename
ft_ending = f"_ft{self.flash_threshold:.0E}.nc".replace("E+", "E")
Expand Down Expand Up @@ -1899,9 +1899,9 @@ def process_command_line(self):
resamp.process_command_line()
if resamp.args.log_file:
netcdfs_dir = Path(BASE_LRAUV_PATH, f"{Path(resamp.args.log_file).parent}")
nc_file = Path(netcdfs_dir, f"{Path(resamp.args.log_file).stem}_align.nc")
nc_file = Path(netcdfs_dir, f"{Path(resamp.args.log_file).stem}_align.nc4")
else:
file_name = f"{resamp.args.auv_name}_{resamp.args.mission}_align.nc"
file_name = f"{resamp.args.auv_name}_{resamp.args.mission}_align.nc4"
nc_file = Path(
BASE_PATH,
resamp.args.auv_name,
Expand Down
12 changes: 6 additions & 6 deletions src/data/test_process_dorado.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def test_process_dorado(complete_dorado_processing):
# but it will alert us if a code change unexpectedly changes the file size.
# If code changes are expected to change the file size then we should
# update the expected size here.
EXPECTED_SIZE_GITHUB = 621404
EXPECTED_SIZE_ACT = 621402
EXPECTED_SIZE_LOCAL = 621452
EXPECTED_SIZE_GITHUB = 621408
EXPECTED_SIZE_ACT = 621406
EXPECTED_SIZE_LOCAL = 621456
if str(proc.args.base_path).startswith("/home/runner"):
# The size is different in GitHub Actions, maybe due to different metadata
assert nc_file.stat().st_size == EXPECTED_SIZE_GITHUB # noqa: S101
Expand All @@ -50,9 +50,9 @@ def test_process_dorado(complete_dorado_processing):
check_md5 = True
if check_md5:
# Check that the MD5 hash has not changed
EXPECTED_MD5_GITHUB = "3bab0300e575c1d752a35f49e49e340e"
EXPECTED_MD5_ACT = "bb1d539284bee531a00c4d4d99580bf0"
EXPECTED_MD5_LOCAL = "9137be5a2ed840cfca94a723285355ec"
EXPECTED_MD5_GITHUB = "7c7a3e844988d3bb6ec2a951824bc0d5"
EXPECTED_MD5_ACT = "fac632c321b4956b6015d6de97958f8a"
EXPECTED_MD5_LOCAL = "c4a13d6e7ec7f35ae5aafa97ea9a2279"
if str(proc.args.base_path).startswith("/home/runner"):
# The MD5 hash is different in GitHub Actions, maybe due to different metadata
assert hashlib.md5(open(nc_file, "rb").read()).hexdigest() == EXPECTED_MD5_GITHUB # noqa: PTH123, S101, S324, SIM115
Expand Down
6 changes: 3 additions & 3 deletions src/data/test_process_i2map.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def test_process_i2map(complete_i2map_processing):
# but it will alert us if a code change unexpectedly changes the file size.
# If code changes are expected to change the file size then we should
# update the expected size here.
EXPECTED_SIZE_GITHUB = 52682
EXPECTED_SIZE_ACT = 52652
EXPECTED_SIZE_LOCAL = 52782
EXPECTED_SIZE_GITHUB = 52686
EXPECTED_SIZE_ACT = 52656
EXPECTED_SIZE_LOCAL = 52786
if str(proc.args.base_path).startswith("/home/runner"):
# The size is different in GitHub Actions, maybe due to different metadata
assert nc_file.stat().st_size == EXPECTED_SIZE_GITHUB # noqa: S101
Expand Down