UFO
ProfileCheckBase.cc
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2020, Met Office
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
9 
10 #include <map>
11 #include <string>
12 
13 #include "oops/util/Logger.h"
14 
15 namespace ufo {
17  const ProfileIndices &profileIndices,
18  ProfileDataHandler &profileDataHandler,
19  ProfileCheckValidator &profileCheckValidator)
20  : options_(options),
21  profileIndices_(profileIndices),
22  profileDataHandler_(profileDataHandler),
23  profileCheckValidator_(profileCheckValidator)
24  {}
25 
26  ProfileCheckFactory::ProfileCheckFactory(const std::string & name)
27  {
28  if (getMakers().find(name) != getMakers().end())
29  throw eckit::BadParameter(name + " already registered in ufo::ProfileCheckFactory.", Here());
30  getMakers()[name] = this;
31  }
32 
33  std::unique_ptr<ProfileCheckBase>
34  ProfileCheckFactory::create(const std::string& name,
35  const ProfileConsistencyCheckParameters &options,
36  const ProfileIndices &profileIndices,
37  ProfileDataHandler &profileDataHandler,
38  ProfileCheckValidator &profileCheckValidator)
39  {
40  oops::Log::trace() << "ProfileCheckBase::create starting" << std::endl;
41  typename std::map<std::string, ProfileCheckFactory*>::iterator jloc =
42  getMakers().find(name);
43  if (jloc == getMakers().end()) {
44  std::string makerNameList;
45  for (const auto& makerDetails : getMakers()) makerNameList += "\n " + makerDetails.first;
46  throw eckit::BadParameter(name + " does not exist in ufo::ProfileCheckFactory. "
47  "Possible values:" + makerNameList, Here());
48  }
49  std::unique_ptr<ProfileCheckBase> ptr = jloc->second->make(options,
50  profileIndices,
51  profileDataHandler,
52  profileCheckValidator);
53  oops::Log::trace() << "ProfileCheckBase::create done" << std::endl;
54  return ptr;
55  }
56 } // namespace ufo
57 
ufo::ProfileDataHandler
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
Definition: ProfileDataHandler.h:40
ufo::ProfileCheckFactory::ProfileCheckFactory
ProfileCheckFactory(const std::string &)
Definition: ProfileCheckBase.cc:26
ufo::ProfileIndices
Determine indices of observations making up individual profiles. The indices are computed with respec...
Definition: ProfileIndices.h:39
ufo::ProfileCheckBase::ProfileCheckBase
ProfileCheckBase(const ProfileConsistencyCheckParameters &options, const ProfileIndices &profileIndices, ProfileDataHandler &profileDataHandler, ProfileCheckValidator &profileCheckValidator)
Definition: ProfileCheckBase.cc:16
ufo::ProfileCheckValidator
Profile QC check validator.
Definition: ProfileCheckValidator.h:27
ufo::ProfileCheckFactory::getMakers
static std::map< std::string, ProfileCheckFactory * > & getMakers()
Definition: ProfileCheckBase.h:104
ufo
Definition: RunCRTM.h:27
ufo::ProfileConsistencyCheckParameters
Options controlling the operation of the ProfileConsistencyChecks filter.
Definition: ProfileConsistencyCheckParameters.h:33
ProfileCheckBase.h
ufo::ProfileCheckFactory::create
static std::unique_ptr< ProfileCheckBase > create(const std::string &, const ProfileConsistencyCheckParameters &, const ProfileIndices &, ProfileDataHandler &, ProfileCheckValidator &)
Definition: ProfileCheckBase.cc:34