FV3 Bundle
ObsTable.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
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  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef LORENZ95_OBSTABLE_H_
12 #define LORENZ95_OBSTABLE_H_
13 
14 #include <fstream>
15 #include <map>
16 #include <ostream>
17 #include <string>
18 #include <vector>
19 
21 #include "oops/util/DateTime.h"
22 #include "oops/util/ObjectCounter.h"
23 
24 namespace eckit {
25  class Configuration;
26 }
27 
28 namespace lorenz95 {
29  class LocsL95;
30  class ObsVec1D;
31 
32 /// A Simple Observation Data Handler
33 /*!
34  * ObsTable defines a simple observation handler
35  * that mimicks the interfaces required from ODB.
36  */
37 
38 // -----------------------------------------------------------------------------
40  private util::ObjectCounter<ObsTable> {
41  public:
42  static const std::string classname() {return "lorenz95::ObsTable";}
43 
44  ObsTable(const eckit::Configuration &, const util::DateTime &, const util::DateTime &);
45  ~ObsTable();
46 
47  void putdb(const std::string &, const std::vector<double> &) const;
48  void getdb(const std::string &, std::vector<double> &) const;
49 
50  LocsL95 * locations(const util::DateTime & t1, const util::DateTime & t2) const;
51  std::vector<int> timeSelect(const util::DateTime &, const util::DateTime &) const;
52  void generateDistribution(const eckit::Configuration &);
53  void printJo(const ObsVec1D &, const ObsVec1D &);
54  unsigned int nobs() const {return times_.size();}
55 
56  private:
57  void print(std::ostream &) const;
58  void otOpen(const std::string &);
59  void otWrite(const std::string &) const;
60 
61  const util::DateTime winbgn_;
62  const util::DateTime winend_;
63 
64  std::vector<util::DateTime> times_;
65  std::vector<double> locations_;
66  mutable std::map<std::string, std::vector<double> > data_;
67 
68  std::string nameIn_;
69  std::string nameOut_;
70 };
71 // -----------------------------------------------------------------------------
72 } // namespace lorenz95
73 
74 #endif // LORENZ95_OBSTABLE_H_
void otWrite(const std::string &) const
std::map< std::string, std::vector< double > > data_
Definition: ObsTable.h:66
std::vector< util::DateTime > times_
Definition: ObsTable.h:64
std::vector< int > timeSelect(const util::DateTime &, const util::DateTime &) const
void putdb(const std::string &, const std::vector< double > &) const
real, parameter t2
void print(std::ostream &) const
std::string nameOut_
Definition: ObsTable.h:69
LocsL95 * locations(const util::DateTime &t1, const util::DateTime &t2) const
LocsL95 class to handle locations for L95 model.
Definition: LocsL95.h:28
Vector in observation space.
Definition: ObsVec1D.h:32
void getdb(const std::string &, std::vector< double > &) const
Base class for observation spaces.
Definition: ObsSpaceBase.h:25
const util::DateTime winbgn_
Definition: ObsTable.h:61
void otOpen(const std::string &)
std::vector< double > locations_
Definition: ObsTable.h:65
unsigned int nobs() const
Definition: ObsTable.h:54
std::string nameIn_
Definition: ObsTable.h:68
The namespace for the L95 model.
real, parameter t1
void printJo(const ObsVec1D &, const ObsVec1D &)
A Simple Observation Data Handler.
Definition: ObsTable.h:39
void generateDistribution(const eckit::Configuration &)
Pure virtual methods.
ObsTable(const eckit::Configuration &, const util::DateTime &, const util::DateTime &)
static const std::string classname()
Definition: ObsTable.h:42
const util::DateTime winend_
Definition: ObsTable.h:62