11 #ifndef OOPS_BASE_OBSERVERS_H_
12 #define OOPS_BASE_OBSERVERS_H_
26 #include "oops/util/DateTime.h"
27 #include "oops/util/Duration.h"
28 #include "oops/util/Logger.h"
36 template <
typename MODEL,
typename OBS>
55 void doInitialize(
const State_ &,
const util::DateTime &,
const util::Duration &)
override;
72 template <
typename MODEL,
typename OBS>
76 obspace_(obsdb), yobs_(obsdb),
77 winbgn_(obsdb.windowStart()), winend_(obsdb.windowEnd()), hslot_(0), observers_(0)
79 Log::trace() <<
"Observers::Observers starting" << std::endl;
81 const int iterout = conf.getInt(
"iteration", 0);
82 std::vector<eckit::LocalConfiguration> typeconf;
83 conf.get(
"observations", typeconf);
84 ASSERT(obsdb.
size() == typeconf.size());
86 for (
size_t jj = 0; jj < obsdb.
size(); ++jj) {
87 typeconf[jj].set(
"iteration", iterout);
91 Log::trace() <<
"Observers::Observers done" << std::endl;
96 template <
typename MODEL,
typename OBS>
98 const util::Duration & tstep) {
99 Log::trace() <<
"Observers::doInitialize start" << std::endl;
100 const util::DateTime bgn(xx.
validTime());
103 for (
size_t jj = 0; jj < observers_.size(); ++jj) {
104 observers_[jj]->doInitialize(xx, winbgn_, winend_);
106 Log::trace() <<
"Observers::doInitialize done" << std::endl;
111 template <
typename MODEL,
typename OBS>
113 Log::trace() <<
"Observers::doProcessing start" << std::endl;
114 util::DateTime t1 = std::max(xx.
validTime()-hslot_, winbgn_);
115 util::DateTime t2 = std::min(xx.
validTime()+hslot_, winend_);
118 for (
size_t jj = 0; jj < observers_.size(); ++jj) {
119 observers_[jj]->doProcessing(xx, t1, t2);
121 Log::trace() <<
"Observers::doProcessing done" << std::endl;
126 template <
typename MODEL,
typename OBS>
128 Log::trace() <<
"Observers::doFinalize start" << std::endl;
129 for (
size_t jj = 0; jj < observers_.size(); ++jj) {
130 observers_[jj]->doFinalize();
132 Log::trace() <<
"Observers::doFinalize done" << std::endl;
139 #endif // OOPS_BASE_OBSERVERS_H_