7 #ifndef OOPS_ASSIMILATION_CALCHOFX_H_
8 #define OOPS_ASSIMILATION_CALCHOFX_H_
14 #include "eckit/config/LocalConfiguration.h"
27 #include "oops/util/Logger.h"
28 #include "oops/util/parameters/Parameter.h"
29 #include "oops/util/parameters/Parameters.h"
30 #include "oops/util/parameters/RequiredParameter.h"
34 template <
typename OBS>
42 oops::Parameter<std::vector<ObsFilterParametersWrapper<OBS>>>
obsFilters{
"obs filters", {},
this};
49 template <
typename OBS>
61 template <
typename DATA>
using ObsDataVec_ = std::vector<std::shared_ptr<ObsData_<DATA>>>;
113 template <
typename OBS>
115 const eckit::Configuration & config) :
116 obsconfig_(config), obspaces_(obspaces), obsops_(), locations_(),
117 biascoeff_(nullptr), qcflags_(), obserrs_(), filters_(),
118 geovars_(obspaces_.size())
120 std::vector<eckit::LocalConfiguration> obsconfs = config.getSubConfigurations();
130 observerParams.deserialize(obsconfs[jj]);
137 obspaces[jj].obsvariables()));
139 obserrs_.emplace_back(std::make_shared<ObsVector_>(obspaces[jj],
"ObsError"));
141 Log::trace() <<
"CalcHofX<OBS> constructed" << std::endl;
146 template <
typename OBS>
148 std::vector<eckit::LocalConfiguration> obsconfs = obsconfig_.getSubConfigurations();
149 biascoeff_ = &obsaux;
151 for (
size_t jj = 0; jj < obspaces_.size(); ++jj) {
153 observerParams.deserialize(obsconfs[jj]);
156 qcflags_[jj], *obserrs_[jj], iteration));
157 filters_[jj]->preProcess();
160 geovars_[jj] += obsops_[jj]->requiredVars();
161 geovars_[jj] += (*biascoeff_)[jj].requiredVars();
162 geovars_[jj] += filters_[jj]->requiredVars();
164 Log::trace() <<
"CalcHofX<OBS>::initialize done" << std::endl;
169 template <
typename OBS>
171 oops::Log::trace() <<
"CalcHofX<OBS>::compute start" << std::endl;
176 for (
size_t jj = 0; jj < obspaces_.size(); ++jj) {
178 filters_[jj]->priorFilter(*geovals[jj]);
181 vars += filters_[jj]->requiredHdiagnostics();
182 vars += (*biascoeff_)[jj].requiredHdiagnostics();
183 ObsDiags_ ydiags(obspaces_[jj], *locations_[jj], vars);
184 obsops_[jj]->simulateObs(*geovals[jj], yobs[jj], (*biascoeff_)[jj], ybias[jj], ydiags);
186 filters_[jj]->postFilter(yobs[jj], ybias[jj], ydiags);
188 oops::Log::trace() <<
"CalcHofX<OBS>::compute done" << std::endl;
194 template <
typename OBS>
196 for (
const auto & qcflag : qcflags_) {
197 qcflag->read(qcname);
203 template <
typename OBS>
205 for (
const auto & qcflag : qcflags_) {
208 for (
const auto & obserr : obserrs_) {
209 obserr->read(
"ObsError");
215 template <
typename OBS>
217 for (
const auto & qcflag : qcflags_) {
224 template <
typename OBS>
226 for (
const auto & obserr : obserrs_) {
233 template <
typename OBS>
235 for (
size_t jj = 0; jj < obserrs_.size(); ++jj) {
236 obserrs_[jj]->mask(*qcflags_[jj]);
Computes observation operator (from GeoVaLs), applies bias correction and runs QC filters.
ObsDataVec_< int > qcflags_
Observations< OBS > Observations_
void saveObsErrors(const std::string &) const
save obs error variances (modified in QC) to ObsSpaces
void initialize(const ObsAuxCtrls_ &, const int iteration=0)
Initializes variables, obs bias, obs filters (could be different for different iterations.
ObsSpaces< OBS > ObsSpaces_
std::vector< std::unique_ptr< ObsOperator_ > > ObsOperatorVec_
std::vector< std::shared_ptr< ObsVector_ > > ObsVectorVec_
const ObsDataVec_< int > & qcflags() const
accessor to QC flags
ObsFilters< OBS > ObsFilters_
std::vector< std::unique_ptr< ObsFilters_ > > ObsFiltersVec_
std::vector< std::unique_ptr< GeoVaLs_ > > GeoVaLsVec_
ObsVector< OBS > ObsVector_
const LocationsVec_ & locations() const
accessor to the locations
eckit::LocalConfiguration obsconfig_
Observations_ compute(const GeoVaLsVec_ &)
Computes H(x) from the filled in GeoVaLs.
void resetQc()
reset QC flags and ObsErrors
void saveQcFlags(const std::string &) const
save QC flags to ObsSpaces
const ObsSpaces_ & obspaces_
Locations< OBS > Locations_
const VariablesVec_ & requiredVars() const
accessor to variables required from the model
CalcHofX(const ObsSpaces_ &, const eckit::Configuration &)
Initializes ObsOperators, Locations, and QC data.
void maskObsErrors()
mask obs errors with QC flags
ObsAuxControls< OBS > ObsAuxCtrls_
std::vector< Variables > VariablesVec_
ObsDiagnostics< OBS > ObsDiags_
std::vector< std::unique_ptr< Locations_ > > LocationsVec_
void readQcFlags(const std::string &qcname)
read QC flags from qcname variable from file
std::vector< std::shared_ptr< ObsData_< DATA > >> ObsDataVec_
const ObsAuxCtrls_ * biascoeff_
ObsOperator< OBS > ObsOperator_
OBS::ObsOperator::Parameters_ ObsOperatorParameters_
oops::Parameter< std::vector< ObsFilterParametersWrapper< OBS > > > obsFilters
oops::RequiredParameter< ObsOperatorParameters_ > obsOperator
Locations of observations for observation operator.
Holds a vector of ObsAuxControl.
ObsDataVector is a vector templated on data type, in the observation space.
Holds observation filters (usually QC) for one observation type.
MODEL-agnostic part of nonlinear observation (forward) operator. The full nonlinear observation opera...
std::size_t size() const
Access.
ObsVector class used in oops; subclass of interface class interface::ObsVector.
The namespace for the main oops code.