From 7cc70ba6894131073b6ac39bd87447de9bd7f639 Mon Sep 17 00:00:00 2001
From: Wouter Peters <wouter.peters@wur.nl>
Date: Fri, 11 Feb 2011 16:36:04 +0000
Subject: [PATCH] outputdir needs name change after recover from crash

---
 da/tools/initexit.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/da/tools/initexit.py b/da/tools/initexit.py
index 56a0e0a..d4367f2 100755
--- a/da/tools/initexit.py
+++ b/da/tools/initexit.py
@@ -381,10 +381,12 @@ class CycleControl(dict):
             - copying all data from the restart/one-ago folder (:meth:`~da.tools.initexit.CycleControl.MoveRestartData`),
             - replacing all ``rc-file`` items with those from the ``da_runtime.rc`` in the restart/current dir 
             - resetting the seed of the random number generator to the value it had before the crash (:meth:`~da.tools.initexit.CycleControl.RandomSeed`)
+            - replacing the output dir name, since it has the sample time in it...
             
         """
         import da.tools.rc as rc
         import shutil
+        from da.tools.general import CreateDirs
 
         # Replace rc-items with those from the crashed run's last rc-file (now in restart.current dir)
 
@@ -407,6 +409,12 @@ class CycleControl(dict):
 
         msg           = "Replaced randomseed file with previous cycles' last values"          ; logging.debug(msg)
 
+        # Re-create the output dir for this time step, if needed
+
+        filtertime  = self['time.start'].strftime('%Y%m%d')
+        self['dir.output']      = os.path.join(self['dir.da_run'],'output',filtertime)
+        CreateDirs(os.path.join(self['dir.output']))
+
         return None
 
     def Finalize(self):
-- 
GitLab