12 #ifndef OOPS_BASE_GETVALUESPOST_H_
13 #define OOPS_BASE_GETVALUESPOST_H_
28 #include "oops/util/DateTime.h"
29 #include "oops/util/Duration.h"
30 #include "oops/util/Logger.h"
41 template <
typename MODEL,
typename OBS>
58 const std::vector<eckit::LocalConfiguration> &);
68 void doInitialize(
const State_ &,
const util::DateTime &,
const util::Duration &)
override;
86 template <
typename MODEL,
typename OBS>
89 const std::vector<Variables> & vars,
90 const std::vector<eckit::LocalConfiguration> & confs)
92 winbgn_(obsdb.windowStart()), winend_(obsdb.windowEnd()), hslot_(),
93 locations_(
locations), geovars_(vars), getvalsconfs_(confs)
95 Log::trace() <<
"GetValuesPost::GetValuesPost" << std::endl;
99 template <
typename MODEL,
typename OBS>
101 Log::trace() <<
"GetValuesPost::fill start" << std::endl;
102 const size_t nstates = xx.
size();
103 util::Duration tstep = winend_ - winbgn_;
107 tstep = xx[1].validTime() - xx[0].validTime();
108 for (
size_t ii = 1; ii < nstates; ++ii) {
109 ASSERT(tstep == (xx[ii].validTime() - xx[ii-1].validTime()));
113 doInitialize(xx[0], xx[nstates-1].validTime(), tstep);
114 for (
size_t ii = 0; ii < nstates; ++ii) {
115 doProcessing(xx[ii]);
117 Log::trace() <<
"GetValuesPost::fill done" << std::endl;
122 template <
typename MODEL,
typename OBS>
124 const util::Duration & tstep) {
125 Log::trace() <<
"GetValuesPost::doInitialize start" << std::endl;
128 for (
size_t jj = 0; jj < locations_.size(); ++jj) {
129 getvals_.emplace_back(
new GetValues_(xx.
geometry(), *locations_[jj], getvalsconfs_[jj]));
130 geovals_.emplace_back(
new GeoVaLs_(*locations_[jj], geovars_[jj],
134 Log::trace() <<
"GetValuesPost::doInitialize done" << std::endl;
139 template <
typename MODEL,
typename OBS>
141 Log::trace() <<
"GetValuesPost::doProcessing start" << std::endl;
142 util::DateTime t1 = std::max(xx.
validTime()-hslot_, winbgn_);
143 util::DateTime t2 = std::min(xx.
validTime()+hslot_, winend_);
146 for (
size_t jj = 0; jj < getvals_.size(); ++jj) {
147 getvals_[jj]->fillGeoVaLs(xx, t1, t2, *geovals_[jj]);
149 Log::trace() <<
"GetValuesPost::doProcessing done" << std::endl;
Gets values from model State to observation locations (fills GeoVaLs)
Fills GeoVaLs with requested variables at requested locations:
ObsSpaces< OBS > ObsSpaces_
GetValuesVec_ getvals_
Variables needed from model.
const GeoVaLsVec_ & geovals() const
Returns geovals filled in during the model run.
std::vector< std::unique_ptr< GetValues_ > > GetValuesVec_
util::Duration hslot_
End of assimilation window.
std::vector< std::unique_ptr< Locations_ > > LocationsVec_
Locations< OBS > Locations_
void doProcessing(const State_ &) override
called at each model step: fill in GeoVaLs for the current time slot
State4D< MODEL > State4D_
GetValues< MODEL, OBS > GetValues_
GetValuesPost(const ObsSpaces_ &, const LocationsVec_ &, const std::vector< Variables > &, const std::vector< eckit::LocalConfiguration > &)
Saves Locations and Variables to be processed.
const LocationsVec_ & locations_
Half time slot.
const std::vector< Variables > geovars_
locations of observations
void doInitialize(const State_ &, const util::DateTime &, const util::Duration &) override
initialization before model run: sets up GetValues and allocate GeoVaLs
std::vector< std::unique_ptr< GeoVaLs_ > > GeoVaLsVec_
void fill(const State4D_ &)
fills in GeoVaLs looping through State4D
const std::vector< eckit::LocalConfiguration > getvalsconfs_
GeoVaLs that are filled in.
GeoVaLsVec_ geovals_
GetValues used to fill in GeoVaLs.
util::DateTime winend_
Begining of assimilation window.
Locations of observations for observation operator.
Handles post-processing of model fields.
Four dimensional state (vector of 3D States)
size_t size() const
Get 3D model state.
State class used in oops; subclass of interface class interface::State.
std::vector< size_t > variableSizes(const Variables &) const
Geometry_ geometry() const
Accessor to geometry associated with this State.
const util::DateTime validTime() const
Accessor to the time of this State.
The namespace for the main oops code.