Skip to content

Commit

Permalink
Fix meanioda example now that timeWindow has been added (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryMartin-NOAA authored Oct 11, 2023
1 parent d6c4660 commit f57c1dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions utils/ioda_example/gdas_meanioda.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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<float> buffer(nlocs);
Expand Down
1 change: 1 addition & 0 deletions utils/test/testinput/gdas_meanioda.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit f57c1dc

Please sign in to comment.