8 #ifndef TEST_UFO_LOCATIONS_H_
9 #define TEST_UFO_LOCATIONS_H_
15 #define ECKIT_TESTING_SELF_REGISTER_CASES 0
17 #include "eckit/config/LocalConfiguration.h"
18 #include "eckit/testing/Test.h"
19 #include "ioda/ObsSpace.h"
20 #include "oops/mpi/mpi.h"
21 #include "oops/runs/Test.h"
22 #include "oops/util/DateTime.h"
23 #include "oops/util/Duration.h"
24 #include "oops/util/Logger.h"
25 #include "test/TestEnvironment.h"
26 #include "ufo/Locations.h"
33 const eckit::LocalConfiguration
conf(::test::TestEnvironment::config());
36 util::DateTime bgn(
conf.getString(
"window begin"));
37 util::DateTime end(
conf.getString(
"window end"));
38 const eckit::LocalConfiguration obsconf(
conf,
"obs space");
39 ioda::ObsSpace odb(obsconf, oops::mpi::world(), bgn, end, oops::mpi::myself());
40 const size_t nlocs = odb.nlocs();
44 EXPECT(locs.nobs() == 0);
45 oops::Log::test() <<
"Locs(eckit mpi communicator): " << locs << std::endl;
49 EXPECT(locs1.nobs() == nlocs);
50 oops::Log::test() <<
"Locs(eckit constructor, eckit mpi communicator): " << locs1 << std::endl;
55 EXPECT(locs_t.nobs() == nlocs);
56 oops::Log::test() <<
"Locs(odb,t1,t2) constructor): " << locs_t << std::endl;
59 util::Duration twin = end - bgn;
60 util::DateTime stateTime = bgn + twin/2;
63 const size_t nlocs_b = locs_b.nobs();
64 oops::Log::test() <<
"Locs(odb,t1+(t2-t1)/2,t2) constructor): " << locs_b << std::endl;
68 const size_t nlocs_a = locs_a.nobs();
69 oops::Log::test() <<
"Locs(odb,t1,t1+(t2-t1)/2) constructor): " << locs_a << std::endl;
71 EXPECT(locs_t.nobs() == nlocs_a + nlocs_b);
74 EXPECT(locs_t.nobs() == locs_a.nobs());
75 oops::Log::test() <<
"Locs(odb,t1,t1+(t2-t1)/2) + "
76 <<
"Locs(odb,t1+(t2-t1)/2,t2) concatenated: " << locs_a << std::endl;
80 EXPECT(locs_t.nobs() == locs_b.nobs());
81 oops::Log::test() <<
"Locs(odb,t1+(t2-t1)/2,t2) + "
82 <<
"Locs(odb,t1,t1+(t2-t1)/2) concatenated: " << locs_b << std::endl;
92 std::string
testid()
const override {
return "ufo::test::Locations";}
95 std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
97 ts.emplace_back(
CASE(
"ufo/Locations/testLocations")
109 #endif // TEST_UFO_LOCATIONS_H_