Skip to content

Commit

Permalink
rename quicker
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 3, 2022
1 parent e6f8a7b commit 7d0cc3d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions satip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,14 @@ def collate_files_into_latest(save_dir: str, using_backup: bool = False):
)
save_to_zarr_to_s3(dataset, f"{save_dir}/latest/hrv_tmp.zarr.zip")

# rename
logger.debug("Renaming")
filesystem = fsspec.open(f"{save_dir}/latest/hrv_tmp.zarr.zip").fs
filesystem.mv(
f"{save_dir}/latest/hrv_tmp.zarr.zip",
f"{save_dir}/latest/hrv_latest{'_15' if using_backup else ''}.zarr.zip",
)

logger.debug("Collating non-HRV files")
nonhrv_files = list(
filesystem.glob(f"{save_dir}/latest/{'15_' if using_backup else ''}2*.zarr.zip")
Expand All @@ -1079,14 +1087,7 @@ def collate_files_into_latest(save_dir: str, using_backup: bool = False):
)
save_to_zarr_to_s3(o_dataset, f"{save_dir}/latest/tmp.zarr.zip")

# rename
logger.debug("Renaming")
filesystem = fsspec.open(f"{save_dir}/latest/hrv_tmp.zarr.zip").fs
filesystem.mv(
f"{save_dir}/latest/hrv_tmp.zarr.zip",
f"{save_dir}/latest/hrv_latest{'_15' if using_backup else ''}.zarr.zip",
)
logger.info(f"Collating HRV into {save_dir}/latest/hrv_latest.zarr.zip")
filesystem = fsspec.open(f"{save_dir}/latest/tmp.zarr.zip").fs
filesystem.mv(
f"{save_dir}/latest/tmp.zarr.zip",
Expand Down

0 comments on commit 7d0cc3d

Please sign in to comment.