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 
8 #include <string>
9 
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 eckit::Configuration & conf, const std::vector<int> & jobs)
24  : PredictorBase(conf, jobs) {
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 = odb.nlocs();
34 
35  // assure shape of out
36  ASSERT(out.nlocs() == nlocs);
37 
38  // retrieve the sensor view angle
39  std::vector<float> cenlat(nlocs, 0.0);
40  odb.get_db("MetaData", "latitude", cenlat);
41 
42  const std::size_t njobs = jobs_.size();
43  for (std::size_t jl = 0; jl < nlocs; ++jl) {
44  for (std::size_t jb = 0; jb < njobs; ++jb) {
45  out[jl*njobs+jb] = sin(cenlat[jl] * Constants::deg2rad);
46  }
47  }
48 }
49 
50 // -----------------------------------------------------------------------------
51 
52 } // namespace ufo
ufo::SineOfLatitude::compute
void compute(const ioda::ObsSpace &, const GeoVaLs &, const ObsDiagnostics &, ioda::ObsVector &) const override
compute the predictor
Definition: SineOfLatitude.cc:29
ufo::makerFuncSineOfLatitude_
static PredictorMaker< SineOfLatitude > makerFuncSineOfLatitude_("sine_of_latitude")
ufo
Definition: RunCRTM.h:27
ufo::ObsDiagnostics
Definition: src/ufo/ObsDiagnostics.h:35
SineOfLatitude.h
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::SineOfLatitude::SineOfLatitude
SineOfLatitude(const eckit::Configuration &, const std::vector< int > &)
Definition: SineOfLatitude.cc:23
ufo::PredictorBase::jobs_
const std::vector< int > jobs_
jobs(channels)
Definition: PredictorBase.h:60
Constants.h
conf
Definition: conf.py:1