7 #ifndef OOPS_ASSIMILATION_CALCHOFX_H_
8 #define OOPS_ASSIMILATION_CALCHOFX_H_
14 #include "eckit/config/LocalConfiguration.h"
28 #include "oops/util/Duration.h"
29 #include "oops/util/Logger.h"
37 template <
typename MODEL,
typename OBS>
67 std::shared_ptr<QCData_>
qc()
const {
return qc_;}
80 std::shared_ptr<QCData_>
qc_;
81 std::shared_ptr<Observers<MODEL, OBS> >
pobs_;
86 template <
typename MODEL,
typename OBS>
88 const eckit::Configuration & config) :
89 obsconf_(config), obspaces_(obspaces), ybias_(obspaces_, obsconf_),
90 geometry_(geometry), moderr_(geometry_, config.getSubConfiguration(
"model aux control")),
91 winbgn_(config.getString(
"window begin")),
92 winlen_(config.getString(
"window length")) {}
95 template <
typename MODEL,
typename OBS>
97 qc_.reset(
new QCData_(obspaces_));
104 template <
typename MODEL,
typename OBS>
107 oops::Log::trace() <<
"CalcHofX<MODEL, OBS>::compute (model) start" << std::endl;
109 this->initObserver();
112 model.forecast(xx, moderr_, length, post);
114 oops::Log::trace() <<
"CalcHofX<MODEL, OBS>::compute (model) done" << std::endl;
115 return pobs_->hofx();
120 template <
typename MODEL,
typename OBS>
122 oops::Log::trace() <<
"CalcHofX<MODEL, OBS>::compute (state4D) start" << std::endl;
124 this->initObserver();
125 size_t nstates = xx.
size();
126 util::DateTime winend = winbgn_ + winlen_;
127 util::Duration tstep = winlen_;
131 tstep = xx[1].validTime() - xx[0].validTime();
132 for (
size_t ii = 1; ii < xx.
size(); ++ii) {
133 ASSERT(tstep == (xx[ii].validTime() - xx[ii-1].validTime()));
137 ASSERT(xx[0].validTime() <= (winbgn_ + tstep/2));
138 ASSERT(xx[nstates-1].validTime() >= (winend - tstep/2));
141 pobs_->initialize(xx[0], winend, tstep);
142 for (
size_t ii = 0; ii < xx.
size(); ++ii) {
143 pobs_->process(xx[ii]);
145 pobs_->finalize(xx[nstates-1]);
147 oops::Log::trace() <<
"CalcHofX<MODEL, OBS>::compute (state4D) done" << std::endl;
148 return pobs_->hofx();
153 template <
typename MODEL,
typename OBS>
155 for (
size_t jj = 0; jj < obspaces_.size(); ++jj) {
156 qc_->qcFlags(jj)->save(name);
162 template <
typename MODEL,
typename OBS>
164 for (
size_t jj = 0; jj < obspaces_.size(); ++jj) {
165 qc_->obsErrors(jj)->save(name);
171 template <
typename MODEL,
typename OBS>
173 for (
size_t jj = 0; jj < obspaces_.size(); ++jj) {
174 qc_->obsErrors(jj)->mask(*qcMask.
qcFlags(jj));
179 #endif // OOPS_ASSIMILATION_CALCHOFX_H_