16 #include "eckit/config/LocalConfiguration.h"
17 #include "eckit/types/Types.h"
19 #include "oops/util/Logger.h"
20 #include "oops/util/missingValues.h"
26 const util::DateTime & bgn,
const util::DateTime & end,
27 const eckit::mpi::Comm & time)
28 : obstable_(new
ObsTable(config, comm, bgn, end, time)),
29 localobs_(obstable_->nobs()), obsdist_(obstable_->nobs(), 0.0)
32 oops::Log::trace() <<
"ObsTableView::ObsTableView created nobs = " <<
nobs() << std::endl;
38 const eckit::geometry::Point2 & center,
39 const eckit::Configuration & conf)
40 : obstable_(obstable.obstable_), localobs_(), obsdist_()
43 const double dist = conf.getDouble(
"lengthscale");
44 for (
unsigned int jj = 0; jj < obstable.
nobs(); ++jj) {
45 double curdist = std::abs(center[0] -
locations[jj]);
46 curdist = std::min(curdist, 1.-curdist);
47 if ( curdist < dist ) {
52 oops::Log::trace() <<
"ObsTableView::ObsTableView created" << std::endl;
58 oops::Log::trace() <<
"ObsTableView::ObsTableView destructed" << std::endl;
64 oops::Log::trace() <<
"ObsTableView::has" << std::endl;
72 std::vector<int> fullvec(
obstable_->nobs(), util::missingValue(missing));
76 for (
unsigned int i = 0; i <
nobs(); i++) {
80 oops::Log::trace() <<
"ObsTableView::putdb done" << std::endl;
87 std::vector<float> fullvec(
obstable_->nobs(), util::missingValue(missing));
91 for (
unsigned int i = 0; i <
nobs(); i++) {
95 oops::Log::trace() <<
"ObsTableView::putdb done" << std::endl;
102 std::vector<double> fullvec(
obstable_->nobs(), util::missingValue(missing));
106 for (
unsigned int i = 0; i <
nobs(); i++) {
110 oops::Log::trace() <<
"ObsTableView::putdb done" << std::endl;
116 std::vector<int> fullvec;
119 for (
unsigned int i = 0; i <
nobs(); i++) {
122 oops::Log::trace() <<
"ObsTableView::getdb done" << std::endl;
128 std::vector<float> fullvec;
131 for (
unsigned int i = 0; i <
nobs(); i++) {
134 oops::Log::trace() <<
"ObsTableView::getdb done" << std::endl;
140 std::vector<double> fullvec;
143 for (
unsigned int i = 0; i <
nobs(); i++) {
146 oops::Log::trace() <<
"ObsTableView::getdb done" << std::endl;
153 oops::Log::trace() <<
"ObsTableView::random done" << std::endl;
160 oops::Log::trace() <<
"ObsTableView::nobs done" << std::endl;
166 std::vector<double> full =
obstable_->locations();
167 std::vector<double> local(
nobs());
168 for (
unsigned int i = 0; i <
nobs(); i++) {
171 oops::Log::trace() <<
"ObsTableView::locations done" << std::endl;
180 for (
int i = 0; i <
nobs; i++)
182 oops::Log::trace() <<
"ObsTableView::generateDistribution done" << std::endl;
188 const util::DateTime & t2)
const {
190 std::vector<util::DateTime> all_times =
obstable_->times();
191 std::vector<double> all_locs =
obstable_->locations();
193 std::vector<int> mask;
194 for (
unsigned int i = 0; i <
nobs(); i++) {
199 const unsigned int nobs_t = mask.size();
200 std::vector<double> locs(nobs_t);
201 std::vector<util::DateTime> times(nobs_t);
202 for (
unsigned int i = 0; i < nobs_t; i++) {
204 times[i] = all_times[
localobs_[mask[i]]];
206 oops::Log::trace() <<
"ObsTableView::locations done" << std::endl;
207 return std::unique_ptr<LocsL95>(
new LocsL95(locs, times));
213 oops::Log::info() <<
"ObsTableView::printJo not implemented" << std::endl;
219 os <<
"Local observation indices: " <<
localobs_ << std::endl;