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 <vector>
11 
12 #include "ioda/ObsSpace.h"
13 
14 #include "ufo/utils/Constants.h"
15 
16 namespace ufo {
17 
18 static PredictorMaker<CosineOfLatitudeTimesOrbitNode>
19  makerFuncCosineOfLatitudeTimesOrbitNode_("cosine_of_latitude_times_orbit_node");
20 
21 // -----------------------------------------------------------------------------
22 
24  const oops::Variables & vars)
25  : PredictorBase(parameters, vars) {
26 }
27 
28 // -----------------------------------------------------------------------------
29 void CosineOfLatitudeTimesOrbitNode::compute(const ioda::ObsSpace & odb,
30  const GeoVaLs &,
31  const ObsDiagnostics &,
32  ioda::ObsVector & out) const {
33  const std::size_t nlocs = out.nlocs();
34  const std::size_t nvars = out.nvars();
35 
36  // retrieve the sensor view angle
37  std::vector<float> cenlat(nlocs, 0.0);
38  std::vector<float> node(nlocs, 0.0);
39  odb.get_db("MetaData", "latitude", cenlat);
40  odb.get_db("MetaData", "sensor_azimuth_angle", node);
41 
42  for (std::size_t jloc = 0; jloc < nlocs; ++jloc) {
43  for (std::size_t jvar = 0; jvar < nvars; ++jvar) {
44  out[jloc*nvars+jvar] = node[jloc] * cos(cenlat[jloc] * Constants::deg2rad);
45  }
46  }
47 }
48 
49 // -----------------------------------------------------------------------------
50 
51 } // namespace ufo
CosineOfLatitudeTimesOrbitNode(const Parameters_ &, const oops::Variables &)
void compute(const ioda::ObsSpace &, const GeoVaLs &, const ObsDiagnostics &, ioda::ObsVector &) const override
compute the predictor
GeoVaLs: geophysical values at locations.
integer function nlocs(this)
Return the number of observational locations in this Locations object.
Definition: RunCRTM.h:27
static PredictorMaker< CosineOfLatitudeTimesOrbitNode > makerFuncCosineOfLatitudeTimesOrbitNode_("cosine_of_latitude_times_orbit_node")
static constexpr double deg2rad
Definition: Constants.h:21