8 #ifndef TEST_UFO_PROFILECONSISTENCYCHECKS_H_
9 #define TEST_UFO_PROFILECONSISTENCYCHECKS_H_
16 #define ECKIT_TESTING_SELF_REGISTER_CASES 0
18 #include "eckit/config/LocalConfiguration.h"
19 #include "eckit/testing/Test.h"
20 #include "ioda/ObsSpace.h"
21 #include "ioda/ObsVector.h"
22 #include "oops/mpi/mpi.h"
23 #include "oops/runs/Test.h"
24 #include "oops/util/Expect.h"
25 #include "test/TestEnvironment.h"
29 #include "ufo/ObsDiagnostics.h"
48 util::DateTime bgn(
conf.getString(
"window begin"));
49 util::DateTime end(
conf.getString(
"window end"));
51 const eckit::LocalConfiguration obsSpaceConf(
conf,
"obs space");
52 ioda::ObsSpace obsspace(obsSpaceConf, oops::mpi::world(), bgn, end, oops::mpi::myself());
54 ioda::ObsVector hofx(obsspace);
56 const eckit::LocalConfiguration obsdiagconf(
conf,
"obs diagnostics");
57 std::vector<eckit::LocalConfiguration> varconfs;
58 obsdiagconf.get(
"variables", varconfs);
60 const ObsDiagnostics obsdiags(obsdiagconf, obsspace, diagvars.toOopsVariables());
63 obsspace, obsspace.obsvariables(),
"ObsError"));
66 obsspace, obsspace.obsvariables()));
68 const eckit::LocalConfiguration filterConf(
conf,
"ProfileConsistencyChecks");
73 bool expectThrowOnInstantiation =
conf.getBool(
"ExpectThrowOnInstantiation",
false);
74 bool expectThrowDuringOperation =
conf.getBool(
"ExpectThrowDuringOperation",
false);
76 if (expectThrowOnInstantiation) {
85 if (expectThrowDuringOperation)
86 EXPECT_THROWS(filter.
postFilter(hofx, obsdiags));
93 bool bypassMismatchComparison =
conf.getBool(
"BypassMismatchComparison",
false);
96 if (!bypassMismatchComparison) {
104 bool addDuplicateCheck =
conf.getBool(
"AddDuplicateCheck",
false);
105 if (addDuplicateCheck) {
111 bool getWrongType =
conf.getBool(
"GetWrongType",
false);
113 std::unique_ptr <ProfileConsistencyCheckParameters> options_;
115 options_->deserialize(
conf);
122 std::vector<bool> apply(obsspace.nlocs(),
true);
128 entireSampleDataHandler,
137 bool ManualFlagModification =
conf.getBool(
"ManualFlagModification",
false);
138 if (ManualFlagModification) {
139 std::unique_ptr <ProfileConsistencyCheckParameters> options_;
141 options_->deserialize(
conf);
147 std::vector<bool> apply(obsspace.nlocs(),
true);
153 entireSampleDataHandler,
159 profileDataHandler.
reset();
165 std::vector <int> &ReportFlags =
167 std::vector <int> &tFlags =
169 std::vector <int> &rhFlags =
171 std::vector <int> &uFlags =
173 std::vector <int> &zFlags =
175 std::vector <int> &timeFlags =
191 profileCheckValidator);
195 profileCheckValidator);
199 profileCheckValidator);
203 profileCheckValidator);
207 profileCheckValidator);
217 profileCheckBackgroundRH.
runCheck();
218 profileCheckBackgroundUV.
runCheck();
225 std::string
testid()
const override {
return "ufo::test::ProfileConsistencyChecks";}
228 std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
230 const eckit::LocalConfiguration
conf(::test::TestEnvironment::config());
231 for (
const std::string & testCaseName :
conf.keys())
233 const eckit::LocalConfiguration testCaseConf(::test::TestEnvironment::config(), testCaseName);
234 ts.emplace_back(
CASE(
"ufo/ProfileConsistencyChecks/" + testCaseName, testCaseConf)
247 #endif // TEST_UFO_PROFILECONSISTENCYCHECKS_H_