Skip to content

Commit b5ea098

Browse files
author
George Artavanis
committed
Restore restart drv_clmin and renaming of clm.rst files
1 parent c171908 commit b5ea098

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/python/clm_restart_real_data.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,24 @@
204204
if file_path.is_file():
205205
cp(str(file_path), restart_second_dir)
206206

207+
# Rename drv_clmin_restart.dat to drv_clmin.dat for restart
208+
drv_clmin_restart_path = os.path.join(restart_second_dir, "drv_clmin_restart.dat")
209+
drv_clmin_path = os.path.join(restart_second_dir, "drv_clmin.dat")
210+
if os.path.exists(drv_clmin_restart_path):
211+
os.rename(drv_clmin_restart_path, drv_clmin_path)
212+
print(f"Renamed drv_clmin_restart.dat to drv_clmin.dat in restart directory")
213+
207214
# Copy redistributed restart files
208215
for rst_file in glob.glob(os.path.join(new_restart_dir, 'clm.rst.*')):
209216
cp(rst_file, restart_second_dir)
210217

218+
# Rename restart files from timestamp 0 to restart_timestamp (24)
219+
# ParFlow expects restart files with the timestep number when restarting
220+
for rst_file in glob.glob(os.path.join(restart_second_dir, 'clm.rst.00000.*')):
221+
new_name = rst_file.replace('clm.rst.00000.', f'clm.rst.{restart_timestamp:05d}.')
222+
os.rename(rst_file, new_name)
223+
print(f"Renamed {os.path.basename(rst_file)} to {os.path.basename(new_name)}")
224+
211225
# Create second part of restart run from YAML
212226
restart_second_script_path = os.path.join(restart_second_dir, "clm_restart_run.yaml")
213227
restart_second_run = Run.from_definition(restart_second_script_path)

0 commit comments

Comments
 (0)