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

changed DaCycle object

parent 8ccc8c43
......@@ -245,9 +245,9 @@ if __name__ == "__main__":
nobs = len(samples.Data)
dims = ( int(DaCycle.da_settings['time.nlag']),
int(DaCycle.da_settings['forecast.nmembers']),
int(DaCycle.DaSystem.da_settings['nparameters']),
dims = ( int(DaCycle['time.nlag']),
int(DaCycle['forecast.nmembers']),
int(DaCycle.DaSystem['nparameters']),
nobs, )
opt = CtOptimizer(dims)
......
......@@ -69,7 +69,7 @@ class PlatForm(object):
#
# Done, write jobfile
#
targetdir = os.path.join(DaCycle.da_settings['dir.exec'])
targetdir = os.path.join(DaCycle['dir.exec'])
jobfile = os.path.join(targetdir,'jb.%s.jb'%jobid)
f = open(jobfile,'w')
dummy = f.write(template)
......
......@@ -22,6 +22,18 @@ class CtDaSystem(DaSystem):
""" Information on the data assimilation system used. This is normally an rc-file with settings.
"""
def Initialize(self):
"""
Initialize the object
"""
import Nio
mapfile = os.path.join(self['datadir'],self['regionsfile'])
ncf = Nio.open_file(mapfile,'r')
self.regionmap = ncf.variables['budget_region'].get_value()
dummy = ncf.close()
def Validate(self):
"""
Validate the contents of the rc-file given a dictionary of required keys
......@@ -36,13 +48,13 @@ class CtDaSystem(DaSystem):
'regtype']
for k,v in self.da_settings.iteritems():
if v == 'True' : self.da_settings[k] = True
if v == 'False': self.da_settings[k] = False
for k,v in self.iteritems():
if v == 'True' : self[k] = True
if v == 'False': self[k] = False
for key in needed_rc_items:
if not self.da_settings.has_key(key):
if not self.has_key(key):
status,msg = ( False,'Missing a required value in rc-file : %s' % key)
logging.error(msg)
raise IOError,msg
......
......@@ -90,9 +90,9 @@ if __name__ == "__main__":
opt = CtOptimizer()
nobs = 100
dims = ( int(DaCycle.da_settings['time.nlag']),
int(DaCycle.da_settings['forecast.nmembers']),
int(DaCycle.DaSystem.da_settings['nparameters']),
dims = ( int(DaCycle['time.nlag']),
int(DaCycle['forecast.nmembers']),
int(DaCycle.DaSystem['nparameters']),
nobs, )
opt.Initialize(dims)
......
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