# Set ObservationOperator
self.ADD.setObservationOperator(asFunction = {"Direct":direct, "Tangent":tangent, "Adjoint":adjoint})
+ # Set Observers
+ for observer_name in self.da_study.observers_dict.keys():
+ if observers_dict[observer_name]["scheduler"] != "":
+ self.ADD.setDataObserver(observer_name, HookFunction=self.obs, Scheduler = observers_dict[observer_name]["scheduler"], HookParameters = observer_name)
+ else:
+ self.ADD.setDataObserver(observer_name, HookFunction=self.obs, HookParameters = observer_name)
# Start Assimilation Study
#print "ADD analyze"
# Assimilation Study is finished
self.pool.destroyAll()
+ def obs(self, var, info):
+ print "Hook observer called with:"
+ print "var %s" % var
+ print "inof %s" % info
+
def getAlgoResult(self):
#print "getAlgoResult"
self.ADD.prepare_to_pickle()
self.FunctionObservationOperator[Name] = ObservationOperator
def addObserver(self, name, scheduler, info):
- observers_dict[name] = {}
- observers_dict[name]["scheduler"] = scheduler
- observers_dict[name]["info"] = info
+ self.observers_dict[name] = {}
+ self.observers_dict[name]["scheduler"] = scheduler
+ self.observers_dict[name]["info"] = info
def getObservers(self):
return self.observers_dict