UFO
ProfileChecker.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 
8 #include <algorithm>
9 
10 #include "eckit/exception/Exceptions.h"
11 
12 #include "oops/util/Logger.h"
13 
24 
26 
27 namespace ufo {
29  const ProfileIndices &profileIndices,
30  ProfileDataHandler &profileDataHandler,
31  ProfileCheckValidator &profileCheckValidator)
32  : options_(options),
33  profileIndices_(profileIndices),
34  profileDataHandler_(profileDataHandler),
35  profileCheckValidator_(profileCheckValidator),
36  checks_(options.Checks.value())
37  {
38  // Ensure basic checks are always performed first
39  auto it_checks = std::find(checks_.begin(), checks_.end(), "Basic");
40  if (it_checks == checks_.end()) {
41  // If "Basic" not present, insert at the start
42  checks_.insert(checks_.begin(), "Basic");
43  } else if (it_checks != checks_.begin()) {
44  // If "Basic" is present but not at the start, move it there
45  std::rotate(checks_.begin(), it_checks, it_checks + 1);
46  }
47  }
48 
50  {
51  // Run all checks requested
52  for (const auto& check : checks_) {
53  std::unique_ptr<ProfileCheckBase> profileCheck =
55  options_,
59  if (profileCheck) {
60  profileCheck->runCheck();
61  // Fill validation information if required
62  if (options_.compareWithOPS.value()) {
63  profileCheck->fillValidator();
64  }
65  // Do not proceed if basic checks failed
66  if (!profileCheck->getResult() && check == "Basic") {
67  oops::Log::debug() << "Basic checks failed" << std::endl;
68  setBasicCheckResult(false);
69  break;
70  }
71  } else {
72  throw eckit::NotImplemented("Have not implemented a check for " + check, Here());
73  }
74  }
75  }
76 } // namespace ufo
ufo::ProfileChecker::checks_
std::vector< std::string > checks_
Checks to perform.
Definition: ProfileChecker.h:59
ufo::ProfileDataHandler
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
Definition: ProfileDataHandler.h:40
MetOfficeQCFlags.h
ufo::ProfileIndices
Determine indices of observations making up individual profiles. The indices are computed with respec...
Definition: ProfileIndices.h:39
ufo::ProfileChecker::profileDataHandler_
ProfileDataHandler & profileDataHandler_
Profile data.
Definition: ProfileChecker.h:53
ufo_geovals_mod::check
subroutine check(action, status)
Definition: ufo_geovals_mod.F90:1146
ProfileCheckUnstableLayer.h
ufo::ProfileCheckValidator
Profile QC check validator.
Definition: ProfileCheckValidator.h:27
ufo_radiancerttov_utils_mod::debug
logical, public debug
Definition: ufo_radiancerttov_utils_mod.F90:100
ufo::ProfileChecker::options_
const ProfileConsistencyCheckParameters & options_
Configurable parameters.
Definition: ProfileChecker.h:47
ufo::ProfileChecker::profileCheckValidator_
ProfileCheckValidator & profileCheckValidator_
Profile check validator.
Definition: ProfileChecker.h:56
ufo::ProfileChecker::ProfileChecker
ProfileChecker(const ProfileConsistencyCheckParameters &options, const ProfileIndices &profileIndices, ProfileDataHandler &profileDataHandler, ProfileCheckValidator &profileCheckValidator)
Definition: ProfileChecker.cc:28
ufo::ProfileChecker::setBasicCheckResult
void setBasicCheckResult(bool result)
Set basic check result.
Definition: ProfileChecker.h:43
ProfileCheckUInterp.h
ufo
Definition: RunCRTM.h:27
ProfileCheckRH.h
ProfileCheckSign.h
ufo::ProfileConsistencyCheckParameters::compareWithOPS
oops::Parameter< bool > compareWithOPS
Compare with OPS values?
Definition: ProfileConsistencyCheckParameters.h:321
ProfileCheckSamePDiffT.h
ProfileChecker.h
ProfileCheckBasic.h
ufo::ProfileConsistencyCheckParameters
Options controlling the operation of the ProfileConsistencyChecks filter.
Definition: ProfileConsistencyCheckParameters.h:33
ufo::ProfileChecker::runChecks
void runChecks()
Run all checks requested.
Definition: ProfileChecker.cc:49
ufo::ProfileChecker::profileIndices_
const ProfileIndices & profileIndices_
Indices of profile's observations in the entire sample.
Definition: ProfileChecker.h:50
ProfileCheckBase.h
ProfileCheckInterpolation.h
ufo::ProfileCheckFactory::create
static std::unique_ptr< ProfileCheckBase > create(const std::string &, const ProfileConsistencyCheckParameters &, const ProfileIndices &, ProfileDataHandler &, ProfileCheckValidator &)
Definition: ProfileCheckBase.cc:34
ProfileCheckHydrostatic.h