diff --git a/da.rc b/da.rc index 1bde709f6c60615521c00f34ddff8ce0fdc88a08..75aeeba1d55f8403ee46b69bf16cbdd2483375a6 100644 --- a/da.rc +++ b/da.rc @@ -11,6 +11,7 @@ dir.da_run : ${HOME}/tmp/test_da da.system : CarbonTracker da.system.rc : carbontracker.rc +da.platform : maunaloa ! Info on the forward model to be used diff --git a/da/baseclasses/dasystem.py b/da/baseclasses/dasystem.py index fa793538ccf4cffa10a143d62c3658f1a9ddfa61..a3c87fdff1ad8e73eebf82106c8e57570abb7816 100755 --- a/da/baseclasses/dasystem.py +++ b/da/baseclasses/dasystem.py @@ -54,11 +54,13 @@ class DaSystem(object): return True - def Validate(self, needed_rc_items): + def Validate(self ): """ Validate the contents of the rc-file given a dictionary of required keys """ + needed_rc_items={} + for k,v in self.da_settings.iteritems(): if v == 'True' : self.da_settings[k] = True if v == 'False': self.da_settings[k] = False diff --git a/da/ct/dasystem.py b/da/ct/dasystem.py index fa793538ccf4cffa10a143d62c3658f1a9ddfa61..8a330f05faeb5ef7210569ef44ef3fc7d31e7496 100755 --- a/da/ct/dasystem.py +++ b/da/ct/dasystem.py @@ -14,51 +14,28 @@ import sys import logging import datetime -################### Begin Class DaSystem ################### +################### Begin Class CtDaSystem ################### -class DaSystem(object): +from da.baseclasses.dasystem import DaSystem + +class CtDaSystem(DaSystem): """ Information on the data assimilation system used. This is normally an rc-file with settings. """ - def __init__(self,rcfilename): - """ - Initialization occurs from passed rc-file name - """ - - self.LoadRc(rcfilename) - - def __str__(self): - """ - String representation of a DaInfo object - """ - - msg = "===============================================================" ; print msg - msg = "DA System Info rc-file is %s" % self.RcFileName ; print msg - msg = "===============================================================" ; print msg - - return "" - - - def LoadRc(self,RcFileName): + def Validate(self): """ - This method loads a DA System Info rc-file with settings for this simulation + Validate the contents of the rc-file given a dictionary of required keys """ - import da.tools.rc as rc - - self.da_settings = rc.read(RcFileName) - self.RcFileName = RcFileName - self.DaRcLoaded = True - - msg = 'DA System Info rc-file (%s) loaded successfully'%self.RcFileName ; logging.info(msg) - return True + needed_rc_items = ['obs.input.dir', + 'obs.input.fname', + 'ocn.covariance', + 'nparameters', + 'bio.covariance', + 'deltaco2.prefix', + 'regtype'] - def Validate(self, needed_rc_items): - """ - Validate the contents of the rc-file given a dictionary of required keys - """ - for k,v in self.da_settings.iteritems(): if v == 'True' : self.da_settings[k] = True if v == 'False': self.da_settings[k] = False @@ -73,7 +50,7 @@ class DaSystem(object): status,msg = ( True,'DA System Info settings have been validated succesfully' ) ; logging.debug(msg) return None -################### End Class DaSystem ################### +################### End Class CtDaSystem ################### if __name__ == "__main__": diff --git a/da/ct/tools.py b/da/ct/tools.py index 7e4fb249a6ad06502342efa708711413e503bb8e..19613188f4919c2d6bbbae1e4e4e61e80ff4af2d 100755 --- a/da/ct/tools.py +++ b/da/ct/tools.py @@ -15,14 +15,6 @@ import datetime identifier = 'CarbonTracker CO2' -needed_rc_items = ['obs.input.dir', - 'obs.input.fname', - 'ocn.covariance', - 'nparameters', - 'bio.covariance', - 'deltaco2.prefix', - 'regtype'] - def StateToGrid(DaInfo,values,reverse=False,avg=False): """ This method converts parameters from a CarbonTracker StateVector object to a gridded map of linear multiplication values. These diff --git a/da/tools/pipeline.py b/da/tools/pipeline.py index 4faff483d088a6cd73704b1e68c62d0c6cf3a619..9f3f562250d54a07333d4318f934a58ecad33e12 100755 --- a/da/tools/pipeline.py +++ b/da/tools/pipeline.py @@ -25,10 +25,6 @@ system_not_implemented_message = "Unable to import a system specific class or fu def JobStart(opts,args): """ Set up the job specific directory structure and create an expanded rc-file """ from da.tools.initexit import CycleControl - from da.baseclasses.dasystem import DaSystem - from da.ct.tools import needed_rc_items - #from da.platform.jet import JetPlatForm as PlatForm - from da.baseclasses.platform import PlatForm # First create a CycleControl object that handles all the details of the da cycle @@ -36,19 +32,25 @@ def JobStart(opts,args): # Next create a DaSystem object that contains all the details related to the DA system - DaSystem = DaSystem(DaCycle.da_settings['da.system.rc']) + if DaCycle.da_settings['da.system'] == 'CarbonTracker': + from da.ct.dasystem import CtDaSystem as DaSystem + else: + from da.baseclasses.dasystem import DaSystem - dummy = DaSystem.Validate(needed_rc_items) + DaSystem = DaSystem(DaCycle.da_settings['da.system.rc']) - # And add the DaSystem info the DaCycle object + dummy = DaSystem.Validate() DaCycle.DaSystem = DaSystem - # Next, get the information on the platform, and on the DaCycle + # Next, get the information on the platform - DaPlatForm = PlatForm() + if DaCycle.da_settings['da.platform'] == 'jet': + from da.platform.jet import JetPlatForm as PlatForm + else: + from da.baseclasses.platform import PlatForm - # And add the DaPlatForm info the DaCycle object + DaPlatForm = PlatForm() DaCycle.DaPlatForm = DaPlatForm @@ -57,7 +59,10 @@ def JobStart(opts,args): def JobInput(DaCycle): """ Set up the input data for the forward model: obs and parameters/fluxes""" - from da.ct.statevector import CtStateVector as StateVector + if DaCycle.da_settings['da.system'] == 'CarbonTracker': + from da.ct.statevector import CtStateVector as StateVector + else: + from da.baseclasses.statevector import StateVector dims = ( int(DaCycle.da_settings['time.nlag']), int(DaCycle.da_settings['forecast.nmembers']), diff --git a/dajet.rc b/dajet.rc index 01ee7865f2df70e2d5db17e491d7843c6e477549..4e9148afaced1df2f15599b31f5f993a3780932a 100644 --- a/dajet.rc +++ b/dajet.rc @@ -11,6 +11,7 @@ dir.da_run : ${HOME}/tmp/test_da da.system : CarbonTracker da.system.rc : carbontrackerjet.rc +da.platform : jet ! Info on the forward model to be used