Commit 7f20d0dd authored by Peters, Wouter's avatar Peters, Wouter
Browse files

more inline documentation added

parent 029639e3
......@@ -2,6 +2,23 @@
Cycle Control
======================
The CycleControl class is found in the module :mod:`da.tools.initexit`. It is derived from the standard python :class:`dictionary` object. It is the only core object of CTDAS that is automatically created in the pipeline, the user (normally) does not need to modify or extend it. The class is created based on options and arguments passes on the command line when submitting your main CTDAS job:
The CycleControl class is found in the module :mod:`da.tools.initexit`. It is derived from the standard python :class:`dictionary` object. It is the only core object of CTDAS that is automatically created in the pipeline, the user (normally) does not need to modify or extend it. The class is created based on options and arguments passes on the command line when submitting your main CTDAS job.
Valid options are defined in
.. autofunction:: da.tools.initexit.ParseOptions
and validated by
.. autofunction:: da.tools.initexit.ValidateOptsArgs
With the name of a valid rc-file, the CycleControl object is instantiated and validated
.. autoclass:: da.tools.initexit.CycleControl
:members: LoadRc, ValidateRC
The most important methods of the CycleControl object are:
.. autoclass:: da.tools.initexit.CycleControl
:members: Initialize, ParseTimes, RandomSeed
......@@ -35,13 +35,19 @@ import da.tools.rc as rc
class CycleControl(dict):
"""
Testing
=======
This object controls the CTDAS system flow and functionality.
"""
def __init__(self,opts,args):
def __init__(self,opts=[],args={}):
"""
Initialization occurs from passed options and arguments to the job control script.
The CycleControl object is instantiated with a set of options and arguments.
The list of arguments must contain the name of an existing rc-file.
This rc-file is loaded by method :meth:`~da.tools.initexit.LoadRc` and validated
by :meth:`~da.tools.initexit.ValidateRC`
Options for the CycleControl consist of accepted command line flags or arguments
in :func:`~da.tools.initexit.ParseOptions`
"""
self.LoadRc(args['rc'])
......@@ -90,7 +96,7 @@ class CycleControl(dict):
def ValidateRC(self):
"""
Validate the contents of the rc-file given a dictionary of required keys
Validate the contents of the rc-file given a dictionary of required keys. Currently required keys are :attr:`~da.tools.initexit.needed_da_items`
"""
from da.tools.general import ToDatetime
......@@ -541,7 +547,19 @@ def StartLogger():
datefmt = '%Y-%m-%d %H:%M:%S')
def ParseOptions():
""" Function parses options from the command line and returns the arguments as a dictionary"""
"""
Function parses options from the command line and returns the arguments as a dictionary.
Accepted command line arguments are:
======== =======
Argument Meaning
======== =======
-v verbose output in log files
-h display help
-r start a simulation by recovering from a previous crash
======== =======
"""
import getopt
import sys
......@@ -588,7 +606,11 @@ def ParseOptions():
return opts, arguments
def ValidateOptsArgs(opts,args):
""" Validate the options and arguments passed from the command line before starting the cycle """
"""
Validate the options and arguments passed from the command line before starting the cycle. The validation consists of checking for the presence of an argument "rc", and the existence of
the specified rc-file.
"""
if not args.has_key("rc"):
msg = "There is no rc-file specified on the command line. Please use rc=yourfile.rc" ; logging.error(msg)
......
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