Skip to contents

Finds the restart.out files in a PEcAn run directory, copies the last restart from each run to the specified output directory, and renames by site and ensemble ID. This is useful when taking final state from one simulation as the starting point for another one (e.g. forecasts that start from a current-observations run).

Usage

collect_restarts(run_dir, dest_dir, overwrite = FALSE)

Arguments

run_dir

path to the run directory of a PEcAn workflow. This should be the directory listed in the workflow's settings$rundir; by convention this often ends in output/run/

dest_dir

directory to which to copy one restart file per model run

overwrite

logical: Replace existing destination files?

Value

Invisibly, a character vector of the filenames created in dest_dir.

Details

Paths look like either ENS-00001-131976/restart.out (in runs that are all one segment) or ENS-00004-131975/segments/segment_011/run/restart.out (in segmented runs). Segmented runs will have a restart.out for each segment, in which case we take the restart from the last segment in the run. (Well, technically the one whose path sorts last, with our confidence that this is also chonologically last coming from the segment numbering system).

On copying, files are renamed by site ID and ensemble member. Segment number is not retained. Thus the examples shown above would respectively become <dest_dir>/restart-131976-00001.out and <dest_dir>/restart-131975-00004.out.

Author

Chris Black