We focus on the first lines first:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
Handling the actions is done by python, a general purpose programming language. First, the import statements add functionality to python, like OptionParser. This functionality os then used to process the call. Notice that python is object-oriented, so the object parser is created, and operations can be performed upon it.
Important functionality comes from the module rc. In fact, I found out that the module rc has to be present in your PYTHONPATH. On my system, I can use ipython and type:
import rc
rc?
And I see:
Type: module
String Form:<module 'rc' from '/home/sbasu/pythonpackages/lib/python2.7/site-packages/rc.pyc'>
File: /home/sbasu/pythonpackages/lib/python2.7/site-packages/rc.py
Docstring:
Deal with model settings in `rc` format.
RCFILES
A rcfile is a text file with key/value pairs seperated by a ':', e.g.
my.flag : T
my.answer : 42
After parsing the header, the python-script assigns our .rc file to the environment variable pyshell.rc. Thus, all options are set (and can be read) in the file rc/rc/nam1x1-dummy_tr.rc.
The next thing that is done, is that the search path is extended, such that extra functionality can be added. I guess that the order in which this is done is important. I expect that these values are thus set in the .rc file, so lets have a look:
! common folders for this tree
#include include/folders.rc
! common job characteristics
#include include/jobs.rc
! variables unique to this run
my.project : test_project
my.runmode : 1 ! 1 for RUN_FORWARD, 2 for RUN_BACKWARD
par.openmp : True
......etc.....
No keys like my.home, my.tm5.base, my.proj.root. I appears that (for readability) these settings are in #include statements, as you see. Indeed, the needed keys are found in include/folders.rc.
Lets browse further down in the run_fwd.py:
1 2 3 4 5 6 7 8 9 | |
This means that the supplied dates are turned into python variables and a RunTM5 object r is created with the start and end times as arguments. Further down in the script we see that such a RunTM5 object has so-called methods that can operate on it. That makes it very convenient, also to run it interactively using ipython.
1 2 3 4 5 6 7 8 9 10 | |
Time for Sourish to explain the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
[How the general use of Emission class is organized]
Now lest move on and look a the output generated by r.SetupEmissions(Emission)
Wiki: A guide to run with hurdles
Wiki: Home
Wiki: How the general use of Emission class is organized
Wiki: SetupEmissions