From 15c29749326d5393af2ab269743bda19ec103396 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Wed, 11 Oct 2023 09:31:24 -0500 Subject: [PATCH] Fix meanioda --- utils/ioda_example/gdas_meanioda.h | 9 +++++++-- utils/test/testinput/gdas_meanioda.yaml | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/ioda_example/gdas_meanioda.h b/utils/ioda_example/gdas_meanioda.h index de382ad9c..13252c30a 100644 --- a/utils/ioda_example/gdas_meanioda.h +++ b/utils/ioda_example/gdas_meanioda.h @@ -17,6 +17,7 @@ #include "oops/util/DateTime.h" #include "oops/util/Duration.h" #include "oops/util/Logger.h" +#include "oops/util/TimeWindow.h" namespace gdasapp { // this is an example of how one can use OOPS and IODA to do something @@ -44,6 +45,10 @@ namespace gdasapp { std::string winend; fullConfig.get("window begin", winbegin); fullConfig.get("window end", winend); + bool shift; + fullConfig.get("window shift", shift); + const util::TimeWindow timeWindow(util::DateTime(winbegin), util::DateTime(winend), + util::boolToWindowBound(shift)); // what variable to get the mean of std::string group; @@ -59,8 +64,8 @@ namespace gdasapp { // Note, the below line does a lot of heavy lifting // we can probably go to a lower level function // (and more of them) to accomplish the same thing - ioda::ObsSpace ospace(obsparams, oops::mpi::world(), util::DateTime(winbegin), - util::DateTime(winend), oops::mpi::myself()); + ioda::ObsSpace ospace(obsparams, oops::mpi::world(), timeWindow, + oops::mpi::myself()); const size_t nlocs = ospace.nlocs(); oops::Log::info() << "nlocs =" << nlocs << std::endl; std::vector buffer(nlocs); diff --git a/utils/test/testinput/gdas_meanioda.yaml b/utils/test/testinput/gdas_meanioda.yaml index ef4dc0ed5..fdd0dcd8c 100644 --- a/utils/test/testinput/gdas_meanioda.yaml +++ b/utils/test/testinput/gdas_meanioda.yaml @@ -1,6 +1,7 @@ # the window is 30 years long to capture anything we can throw at it in this input file window begin: 2000-11-01T09:00:00Z window end: 2030-11-01T15:00:00Z +window shift: false obs space: name: gmi_gpm_test_mean obsdatain: