Skip to content

Commit 0fac7b6

Browse files
Fix pickup_to_init.py to remove dangling symlinks before writing
The setup step creates symlinks to /workspace/input/* but the pickup conversion runs in a different container mount (/repo). The init file symlinks are dangling in that context, causing tofile() to fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0194fdd commit 0fac7b6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

spectre_utils/pickup_to_init.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ def pickup_to_init(pickup_prefix: str, output_dir: str, nx: int, ny: int, nr: in
118118
data = data.reshape((nlevels, ny, nx))
119119

120120
# Convert to float32 for init files
121+
# Remove existing symlink if present (setup step creates symlinks
122+
# to input/ which may be dangling in this container context)
121123
init_path = out / init_name
124+
if init_path.is_symlink() or init_path.exists():
125+
init_path.unlink()
122126
data.astype(np.float32).tofile(init_path)
123127
size_mb = init_path.stat().st_size / 1e6
124128
print(f" Wrote {init_path} ({size_mb:.1f} MB)")

0 commit comments

Comments
 (0)