def Forward(rcf, verbosity='INFO'): # Set verbosity level logger.setLevel(verbosity) # Read config rcf = rc(rcf) start = datetime(*rcf.get('time.start')) end = datetime(*rcf.get('time.end')) # Read observations obsfile = rcf.get('observations.filename') db = obsdb(filename=obsfile) db.setupFootprints(path=rcf.get('footprints.path'), cache=rcf.get('footprints.cache')) # Read fluxes categories = dict.fromkeys(rcf.get('emissions.categories')) for cat in categories: categories[cat] = rcf.get(f'emissions.{cat}.origin') emis = lagrange.ReadArchive(rcf.get('emissions.prefix'), start, end, categories=categories) # transport model run model = lumia.transport(rcf, obs=db, formatter=lagrange) model.runForward(struct=emis, step=rcf.get('tag')) return model
def _from_hdf(self, filename, loadrc=True): self.vectors = read_hdf(filename, 'vectors') with h5py.File(filename, 'r') as fid: # rcf if loadrc: rcf = rc() for key in fid['rcf'].attrs: rcf.setkey(key, fid['rcf'].attrs[key]) else: try: rcf = self.rcf except AttributeError: logger.critical("no rcf info in the object") raise # correlations : for cor in fid['correlations/hor']: self.horizontal_correlations[cor] = fid['correlations/hor'][ cor][:] for cor in fid['correlations/temp']: self.temporal_correlations[cor] = fid['correlations/temp'][ cor][:] return rcf
def __init__(self, rcf, obs, emfile, mp=False, checkfile=None): self.rcf = rctools.rc(rcf) self.obs = obsdb(obs) self.obs.checkIndex(reindex=True) self.obsfile = obs self.rcfile = rcf self.emfile = emfile self.executable = __file__ self.batch = os.environ['INTERACTIVE'] == 'F' self.categories = Categories(self.rcf) self.checkfile=checkfile logger.debug(checkfile) if mp : self.parallel = True self.runForward = self.runForward_mp self.runAdjoint = self.runAdjoint_mp else : self.parallel = False self.runForward = self.runForward_sp self.runAdjoint = self.runAdjoint_sp