FV3 Bundle
RunCRTM.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017 UCAR
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #ifndef MAINS_RUNCRTM_H_
9 #define MAINS_RUNCRTM_H_
10 
11 #include <string>
12 #include <vector>
13 
14 #include "eckit/config/LocalConfiguration.h"
15 
16 #include "oops/base/Observations.h"
17 #include "oops/base/ObsSpaces.h"
21 #include "oops/runs/Application.h"
22 #include "oops/util/DateTime.h"
23 #include "oops/util/Duration.h"
24 #include "oops/util/Logger.h"
25 
26 namespace ufo {
27 
28 template <typename MODEL> class RunCRTM : public oops::Application {
35 
36  public:
37 // -----------------------------------------------------------------------------
38  RunCRTM() {}
39 // -----------------------------------------------------------------------------
40  virtual ~RunCRTM() {}
41 // -----------------------------------------------------------------------------
42  int execute(const eckit::Configuration & fullConfig) const {
43 // Setup observation window
44  const eckit::LocalConfiguration windowConf(fullConfig, "Assimilation Window");
45  const util::Duration winlen(windowConf.getString("Length"));
46  const util::DateTime winbgn(windowConf.getString("Begin"));
47  const util::DateTime winend(winbgn + winlen);
48  oops::Log::info() << "Observation window is:" << windowConf << std::endl;
49 
50 // Setup observations
51  eckit::LocalConfiguration obsconf(fullConfig, "Observations");
52  oops::Log::debug() << "Observations configuration is:" << obsconf << std::endl;
53  ObsSpace_ obsdb(obsconf, winbgn, winend);
54 
55  std::vector<eckit::LocalConfiguration> conf;
56  obsconf.get("ObsTypes", conf);
57 
58  for (std::size_t jj = 0; jj < obsdb.size(); ++jj) {
59  ObsOperator_ hop(obsdb[jj]);
60 
61  const eckit::LocalConfiguration gconf(conf[jj], "GeoVaLs");
62  const GeoVaLs_ gval(gconf, hop.variables());
63 
64  eckit::LocalConfiguration biasConf;
65  conf[jj].get("ObsBias", biasConf);
66  const ObsAuxCtrl_ ybias(biasConf);
67 
68  ObsVector_ ovec(obsdb[jj]);
69 
70  hop.simulateObs(gval, ovec, ybias);
71 
72  const double zz = ovec.rms();
73  const double xx = conf[jj].getDouble("rmsequiv");
74  const double tol = conf[jj].getDouble("tolerance");
75 // BOOST_CHECK_CLOSE(xx, zz, tol);
76  }
77 
78  return 0;
79  }
80 // -----------------------------------------------------------------------------
81  private:
82  std::string appname() const {
83  return "oops::RunCRTM<" + MODEL::name() + ">";
84  }
85 // -----------------------------------------------------------------------------
86 };
87 
88 } // namespace ufo
89 
90 #endif // MAINS_RUNCRTM_H_
oops::GeoVaLs< MODEL > GeoVaLs_
Definition: RunCRTM.h:29
std::string appname() const
Definition: RunCRTM.h:82
const Variables & variables() const
Other.
int execute(const eckit::Configuration &fullConfig) const
Definition: RunCRTM.h:42
Definition: conf.py:1
virtual ~RunCRTM()
Definition: RunCRTM.h:40
oops::Observations< MODEL > Observations_
Definition: RunCRTM.h:31
Observations Class.
Definition: Observations.h:36
character(len=32) name
logical debug
Definition: mpp.F90:1297
subroutine, public info(self)
oops::ObsVector< MODEL > ObsVector_
Definition: RunCRTM.h:34
oops::ObsOperator< MODEL > ObsOperator_
Definition: RunCRTM.h:32
oops::ObsSpaces< MODEL > ObsSpace_
Definition: RunCRTM.h:33
oops::ObsAuxControl< MODEL > ObsAuxCtrl_
Definition: RunCRTM.h:30
void simulateObs(const GeoVaLs_ &, ObsVector_ &, const ObsAuxControl_ &) const
Obs Operator.
std::size_t size() const
Access.
Definition: ObsSpaces.h:51