UFO
src/ufo/ObsDiagnostics.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2018 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 UFO_OBSDIAGNOSTICS_H_
9 #define UFO_OBSDIAGNOSTICS_H_
10 
11 #include <ostream>
12 #include <string>
13 #include <vector>
14 
15 #include <boost/noncopyable.hpp>
16 
17 #include "oops/util/Printable.h"
18 #include "ufo/GeoVaLs.h"
19 
20 // Forward declarations
21 namespace oops {
22  class Variables;
23 }
24 
25 namespace ioda {
26  class ObsSpace;
27 }
28 
29 namespace ufo {
30  class Locations;
31 
32 // -----------------------------------------------------------------------------
33 
34 class ObsDiagnostics : public util::Printable,
35  private boost::noncopyable {
36  public:
37  ObsDiagnostics(const ioda::ObsSpace &, const Locations &, const oops::Variables &);
38  ObsDiagnostics(const eckit::Configuration &, const ioda::ObsSpace &,
39  const oops::Variables &);
41 
42  /// \brief Allocate diagnostics for variables \p vars with \p nlev number of levels
43  /// \details Fails if at least one of the \p vars doesn't exist in the ObsDiagnostics object.
44  /// Only allocates variables that haven't been allocated before.
45  /// Fails if one of \p vars is already allocated with a number of levels
46  /// different than \p nlev; doesn't reallocate variables that are already
47  /// allocated with \p nlev.
48  void allocate(const int nlev, const oops::Variables & vars);
49 
50  void save(const std::vector<double> &, const std::string &, const int);
51 
52 // Interfaces
53  int & toFortran() {return gdiags_.toFortran();}
54  const int & toFortran() const {return gdiags_.toFortran();}
55 
56  bool has(const std::string & var) const {return gdiags_.has(var);}
57  size_t nlevs(const std::string &) const;
58  void get(std::vector<float> &, const std::string &) const;
59  void get(std::vector<float> &, const std::string &, const int) const;
60 
61  void write(const eckit::Configuration & config) const {
62  gdiags_.write(config);}
63  private:
64  void print(std::ostream &) const;
65  const ioda::ObsSpace & obsdb_;
66 
68 };
69 
70 // -----------------------------------------------------------------------------
71 
72 } // namespace ufo
73 
74 #endif // UFO_OBSDIAGNOSTICS_H_
GeoVaLs: geophysical values at locations.
bool has(const std::string &var) const
void write(const eckit::Configuration &) const
Write GeoVaLs to the file.
Definition: GeoVaLs.cc:495
Locations class to handle simple lat-lon-time locations.
void get(std::vector< float > &, const std::string &) const
void allocate(const int nlev, const oops::Variables &vars)
Allocate diagnostics for variables vars with nlev number of levels.
void print(std::ostream &) const
const ioda::ObsSpace & obsdb_
const int & toFortran() const
size_t nlevs(const std::string &) const
void write(const eckit::Configuration &config) const
ObsDiagnostics(const ioda::ObsSpace &, const Locations &, const oops::Variables &)
bool has(const std::string &var) const
void save(const std::vector< double > &, const std::string &, const int)
Forward declarations.
Definition: ObsAodExt.h:25
Definition: RunCRTM.h:27