11 #ifndef OOPS_ASSIMILATION_STATE4D_H_ 12 #define OOPS_ASSIMILATION_STATE4D_H_ 18 #include <boost/foreach.hpp> 19 #include <boost/ptr_container/ptr_vector.hpp> 21 #include "eckit/config/LocalConfiguration.h" 24 #include "oops/util/Logger.h" 25 #include "oops/util/Printable.h" 35 template<
typename MODEL>
class State4D :
public util::Printable {
40 static const std::string
classname() {
return "State4D";}
48 void read(
const eckit::Configuration &);
49 void write(
const eckit::Configuration &)
const;
60 void print(std::ostream &)
const;
67 template<
typename MODEL>
70 std::vector<eckit::LocalConfiguration>
files;
71 config.get(
"state",
files);
72 Log::debug() <<
"State4D: reading " <<
files.size() <<
" states." << std::endl;
74 for (
size_t jsub = 0; jsub <
files.size(); ++jsub) {
77 Log::debug() <<
"State4D:State4D: read bg at " <<
js->validTime() << std::endl;
78 state4d_.push_back(
js);
80 Log::trace() <<
"State4D constructed." << std::endl;
85 template<
typename MODEL>
87 BOOST_FOREACH(
const State_ &
js, other.state4d_)
89 Log::trace() <<
"State4D copied." << std::endl;
94 template<
typename MODEL>
96 Log::trace() <<
"State4D destructed." << std::endl;
101 template<
typename MODEL>
103 std::vector<eckit::LocalConfiguration> confs;
104 config.get(
"state", confs);
105 ASSERT(state4d_.size() == confs.size());
107 BOOST_FOREACH(
State_ &
js, state4d_) {
108 Log::debug() <<
"State4D:read" << confs[jsub] << std::endl;
109 js.read(confs[jsub]);
116 template<
typename MODEL>
118 std::vector<eckit::LocalConfiguration> confs;
119 config.get(
"state", confs);
120 ASSERT(state4d_.size() == confs.size());
121 unsigned int jsub = 0;
122 BOOST_FOREACH(
const State_ &
js, state4d_) {
123 Log::debug() <<
"State4D:write" << confs[jsub] << std::endl;
124 js.write(confs[jsub]);
131 template <
typename MODEL>
133 BOOST_FOREACH(
const State_ &
js, state4d_) {
134 outs <<
js << std::endl;
140 template<
typename MODEL>
143 BOOST_FOREACH(
const State_ &
js, state4d_) {
144 double zz =
js.norm();
154 #endif // OOPS_ASSIMILATION_STATE4D_H_
void read(const eckit::Configuration &)
I/O and diagnostics.
Geometry< MODEL > Geometry_
void write(const eckit::Configuration &) const
Encapsulates the model state.
The namespace for the main oops code.
State_ & operator[](const int ii)
type(file_type), dimension(:), allocatable, save files
const State_ & operator[](const int ii) const
boost::ptr_vector< State_ > state4d_
State4D & operator=(const State4D &)
void print(std::ostream &) const
static const std::string classname()
bool checkStatesNumber(const unsigned int nn) const
Get model space control variable.
l_size ! loop over number of fields ke do je do ie to js
State4D(const eckit::Configuration &, const Variables &, const Geometry_ &)
The arguments define the number of sub-windows and the resolution.