@@ -190,10 +182,10 @@ class TM5ObservationOperator(ObservationOperator):
}
ifself.DaCycle['time.restart']:# If this is a restart from a previous cycle, the TM5 model should do a restart
NewItems[self.istartkey]=self.restartvalue
NewItems['istart']=self.restartvalue
logging.debug('Resetting TM5 to perform restart')
else:
NewItems[self.istartkey]=self.coldstartvalue# if not, start TM5 'cold'
NewItems['istart']=self.coldstartvalue# if not, start TM5 'cold'
logging.debug('Resetting TM5 to perform cold start')
#LU to ponizej: po prostu jesli to jest inny lag niz pierwszy
#LU czyli: restart wtedy kiedy albo time.restart = true czyli w kazdym nastepnym cyklu, albo kiedy jest to nie pierwszy step w sample step. tylko wtedy to skad robimy restart sie rozni...czy nie , bo robimy po advance?
...
...
@@ -201,7 +193,7 @@ class TM5ObservationOperator(ObservationOperator):
#LU ale: nowy RC zapisywany jst przy koncu cyklu. czyli time. sample.window bedzie zawsze 0.
ifself.DaCycle['time.sample.window']!=0:# If this is a restart from a previous time step within the filter lag, the TM5 model should do a restart
NewItems[self.istartkey]=self.restartvalue
NewItems['istart']=self.restartvalue
logging.debug('Resetting TM5 to perform restart')
# If neither one is true, simply take the istart value from the tm5.rc file that was read
...
...
@@ -209,20 +201,16 @@ class TM5ObservationOperator(ObservationOperator):
self.modify_rc(NewItems)
self.write_rc(self.RcFileName)
defload_rc(self,RcFileName):#LU tutaj bylo wczesniej rcfIletype. to znaczy ze pewnie zawsze bylo pycasso. bo wpp byloby blad.
defload_rc(self,name):#LU tutaj bylo wczesniej rcfIletype. to znaczy ze pewnie zawsze bylo pycasso. bo wpp byloby blad.
"""
This method loads a TM5 rc-file with settings for this simulation
"""
importda.tools.rcnasrc
self.rcfile=rc.RcFile(RcFileName)
self.rcfile=rc.RcFile(name)
self.tm_settings=self.rcfile.values
self.RcFileName=RcFileName
self.Tm5RcLoaded=True#LU to wyglada na zupelnie niepotrzebne
if'my.source.dirs'inself.tm_settings.keys():
self.RcFileType='pycasso'
else:
self.RcFileType='pre-pycasso'
self.RcFileName=name
logging.debug('TM5 rc-file loaded successfully')
defvalidate_rc(self):
...
...
@@ -230,40 +218,18 @@ class TM5ObservationOperator(ObservationOperator):
Validate the contents of the tm_settings dictionary and add extra values. The required items for the TM5 rc-file
are specified in the tm5_tools module, as dictionary variable "needed_rc_items".
"""
ifself.RcFileType=='pycasso':
self.projectkey='my.project.dir'
self.rundirkey='my.run.dir'
self.outputdirkey='output.dir'
self.savedirkey='restart.write.dir'
self.timestartkey='timerange.start'
self.timefinalkey='timerange.end'
self.timelengthkey='jobstep.length'
self.istartkey='istart'
self.restartvalue=33
self.coldstartvalue=9
else:
self.projectkey='runid'
self.rundirkey='rundir'
self.outputdirkey='outputdir'
self.savedirkey='savedir'
self.timestartkey='time.start'
self.timefinalkey='time.final'
self.timelengthkey='time.break.nday'
self.istartkey='istart'
self.restartvalue=3
self.coldstartvalue=9
self.restartvalue=33
self.coldstartvalue=9
needed_rc_items=[
self.projectkey,
self.rundirkey,
self.outputdirkey,
self.savedirkey,
self.timestartkey,
self.timefinalkey,
self.timelengthkey,
self.istartkey
'my.project.dir',
'my.run.dir',
'output.dir',
'restart.write.dir',
'timerange.start',
'timerange.end',
'jobstep.length',
'istart'
]
fork,vinself.tm_settings.iteritems():
...
...
@@ -280,7 +246,6 @@ class TM5ObservationOperator(ObservationOperator):
self.tm_settings[k]=to_datetime(v)
forkeyinneeded_rc_items:
ifnotself.tm_settings.has_key(key):
msg='Missing a required value in rc-file : %s'%key
logging.error(msg)
...
...
@@ -357,12 +322,10 @@ class TM5ObservationOperator(ObservationOperator):
# Next, make sure there is an actual model version compiled and ready to execute