Copy final model state from all sites in a completed PEcAn workflow
Source:R/collect_restarts.R
collect_restarts.RdFinds 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).
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.