Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix meanioda example now that timeWindow has been added #673

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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