Skip to content
Snippets Groups Projects
Commit d270e779 authored by Peters, Wouter's avatar Peters, Wouter
Browse files

The code now compiles itself on a clean start, and then proceeds with the rest...

The code now compiles itself on a clean start, and then proceeds with the rest of CTDAS. The name of the tm5 rcfile is modified
to reflect the new name and location (something like ${rundir}/tm5-tm5-ctdas-base.x). This file will be read, modified, and rewritten
in each sample step of CTDAS. This file already contains a proper submit.command key which can be used to submit TM5 runs automatically, he script then handles the details of the queue system etcetera.

To Do:

- modify the Run() routines to use submit_tm5 (Ivar)
- modify the PrepareRun() routine to make sure all needed keys are replaced in the tm5.rc file
    - such as the submit.option : -s !!!
- test for multiple cycles
- test with a restart option to check logic of compiling


parent 8574e546
No related branches found
No related tags found
No related merge requests found
...@@ -103,12 +103,30 @@ class TM5ObservationOperator(ObservationOperator): ...@@ -103,12 +103,30 @@ class TM5ObservationOperator(ObservationOperator):
tm5compiledir = self.tm_settings[self.rundirkey] tm5compiledir = self.tm_settings[self.rundirkey]
dummy = CreateDirs(tm5compiledir) dummy = CreateDirs(tm5compiledir)
self.RcFileName = self.WriteRc() rcfilename = os.path.join(tm5compiledir,'tm5_setup_init.rc')
dummy = self.WriteRc(rcfilename)
self.RcFileName = rcfilename
# Compile TM5 in the new directory, but only if this is a fresh start # Compile TM5 in the new directory, but only if this is a fresh start
self.CompileTM5() self.CompileTM5()
# Replace the rc filename for TM5 with the newly created one in the new run directory
workingcopytm5rc = os.path.join(self.tm_settings['rundir'], self.tm_settings['install.rc'] )
self.RcFileName = workingcopytm5rc
msg = 'Working copy of the tm5.rc file is in place (%s) '%workingcopytm5rc ; logging.debug(msg)
# And also replace the path to the ObservationOperator in the DaCycle object so we can work from the TM5 copy from here on
self.DaCycle['obs.operator.rc'] = workingcopytm5rc
self.DaCycle['dir.exec.tm5'] = self.tm_settings[self.rundirkey]
msg = '...and set as the da.obsoperator.rc value in this DaCycle '; logging.debug(msg)
return 0 return 0
def CompileTM5(self): def CompileTM5(self):
...@@ -154,10 +172,9 @@ class TM5ObservationOperator(ObservationOperator): ...@@ -154,10 +172,9 @@ class TM5ObservationOperator(ObservationOperator):
""" """
Prepare a forward model TM5 run, this consists of: Prepare a forward model TM5 run, this consists of:
- reading the TM5 rc-file, - reading the working copy TM5 rc-file,
- validating it, - validating it,
- modifying the values, - modifying the values,
- Creating a tm5_runtime.rc file
- Removing the existing tm5.ok file if present - Removing the existing tm5.ok file if present
""" """
...@@ -169,15 +186,6 @@ class TM5ObservationOperator(ObservationOperator): ...@@ -169,15 +186,6 @@ class TM5ObservationOperator(ObservationOperator):
dummy = self.ValidateRc() # validate the contents dummy = self.ValidateRc() # validate the contents
# Create a link from TM5 to the rundirectory of the das system
sourcedir = self.tm_settings[self.rundirkey]
targetdir = os.path.join(self.DaCycle['dir.exec'],'tm5')
dummy = CreateLinks(sourcedir,targetdir)
self.outputdir = self.tm_settings[self.outputdirkey]
self.DaCycle['dir.exec.tm5'] = targetdir
# Write a modified TM5 model rc-file in which run/break times are defined by our da system # Write a modified TM5 model rc-file in which run/break times are defined by our da system
NewItems = { NewItems = {
...@@ -199,10 +207,7 @@ class TM5ObservationOperator(ObservationOperator): ...@@ -199,10 +207,7 @@ class TM5ObservationOperator(ObservationOperator):
self.ModifyRC(NewItems) self.ModifyRC(NewItems)
newrcfile = self.WriteRc() dummy = self.WriteRc(self.RcFileName)
#self.WriteRunRc() No longer needed with pycasso !
return 0 return 0
...@@ -324,19 +329,17 @@ class TM5ObservationOperator(ObservationOperator): ...@@ -324,19 +329,17 @@ class TM5ObservationOperator(ObservationOperator):
logging.debug('Added new tm5 rc-item %s ' % k) logging.debug('Added new tm5 rc-item %s ' % k)
def WriteRc(self): def WriteRc(self,tm5rcfilename):
""" """
Write the rc-file settings to a tm5.rc file in the rundir Write the rc-file settings to a tm5.rc file in the rundir
""" """
import da.tools.rc as rc import da.tools.rc as rc
tm5rcfilename = os.path.join(self.tm_settings[self.rundirkey],'tm5_ctdas_setup.rc')
dummy = rc.write(tm5rcfilename,self.tm_settings) dummy = rc.write(tm5rcfilename,self.tm_settings)
msg = "Modified rc file for TM5 written (%s)" % tm5rcfilename ;logging.debug(msg) msg = "Modified rc file for TM5 written (%s)" % tm5rcfilename ;logging.debug(msg)
return tm5rcfilename return None
def WriteRunRc(self): def WriteRunRc(self):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment