8 #ifndef OOPS_GENERIC_STATSVARIABLECHANGE_H_ 9 #define OOPS_GENERIC_STATSVARIABLECHANGE_H_ 13 #include <boost/noncopyable.hpp> 14 #include "eckit/config/Configuration.h" 33 template <
typename MODEL>
40 static const std::string
classname() {
return "oops::StatsVariableChange";}
43 const Geometry_ &,
const eckit::Configuration &);
54 void print(std::ostream &)
const override;
57 std::string& modelVarToCalcString,
58 std::string& varRegrByString);
60 std::vector<std::string>& modelVarToCalcList,
61 std::vector<std::string>& varRegrByList);
69 template<
typename MODEL>
72 const eckit::Configuration &
conf)
75 Log::trace() <<
"StatsVariableChange<MODEL>::StatsVariableChange starting" << std::endl;
77 const eckit::Configuration * fconf = &
conf;
80 std::cout <<
conf << std::endl;
81 const eckit::LocalConfiguration varConfig(
conf,
"variables");
98 std::ifstream infile(
"bump.test");
100 while (std::getline(infile, line))
Log::test() << line << std::endl;
103 Log::trace() <<
"StatsVariableChange<MODEL>::StatsVariableChange done" << std::endl;
106 template<
typename MODEL>
108 Log::trace() <<
"StatsVariableChange<MODEL>::~StatsVariableChange starting" << std::endl;
109 Log::trace() <<
"StatsVariableChange<MODEL>::~StatsVariableChange done" << std::endl;
112 template<
typename MODEL>
114 Log::trace() <<
"StatsVariableChange<MODEL>::multiply starting" << std::endl;
119 out.field_from_ug(ug);
121 Log::trace() <<
"StatsVariableChange<MODEL>::multiply done" << std::endl;
124 template<
typename MODEL>
126 Log::trace() <<
"StatsVariableChange<MODEL>::multiplyInverse starting" << std::endl;
131 out.field_from_ug(ug);
133 Log::trace() <<
"StatsVariableChange<MODEL>::multiplyInverse done" << std::endl;
136 template<
typename MODEL>
138 Log::trace() <<
"StatsVariableChange<MODEL>::multiplyAD starting" << std::endl;
143 out.field_from_ug(ug);
145 Log::trace() <<
"StatsVariableChange<MODEL>::multiplyAD done" << std::endl;
148 template<
typename MODEL>
150 Log::trace() <<
"StatsVariableChange<MODEL>::multiplyInverseAD starting" << std::endl;
155 out.field_from_ug(ug);
157 Log::trace() <<
"StatsVariableChange<MODEL>::multiplyInverseAD done" << std::endl;
160 template<
typename MODEL>
164 template<
typename MODEL>
168 for (
int iCharIndex = pathString.length(); iCharIndex > 0; --iCharIndex)
170 if (pathString.substr(iCharIndex - 1, 1) ==
"/")
172 return pathString.substr(iCharIndex, pathString.length() - iCharIndex);
174 tempIndex = iCharIndex;
176 std::cout <<
"ExtractFileName: tempIndex = " << tempIndex << std::endl;
177 throw std::runtime_error(
"FileName not extracted from path " + pathString);
183 template<
typename MODEL>
185 std::string& modelVarToCalcString,
186 std::string& varRegrByString)
190 int firstUnderscoreIndex, lastUnderscoreIndex;
191 for (
int iCharIndex = 0; iCharIndex < fileString.length() - 1; ++iCharIndex)
193 firstUnderscoreIndex = iCharIndex;
194 if (fileString.substr(iCharIndex, 2) ==
"__")
199 for (
int iCharIndex = fileString.length(); iCharIndex > 0; --iCharIndex)
201 lastUnderscoreIndex = iCharIndex - 1;
202 if (fileString.substr(iCharIndex-1, 2) ==
"__")
207 modelVarToCalcString = fileString.substr(0, firstUnderscoreIndex);
208 varRegrByString = fileString.substr(firstUnderscoreIndex + 2,
209 lastUnderscoreIndex - firstUnderscoreIndex - 2);
213 template<
typename MODEL>
215 std::vector<std::string>& modelVarToCalcList,
216 std::vector<std::string>& varRegrByList)
218 std::string modelVarToCalcString;
219 std::string varRegrByString;
220 std::string filename;
221 for (
auto pathString : pathStrList)
223 modelVarToCalcString.clear();
224 varRegrByString.clear();
225 filename = ExtractFilename(pathString);
226 ExtractModelVarForCalc(filename, modelVarToCalcString, varRegrByString);
227 modelVarToCalcList.push_back(modelVarToCalcString);
228 varRegrByList.push_back(varRegrByString);
235 #endif // OOPS_GENERIC_STATSVARIABLECHANGE_H_ void multiplyInverse(const Increment_ &, Increment_ &) const override
void ExtractModelVarForCalc(std::string const fileString, std::string &modelVarToCalcString, std::string &varRegrByString)
static const std::string classname()
void multiply(const Increment_ &, Increment_ &) const override
void multiply_oobump_vbal_inv_ad_f90(const int &, const int &)
void multiply_oobump_vbal_f90(const int &, const int &)
StatsVariableChange(const State_ &, const State_ &, const Geometry_ &, const eckit::Configuration &)
Encapsulates the model state.
The namespace for the main oops code.
void create_oobump_f90(int &, const int &, const eckit::Configuration *const *, const int &, const int &, const int &, const int &)
void multiply_oobump_vbal_ad_f90(const int &, const int &)
Derived class of generic variable transform for statistical.
void field_to_ug(UnstructuredGrid &, const int &) const
Geometry< MODEL > Geometry_
Increment< MODEL > Increment_
virtual ~StatsVariableChange()
Base class for generic variable transform.
std::string ExtractFilename(std::string const pathString)
void multiplyAD(const Increment_ &, Increment_ &) const override
Increment Class: Difference between two states.
void multiplyInverseAD(const Increment_ &, Increment_ &) const override
void run_oobump_drivers_f90(const int &)
void VariableLists(const std::vector< std::string > pathStrList, std::vector< std::string > &modelVarToCalcList, std::vector< std::string > &varRegrByList)
void print(std::ostream &) const override
const std::vector< std::string > pathStrList
void multiply_oobump_vbal_inv_f90(const int &, const int &)