8 #ifndef TEST_UFO_TRACKCHECK_H_
9 #define TEST_UFO_TRACKCHECK_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"
33 util::DateTime bgn(
conf.getString(
"window begin"));
34 util::DateTime end(
conf.getString(
"window end"));
36 const eckit::LocalConfiguration obsSpaceConf(
conf,
"obs space");
37 ioda::ObsSpace obsspace(obsSpaceConf, oops::mpi::world(), bgn, end, oops::mpi::myself());
39 if (
conf.has(
"air_pressures")) {
40 const std::vector<float> airPressures =
conf.getFloatVector(
"air_pressures");
41 obsspace.put_db(
"MetaData",
"air_pressure", airPressures);
42 const std::vector<float> airPressureObserrors(airPressures.size(), 1.0f);
43 obsspace.put_db(
"ObsError",
"air_pressure", airPressureObserrors);
46 if (
conf.has(
"station_ids")) {
47 const std::vector<int> stationIds =
conf.getIntVector(
"station_ids");
48 obsspace.put_db(
"MetaData",
"station_id", stationIds);
52 obsspace, obsspace.obsvariables(),
"ObsError"));
54 obsspace, obsspace.obsvariables()));
56 const eckit::LocalConfiguration filterConf(
conf,
"Track Check");
60 const std::vector<size_t> expectedRejectedObsIndices =
61 conf.getUnsignedVector(
"expected_rejected_obs_indices");
62 std::vector<size_t> rejectedObsIndices;
63 for (
size_t i = 0; i < qcflags->nlocs(); ++i)
65 rejectedObsIndices.push_back(i);
66 EXPECT_EQUAL(rejectedObsIndices, expectedRejectedObsIndices);
71 std::string
testid()
const override {
return "ufo::test::TrackCheck";}
74 std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
76 const eckit::LocalConfiguration
conf(::test::TestEnvironment::config());
77 for (
const std::string & testCaseName :
conf.keys())
79 const eckit::LocalConfiguration testCaseConf(::test::TestEnvironment::config(), testCaseName);
80 ts.emplace_back(
CASE(
"ufo/TrackCheck/" + testCaseName, testCaseConf)
93 #endif // TEST_UFO_TRACKCHECK_H_