File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
208215for 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
212226restart_second_script_path = os .path .join (restart_second_dir , "clm_restart_run.yaml" )
213227restart_second_run = Run .from_definition (restart_second_script_path )
You can’t perform that action at this time.
0 commit comments