FV3 Bundle
src/lorenz95/LocsL95.cc
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 #include "lorenz95/LocsL95.h"
12 
13 #include "eckit/config/Configuration.h"
14 #include "lorenz95/ObsTable.h"
15 #include "oops/util/DateTime.h"
16 
17 namespace lorenz95 {
18 
19 // -----------------------------------------------------------------------------
20 
21 LocsL95::LocsL95(const std::vector<int> & indx, const std::vector<double> & locs)
22  : indx_(indx), locs_(locs)
23 {
24  ASSERT(indx_.size() == locs_.size());
25 }
26 
27 // -----------------------------------------------------------------------------
28 
29 LocsL95::LocsL95(const eckit::Configuration & conf) : indx_(), locs_() {
30  conf.get("positions", locs_);
31  for (size_t jj = 0; jj < locs_.size(); ++jj) {
32  ASSERT(locs_.at(jj) >= 0.0 && locs_.at(jj) <= 1.0);
33  indx_.push_back(jj + 1);
34  }
35 }
36 
37 // -----------------------------------------------------------------------------
38 
39 void LocsL95::print(std::ostream & os) const {
40  os << locs_.size();
41  if (locs_.size() > 0) os << " " << locs_.at(0);
42  if (locs_.size() > 1) os << " " << locs_.at(locs_.size() - 1);
43 }
44 
45 // -----------------------------------------------------------------------------
46 
47 } // namespace lorenz95
std::vector< int > indx_
Definition: LocsL95.h:43
Definition: conf.py:1
LocsL95(const std::vector< int > &, const std::vector< double > &)
The namespace for the L95 model.
std::vector< double > locs_
Definition: LocsL95.h:44
void print(std::ostream &os) const