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

changed DaCycle object

parent aa03788f
Branches
No related tags found
No related merge requests found
......@@ -89,32 +89,32 @@ class TM5ObservationOperator(ObservationOperator):
"""
from da.tools.general import CreateLinks
RcFileName = DaCycle.da_settings['forecast.model.rc']
RcFileName = DaCycle['forecast.model.rc']
dummy = self.LoadRc(RcFileName) # load the specified rc-file
dummy = self.ValidateRc() # validate the contents
# Create a link from TM5 to the rundirectory of the das system
sourcedir = self.tm_settings['rundir']
targetdir = os.path.join(DaCycle.da_settings['dir.exec'],'tm5')
targetdir = os.path.join(DaCycle['dir.exec'],'tm5')
dummy = CreateLinks(sourcedir,targetdir)
DaCycle.da_settings['dir.exec.tm5'] = targetdir
DaCycle['dir.exec.tm5'] = targetdir
# Write a modified TM5 model rc-file in which run/break times are defined by our da system
NewItems = {
'time.start' : DaCycle.da_settings['time.sample.start'] ,
'time.final' : DaCycle.da_settings['time.sample.end'] ,
'rundir' : DaCycle.da_settings['dir.exec.tm5'] ,
'outputdir' : DaCycle.da_settings['dir.output'] ,
'savedir' : DaCycle.da_settings['dir.save'] ,
'das.input.dir' : DaCycle.da_settings['dir.input']
'time.start' : DaCycle['time.sample.start'] ,
'time.final' : DaCycle['time.sample.end'] ,
'rundir' : DaCycle['dir.exec.tm5'] ,
'outputdir' : DaCycle['dir.output'] ,
'savedir' : DaCycle['dir.save'] ,
'das.input.dir' : DaCycle['dir.input']
}
if DaCycle.da_settings['time.restart']: # If this is a restart from a previous cycle, the TM5 model should do a restart
if DaCycle['time.restart']: # If this is a restart from a previous cycle, the TM5 model should do a restart
NewItems['istart'] = 3
if DaCycle.da_settings['time.sample.window'] != 0: # If this is a restart from a previous time step wihtin the filter lag, the TM5 model should do a restart
if DaCycle['time.sample.window'] != 0: # If this is a restart from a previous time step wihtin the filter lag, the TM5 model should do a restart
NewItems['istart'] = 3
# If neither one is true, simply take the istart value from the tm5.rc file that was read
......@@ -127,7 +127,7 @@ class TM5ObservationOperator(ObservationOperator):
# Copy the pre-compiled MPI wrapper to the execution directory
targetdir = os.path.join(DaCycle.da_settings['dir.exec.tm5'])
targetdir = os.path.join(DaCycle['dir.exec.tm5'])
if not os.path.exists(os.path.join(mpi_shell_location,mpi_shell_filename) ):
msg = "Cannot find the mpi_shell wrapper needed for completion (%s) in (%s)"% (mpi_shell_filename,mpi_shell_location) ; logging.error(msg)
......@@ -270,14 +270,14 @@ class TM5ObservationOperator(ObservationOperator):
datafiles = os.listdir(datadir)
obsfile = DaCycle.da_settings['ObsOperator.inputfile']
obsfile = DaCycle['ObsOperator.inputfile']
if not os.path.exists(obsfile):
msg = "The specified obs input file for the TM5 model to read from does not exist (%s), exiting..."%obsfile ; logging.error(msg)
raise IOError,msg
for n in range(int(DaCycle.da_settings['forecast.nmembers'])):
for n in range(int(DaCycle['forecast.nmembers'])):
paramfile = 'parameters.%03d.nc'%n
if paramfile not in datafiles:
msg = "The specified parameter input file for the TM5 model to read from does not exist (%s), exiting..."%paramfile ; logging.error(msg)
......@@ -357,11 +357,11 @@ class TM5ObservationOperator(ObservationOperator):
if os.path.exists(okfile):
dummy = os.remove(okfile)
nprocesses = DaCycle.da_settings['forecast.nmembers']
nprocesses = DaCycle['forecast.nmembers']
jobparams = {'jobname':'tm5',
'jobnodes':'ncomp %d'%int(nprocesses),
'jobtime':'00:30:00',
'joblog':os.path.join(DaCycle.da_settings['dir.jobs'])
'joblog':os.path.join(DaCycle['dir.jobs'])
}
template = DaPlatForm.GetJobTemplate(jobparams,block=True)
......@@ -445,9 +445,9 @@ if __name__ == "__main__":
DaCycle = JobStart([],{'rc':'da.rc'})
DaCycle.Initialize()
DaCycle.da_settings['time.sample.start'] = dtm.datetime(2000,1,1)
DaCycle.da_settings['time.sample.end'] = dtm.datetime(2000,1,2)
DaCycle.da_settings['time.sample.window'] = 0
DaCycle['time.sample.start'] = dtm.datetime(2000,1,1)
DaCycle['time.sample.end'] = dtm.datetime(2000,1,2)
DaCycle['time.sample.window'] = 0
tm=TM5ObservationOperator()
tm.Initialize(DaCycle)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment