diff --git a/utils/ioda_example/gdas_meanioda.cc b/utils/ioda_example/gdas_meanioda.cc index 6e18ff5fa..3844b92b4 100644 --- a/utils/ioda_example/gdas_meanioda.cc +++ b/utils/ioda_example/gdas_meanioda.cc @@ -1,4 +1,4 @@ -#include "gdas_meanioda.h" +#include "ioda_example/gdas_meanioda.h" #include "oops/runs/Run.h" // this is an example application that diff --git a/utils/ioda_example/gdas_meanioda.h b/utils/ioda_example/gdas_meanioda.h index 95742c196..3bd999ae3 100644 --- a/utils/ioda_example/gdas_meanioda.h +++ b/utils/ioda_example/gdas_meanioda.h @@ -1,5 +1,10 @@ +#ifndef GDAS_UTILS_IODA_EXAMPLE_GDAS_MEANIODA_H_ +#define GDAS_UTILS_IODA_EXAMPLE_GDAS_MEANIODA_H_ + #include #include +#include +#include #include "eckit/config/LocalConfiguration.h" #include "ioda/Group.h" #include "ioda/ObsSpace.h" @@ -26,11 +31,10 @@ namespace gdasapp { static const std::string classname() {return "gdasapp::IodaExample";} int execute(const eckit::Configuration & fullConfig, bool /*validate*/) const { - // get the obs space configuration const eckit::LocalConfiguration obsConfig(fullConfig, "obs space"); ioda::ObsTopLevelParameters obsparams; - obsparams.validateAndDeserialize(obsConfig); // TODO CRM, can I remove this and then the simulated vars junk?? + obsparams.validateAndDeserialize(obsConfig); oops::Log::info() << "obs space: " << std::endl << obsConfig << std::endl; // time window stuff @@ -51,13 +55,16 @@ namespace gdasapp { // read the obs space // 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()); + // 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()); const size_t nlocs = ospace.nlocs(); oops::Log::info() << "nlocs =" << nlocs << std::endl; std::vector buffer(nlocs); - // below is grabbing from the IODA obs space the specified group/variable and putting it into the buffer + // below is grabbing from the IODA obs space + // the specified group/variable and putting it into the buffer if (chan == 0) { // no channel is selected ospace.get_db(group, variable, buffer); @@ -67,12 +74,15 @@ namespace gdasapp { } // the below line computes the mean, aka sum divided by count - const float mean = std::accumulate(buffer.begin(), buffer.end(), 0) / float(nlocs); + const float mean = std::accumulate(buffer.begin(), buffer.end(), 0) / + static_cast(nlocs); // write the mean out to the stdout - oops::Log::info() << "mean value for " << group << "/" << variable << "=" << mean << std::endl; + oops::Log::info() << "mean value for " << group << "/" << variable + << "=" << mean << std::endl; - // a better program should return a real exit code depending on result, but this is just an example! + // a better program should return a real exit code depending on result, + // but this is just an example! return 0; } // ----------------------------------------------------------------------------- @@ -84,3 +94,5 @@ namespace gdasapp { }; } // namespace gdasapp + +#endif // GDAS_UTILS_IODA_EXAMPLE_GDAS_MEANIODA_H_ diff --git a/utils/soca/gdas_incr_handler.cc b/utils/soca/gdas_incr_handler.cc index 65ce9ac43..ebba07282 100644 --- a/utils/soca/gdas_incr_handler.cc +++ b/utils/soca/gdas_incr_handler.cc @@ -1,4 +1,4 @@ -#include "gdas_incr_handler.h" +#include "soca/gdas_incr_handler.h" #include "oops/runs/Run.h" int main(int argc, char ** argv) { diff --git a/utils/soca/gdas_incr_handler.h b/utils/soca/gdas_incr_handler.h index 1d3d7cf19..f8e1ddc4c 100644 --- a/utils/soca/gdas_incr_handler.h +++ b/utils/soca/gdas_incr_handler.h @@ -1,6 +1,11 @@ +#ifndef GDAS_UTILS_SOCA_GDAS_INCR_HANDLER_H_ +#define GDAS_UTILS_SOCA_GDAS_INCR_HANDLER_H_ + #include -#include + #include +#include +#include #include "eckit/config/LocalConfiguration.h" @@ -18,7 +23,7 @@ #include "soca/LinearVariableChange/LinearVariableChange.h" #include "soca/State/State.h" -# include "gdas_postprocincr.h" +#include "soca/gdas_postprocincr.h" namespace gdasapp { @@ -29,7 +34,6 @@ namespace gdasapp { static const std::string classname() {return "gdasapp::SocaIncrHandler";} int execute(const eckit::Configuration & fullConfig, bool /*validate*/) const { - /// Setup the soca geometry const eckit::LocalConfiguration geomConfig(fullConfig, "geometry"); oops::Log::info() << "geometry: " << std::endl << geomConfig << std::endl; @@ -39,7 +43,8 @@ namespace gdasapp { // Initialize the post processing PostProcIncr postProcIncr(fullConfig, geom, this->getComm()); - oops::Log::info() << "soca increments: " << std::endl << postProcIncr.inputIncrConfig_ << std::endl; + oops::Log::info() << "soca increments: " << std::endl + << postProcIncr.inputIncrConfig_ << std::endl; // Process list of increments int result = 0; @@ -70,3 +75,5 @@ namespace gdasapp { } }; } // namespace gdasapp + +#endif // GDAS_UTILS_SOCA_GDAS_INCR_HANDLER_H_ diff --git a/utils/soca/gdas_postprocincr.h b/utils/soca/gdas_postprocincr.h index 613c9cd3c..a0611972b 100644 --- a/utils/soca/gdas_postprocincr.h +++ b/utils/soca/gdas_postprocincr.h @@ -1,9 +1,11 @@ -#ifndef GDAS_POSTPROCINCR_H -#define GDAS_POSTPROCINCR_H +#ifndef GDAS_UTILS_SOCA_GDAS_POSTPROCINCR_H_ +#define GDAS_UTILS_SOCA_GDAS_POSTPROCINCR_H_ -#include #include +#include +#include + #include "eckit/config/LocalConfiguration.h" #include "atlas/field.h" @@ -22,7 +24,7 @@ namespace gdasapp { class PostProcIncr { -public: + public: // Constructor PostProcIncr(const eckit::Configuration & fullConfig, const soca::Geometry& geom, const eckit::mpi::Comm & comm) @@ -33,7 +35,7 @@ class PostProcIncr { xTraj_(getTraj(fullConfig, geom)), comm_(comm), ensSize_(1), - pattern_(){ + pattern_() { oops::Log::info() << "Date: " << std::endl << dt_ << std::endl; @@ -73,18 +75,18 @@ class PostProcIncr { } // Append layer thicknesses to increment - // TODO: There's got to be a better way to append a variable. - soca::Increment appendLayer(const int n){ + // TODO(guillaume): There's got to be a better way to append a variable. + soca::Increment appendLayer(const int n) { oops::Log::info() << "==========================================" << std::endl; oops::Log::info() << "====== Append Layers" << std::endl; // initialize the soca increment soca::Increment socaIncr(geom_, socaIncrVar_, dt_); - eckit::LocalConfiguration memberConfig; //inputIncrConfig_); + eckit::LocalConfiguration memberConfig; // inputIncrConfig_); memberConfig = inputIncrConfig_; // replace templated string if necessary - if (not pattern_.empty()) { + if (!pattern_.empty()) { util::seekAndReplace(memberConfig, pattern_, std::to_string(n)); oops::Log::info() << "oooooooooooooooooooooooooooooooooooo" << memberConfig << std::endl; } @@ -124,7 +126,7 @@ class PostProcIncr { // Set specified variables to 0 soca::Increment setToZero(soca::Increment socaIncr) { oops::Log::info() << "==========================================" << std::endl; - if (not this->setToZero_) { + if (!this->setToZero_) { oops::Log::info() << "====== no variables to set to 0.0" << std::endl; return socaIncr; } @@ -154,7 +156,7 @@ class PostProcIncr { // Apply linear variable changes soca::Increment applyLinVarChange(soca::Increment socaIncr) { oops::Log::info() << "==========================================" << std::endl; - if (not this->doLVC_) { + if (!this->doLVC_) { return socaIncr; } oops::Log::info() << "====== applying specified change of variables" << std::endl; @@ -252,8 +254,8 @@ class PostProcIncr { // Utility functions // ----------------------------------------------------------------------------- // Recreate the soca filename from the configuration - // TODO: Change this in soca? - // TODO: Hard-coded for ocean, implement for seaice as well + // TODO(guillaume): Change this in soca? + // TODO(guillaume): Hard-coded for ocean, implement for seaice as well std::string socaFname() { std::string datadir; outputIncrConfig_.get("datadir", datadir); @@ -284,7 +286,7 @@ class PostProcIncr { } -public: + public: util::DateTime dt_; // valid date of increment oops::Variables layerVar_; // layer variable const soca::Increment Layers_; // layer thicknesses @@ -303,6 +305,6 @@ class PostProcIncr { int ensSize_; std::string pattern_; }; -} // namespace gdasapp +} // namespace gdasapp -#endif // GDAS_POSTPROCINCR_H +#endif // GDAS_UTILS_SOCA_GDAS_POSTPROCINCR_H_ diff --git a/utils/soca/gdas_socahybridweights.cc b/utils/soca/gdas_socahybridweights.cc index 1a6ae38e1..a01612bc6 100644 --- a/utils/soca/gdas_socahybridweights.cc +++ b/utils/soca/gdas_socahybridweights.cc @@ -1,4 +1,4 @@ -#include "gdas_socahybridweights.h" +#include "soca/gdas_socahybridweights.h" #include "oops/runs/Run.h" int main(int argc, char ** argv) { diff --git a/utils/soca/gdas_socahybridweights.h b/utils/soca/gdas_socahybridweights.h index d6a52c357..be0182734 100644 --- a/utils/soca/gdas_socahybridweights.h +++ b/utils/soca/gdas_socahybridweights.h @@ -1,6 +1,11 @@ +#ifndef GDAS_UTILS_SOCA_GDAS_SOCAHYBRIDWEIGHTS_H_ +#define GDAS_UTILS_SOCA_GDAS_SOCAHYBRIDWEIGHTS_H_ + #include -#include + #include +#include +#include #include "eckit/config/LocalConfiguration.h" @@ -13,9 +18,9 @@ #include "oops/util/Duration.h" #include "oops/util/Logger.h" -#include "soca/State/State.h" #include "soca/Geometry/Geometry.h" #include "soca/Increment/Increment.h" +#include "soca/State/State.h" namespace gdasapp { @@ -26,7 +31,6 @@ namespace gdasapp { static const std::string classname() {return "gdasapp::SocaHybridWeights";} int execute(const eckit::Configuration & fullConfig, bool /*validate*/) const { - /// Setup the soca geometry const eckit::LocalConfiguration geomConfig(fullConfig, "geometry"); oops::Log::info() << "geometry: " << std::endl << geomConfig << std::endl; @@ -44,7 +48,7 @@ namespace gdasapp { socaVars += socaOcnVars; /// Read the background - // TODO: Use the ice extent to set the weights ... no clue if this is + // TODO(guillaume): Use the ice extent to set the weights ... no clue if this is // possible at this level soca::State socaBkg(geom, socaVars, dt); const eckit::LocalConfiguration socaBkgConfig(fullConfig, "background"); @@ -59,7 +63,7 @@ namespace gdasapp { oops::Log::info() << "wOcean: " << wOcean << std::endl; /// Create fields of weights for seaice - soca::Increment socaIceHW(geom, socaVars, dt); // ocean field is mandatory for writting + soca::Increment socaIceHW(geom, socaVars, dt); // ocean field is mandatory for writting socaIceHW.ones(); socaIceHW *= wIce; oops::Log::info() << "socaIceHW: " << std::endl << socaIceHW << std::endl; @@ -84,3 +88,5 @@ namespace gdasapp { }; } // namespace gdasapp + +#endif // GDAS_UTILS_SOCA_GDAS_SOCAHYBRIDWEIGHTS_H_