Commit 63a96d60 authored by Peters, Wouter's avatar Peters, Wouter
Browse files

fixes in documentation string, also changed the randomseed file location and...

fixes in documentation string, also changed the randomseed file location and RestartFileList writing
parent a76f0fa7
......@@ -40,7 +40,8 @@ like this:::
The most important method of the CycleControl object are listed below:
.. autoclass:: da.tools.initexit.CycleControl
:members: Initialize, Finalize, SubmitNextCycle, CleanUpCycle, SetupFileStructure, RecoverRun, RandomSeed
:members: Initialize, Finalize, CollectRestartData, MoveRestartData,
SubmitNextCycle, CleanUpCycle, SetupFileStructure, RecoverRun, RandomSeed
Two important attributes of the CycleControl object are:
(1) DaSystem, an instance of a :ref:`dasystem`
......@@ -209,13 +210,13 @@ class CycleControl(dict):
def RandomSeed(self,action='read'):
"""
Get the randomseed and save it, or read the random seed and set it. The seed is currently stored
in a python :mod:`pickle` file, residing in the save directory
in a python :mod:`pickle` file, residing in the ``exec`` directory
"""
import cPickle
import numpy as np
filename = os.path.join(self['dir.restart.current'],'randomseed.pickle')
filename = os.path.join(self['dir.exec'],'randomseed.pickle')
if action == 'write':
f = open(filename,'wb')
......@@ -235,6 +236,11 @@ class CycleControl(dict):
logging.info(msg)
dummy = self.RestartFileList.append(filename)
msg = "Added the randomseed.pickle file to the RestartFileList" ; logging.debug(msg)
return None
def Initialize(self):
......@@ -329,11 +335,11 @@ class CycleControl(dict):
* ``${da_rundir}/restart/current``
* ``${da_rundir}/restart/one-ago``
.. note: The exec dir will actually be a simlink to the directory where
.. note:: The exec dir will actually be a simlink to the directory where
the observation operator executable lives. This directory is passed through
the ``da.rc`` file.
.. note: The observation input files will be placed in the exec dir,
.. note:: The observation input files will be placed in the exec dir,
and the resulting simulated values will be retrieved from there as well.
"""
......@@ -421,7 +427,7 @@ class CycleControl(dict):
attribute "RestartFileList" which is a simple list of files that can be appended by other objects/methods that
require restart data to be saved.
.. note: Before collecting the files in the ``RestartFileList``, the restart/current directory will be emptied and
.. note:: Before collecting the files in the ``RestartFileList``, the restart/current directory will be emptied and
recreated. This prevents files from accumulating in the restart/current and restart/one-ago folders. It
also means that if a file is missing from the ``RestartFileList``, it will not be available for check-pointing
if your run crashes or dies!
......@@ -429,17 +435,17 @@ class CycleControl(dict):
Currently, the following files are included:
* The ``da_runtime.rc`` file
* The ``randomseed.pickle`` file
* The savestate.nc file
* The files in the ``ObservationOperator.RestartFileList``, i.e., restart data for the transport model
.. note: We assume that the restart files for the :class:`~da.baseclasses.observationoprator.ObservationOperator`
reside in a separate folder, i.e, the ObservationOperator does *not* write directly to the restart dir!
.. note:: We assume that the restart files for the :class:`~da.baseclasses.observationoperator.ObservationOperator`
reside in a separate folder, i.e, the ObservationOperator does *not* write directly to the CTDAS restart dir!
"""
self.RestartFileList.append( os.path.join(self['dir.exec'],'da_runtime.rc') )
self.RestartFileList.append( os.path.join(self['dir.output'],'savestate.nc') )
#self.RestartFileList.append( os.path.join(self['dir.exec'],'randomseed.pickle') )
targetdir = os.path.join(self['dir.restart.current'])
......@@ -461,8 +467,6 @@ class CycleControl(dict):
def MoveRestartData(self, io_option='restore'):
"""
:
Store or restore model state to/from a restart directory.
Two IO options are available:
......@@ -513,10 +517,12 @@ class CycleControl(dict):
#
def WriteNewRCfile(self):
""" Write the rc-file for the next DA cycle. Note that the start time for the next cycle is the end time of this one, while
the end time for the next cycle is the current end time + one cycle length. The resulting rc-file is written to:
(1) to the dir.exec so that it can be used when resubmitting the next cycle
""" Write the rc-file for the next DA cycle.
.. note:: The start time for the next cycle is the end time of this one, while
the end time for the next cycle is the current end time + one cycle length.
The resulting rc-file is written to the ``dir.exec`` so that it can be used when resubmitting the next cycle
"""
from da.tools.general import AdvanceTime
......@@ -533,10 +539,13 @@ class CycleControl(dict):
#self['time.finish'] = self['time.finish'].strftime('%Y-%m-%d %H:%M:%S')
fname = os.path.join(self['dir.exec'],'da_runtime.rc')
self['da.restart.fname'] = fname
self['da.restart.fname'] = fname
dummy = rc.write(fname,self)
msg = 'Wrote new da_runtime.rc (%s)'%fname ; logging.debug(msg)
dummy = self.RestartFileList.append(fname)
msg = 'Added da_runtime.rc to the RestartFileList for later collection' ; logging.debug(msg)
msg = 'Wrote new da_runtime.rc (%s) to exec dir'%fname ; logging.debug(msg)
def WriteRC(self,fname):
......
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