UFO
CosineOfLatitudeTimesOrbitNode.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2020 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 
9 
10 #include "ioda/ObsSpace.h"
11 
12 #include "ufo/utils/Constants.h"
13 
14 namespace ufo {
15 
16 static PredictorMaker<CosineOfLatitudeTimesOrbitNode>
17  makerFuncCosineOfLatitudeTimesOrbitNode_("cosine_of_latitude_times_orbit_node");
18 
19 // -----------------------------------------------------------------------------
20 
22  const eckit::Configuration & conf, const std::vector<int> & jobs)
23  : PredictorBase(conf, jobs) {
24  // override the preconditioner from options
25  if (conf.has("predictor.options"))
26  precond_ = conf.getDouble("predictor.options.preconditioner");
27 }
28 
29 // -----------------------------------------------------------------------------
30 void CosineOfLatitudeTimesOrbitNode::compute(const ioda::ObsSpace & odb,
31  const GeoVaLs &,
32  const ObsDiagnostics &,
33  ioda::ObsVector & out) const {
34  const std::size_t nlocs = odb.nlocs();
35 
36  // assure shape of out
37  ASSERT(out.nlocs() == nlocs);
38 
39  // retrieve the sensor view angle
40  std::vector<float> cenlat(nlocs, 0.0);
41  std::vector<float> node(nlocs, 0.0);
42  odb.get_db("MetaData", "latitude", cenlat);
43  odb.get_db("MetaData", "sensor_azimuth_angle", node);
44 
45  const std::size_t njobs = jobs_.size();
46  for (std::size_t jl = 0; jl < nlocs; ++jl) {
47  for (std::size_t jb = 0; jb < njobs; ++jb) {
48  out[jl*njobs+jb] = node[jl] * cos(cenlat[jl] * Constants::deg2rad);
49  }
50  }
51 }
52 
53 // -----------------------------------------------------------------------------
54 
55 } // namespace ufo
ufo::CosineOfLatitudeTimesOrbitNode::CosineOfLatitudeTimesOrbitNode
CosineOfLatitudeTimesOrbitNode(const eckit::Configuration &, const std::vector< int > &)
Definition: CosineOfLatitudeTimesOrbitNode.cc:21
ufo
Definition: RunCRTM.h:27
ufo::CosineOfLatitudeTimesOrbitNode::precond_
double precond_
Definition: CosineOfLatitudeTimesOrbitNode.h:41
ufo::ObsDiagnostics
Definition: src/ufo/ObsDiagnostics.h:35
ufo::makerFuncCosineOfLatitudeTimesOrbitNode_
static PredictorMaker< CosineOfLatitudeTimesOrbitNode > makerFuncCosineOfLatitudeTimesOrbitNode_("cosine_of_latitude_times_orbit_node")
ufo::PredictorBase
Base class for computing predictors.
Definition: PredictorBase.h:38
ufo::Constants::deg2rad
static constexpr double deg2rad
Definition: Constants.h:21
ufo::GeoVaLs
GeoVaLs: geophysical values at locations.
Definition: src/ufo/GeoVaLs.h:39
ufo::CosineOfLatitudeTimesOrbitNode::compute
void compute(const ioda::ObsSpace &, const GeoVaLs &, const ObsDiagnostics &, ioda::ObsVector &) const override
compute the predictor
Definition: CosineOfLatitudeTimesOrbitNode.cc:30
CosineOfLatitudeTimesOrbitNode.h
ufo::PredictorBase::jobs_
const std::vector< int > jobs_
jobs(channels)
Definition: PredictorBase.h:60
Constants.h
conf
Definition: conf.py:1