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
5 changes: 5 additions & 0 deletions scripts/fix_dois_202512.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
On Dec. 11, 2025, we realized that the DOI for these products was wrong (used
the previous version). This script updates existing nc files to have the correct
DOI in order to avoid data reprocessing.

NOTE/WARNING: if this is ever re-used in the future, remember to update the
output file checksums (`.mnf` files) after. This script does NOT update the
associated checksum file - it just updates the DOI metadata. See the
`regenerate_checksums.py` script.
"""

from pathlib import Path
Expand Down
33 changes: 33 additions & 0 deletions scripts/regenerate_checksums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Code to regenerate checksums of CDR output files.

To run, manually update the `DATA_DIR` to the G02202/G10016 complete output
directory you want updated.
"""

from multiprocessing import Pool
from pathlib import Path

from pm_tb_data._types import Hemisphere

from seaice_ecdr.checksum import write_checksum_file

# DATA_DIR = Path("/share/apps/G10016_V4/v04r00/dev/trst2284/CDR/complete/")
# DATA_DIR = Path("/share/apps/G02202_V6/v06r00_outputs/dev/trst2284/complete")
# DATA_DIR = Path("/share/apps/G10016_V4/v04r00/production/CDR/complete")
DATA_DIR = Path("/share/apps/G02202_V6/v06r00_outputs/production/complete/")


def regenerate_for_hemisphere(hemisphere: Hemisphere):
hemisphere_dir = DATA_DIR / hemisphere
nc_fps = sorted(list(hemisphere_dir.rglob("*.nc")))

# Create associated checksum file.
for nc_fp in nc_fps:
subdir = nc_fp.parent.relative_to(hemisphere_dir)
checksum_dir = hemisphere_dir / "checksums" / subdir
write_checksum_file(input_filepath=nc_fp, output_dir=checksum_dir)


if __name__ == "__main__":
with Pool() as p:
p.map(regenerate_for_hemisphere, ["north", "south"])
Loading