UFO
SineOfLatitude.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<SineOfLatitude>
19  makerFuncSineOfLatitude_("sine_of_latitude");
20 
21 // -----------------------------------------------------------------------------
22 
23 SineOfLatitude::SineOfLatitude(const Parameters_ & parameters, const oops::Variables & vars)
24  : PredictorBase(parameters, vars) {
25 }
26 
27 // -----------------------------------------------------------------------------
28 
29 void SineOfLatitude::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  odb.get_db("MetaData", "latitude", cenlat);
39 
40  for (std::size_t jloc = 0; jloc < nlocs; ++jloc) {
41  for (std::size_t jvar = 0; jvar < nvars; ++jvar) {
42  out[jloc*nvars+jvar] = sin(cenlat[jloc] * Constants::deg2rad);
43  }
44  }
45 }
46 
47 // -----------------------------------------------------------------------------
48 
49 } // namespace ufo
GeoVaLs: geophysical values at locations.
SineOfLatitude(const Parameters_ &, const oops::Variables &)
void compute(const ioda::ObsSpace &, const GeoVaLs &, const ObsDiagnostics &, ioda::ObsVector &) const override
compute the predictor
integer function nlocs(this)
Return the number of observational locations in this Locations object.
Definition: RunCRTM.h:27
static PredictorMaker< SineOfLatitude > makerFuncSineOfLatitude_("sine_of_latitude")
static constexpr double deg2rad
Definition: Constants.h:21