Commit b9b0e1c5 authored by Peters, Wouter's avatar Peters, Wouter
Browse files

needed access to the rc module

parent 5690ce92
......@@ -378,14 +378,12 @@ class CycleControl(dict):
Prepare a recovery from a crashed run. This consists of:
- copying all data from the restart/one-ago folder (:meth:`~da.tools.initexit.CycleControl.MoveRestartData`),
- replacing all ``rc-file`` items with those from ``da_runtime.rc``
- 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`)
"""
# Move all data from the restart/one-ago directory to the restart/current directory
dummy = self.MoveRestartData(io_option='restore')
import da.tools.rc as rc
import shutil
# Replace rc-items with those from the crashed run's last rc-file (now in restart.current dir)
......@@ -400,6 +398,14 @@ class CycleControl(dict):
msg = "Replaced rc-items.... " ; logging.debug(msg)
msg = "Next cycle start date is %s" % self['time.start'] ; logging.debug(msg)
# Copy randomseed.pickle file to exec dir
source = os.path.join(self['dir.restart.current'],'randomseed.pickle')
dest = os.path.join(self['dir.exec'],'randomseed.pickle')
dummy = shutil.copy(source,dest)
msg = "Replaced randomseed file with previous cycles' last values" ; logging.debug(msg)
return None
def Finalize(self):
......@@ -417,8 +423,8 @@ class CycleControl(dict):
dummy = self.RandomSeed('write')
dummy = self.WriteNewRCfile()
dummy = self.MoveRestartData(io_option='store')
dummy = self.CollectRestartData()
dummy = self.MoveRestartData(io_option='store') # Move restart data from current to one-ago
dummy = self.CollectRestartData() # Collect restart data for next cycle into a clean restart/current folder
dummy = self.SubmitNextCycle()
def CollectRestartData(self):
......@@ -444,6 +450,7 @@ class CycleControl(dict):
reside in a separate folder, i.e, the ObservationOperator does *not* write directly to the CTDAS restart dir!
"""
from da.tools.general import CreateDirs
self.RestartFileList.append( os.path.join(self['dir.output'],'savestate.nc') )
......@@ -526,6 +533,7 @@ class CycleControl(dict):
"""
from da.tools.general import AdvanceTime
import da.tools.rc as rc
# These first two lines advance the filter time for the next cycle
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment