UFO
Emissivity.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/GeoVaLs.h"
15 #include "ufo/ObsDiagnostics.h"
16 
17 #include "oops/base/Variables.h"
18 #include "oops/util/abor1_cpp.h"
19 #include "oops/util/Logger.h"
20 
21 namespace ufo {
22 
24 
25 // -----------------------------------------------------------------------------
26 
27 Emissivity::Emissivity(const eckit::Configuration & conf, const std::vector<int> & jobs)
28  : PredictorBase(conf, jobs) {
29  // required variables
30  geovars_ += oops::Variables({"water_area_fraction"});
31  if (jobs.size() > 0) {
32  hdiags_ += oops::Variables({"brightness_temperature_jacobian_surface_emissivity"}, jobs);
33  } else {
34  oops::Log::error() << "Channels size is ZERO !" << std::endl;
35  ABORT("Channels size is ZERO !");
36  }
37 }
38 
39 // -----------------------------------------------------------------------------
40 
41 void Emissivity::compute(const ioda::ObsSpace & odb,
42  const GeoVaLs & geovals,
43  const ObsDiagnostics & ydiags,
44  ioda::ObsVector & out) const {
45  const std::size_t njobs = jobs_.size();
46  const std::size_t nlocs = odb.nlocs();
47 
48  // assure shape of out
49  ASSERT(out.nlocs() == nlocs);
50 
51  std::vector <float> pred(nlocs, 0.0);
52  std::vector<float> h2o_frac(nlocs, 0.0);
53  geovals.get(h2o_frac, "water_area_fraction");
54  std::string hdiags;
55  out.zero();
56  for (std::size_t jb = 0; jb < njobs; ++jb) {
57  hdiags = "brightness_temperature_jacobian_surface_emissivity_" + std::to_string(jobs_[jb]);
58  ydiags.get(pred, hdiags);
59  for (std::size_t jl = 0; jl < nlocs; ++jl) {
60  if (h2o_frac[jl] < 0.99 && std::fabs(pred[jl]) > 0.001) {
61  out[jl*njobs+jb] = pred[jl];
62  }
63  }
64  }
65 }
66 
67 // -----------------------------------------------------------------------------
68 
69 } // namespace ufo
ufo::Emissivity::compute
void compute(const ioda::ObsSpace &, const GeoVaLs &, const ObsDiagnostics &, ioda::ObsVector &) const override
compute the predictor
Definition: Emissivity.cc:41
ufo::PredictorBase::hdiags_
oops::Variables hdiags_
required ObsDiagnostics
Definition: PredictorBase.h:62
ufo::makerFuncEmissivity_
static PredictorMaker< Emissivity > makerFuncEmissivity_("emissivity")
ufo::Emissivity::Emissivity
Emissivity(const eckit::Configuration &, const std::vector< int > &)
Definition: Emissivity.cc:27
ufo
Definition: RunCRTM.h:27
ufo::GeoVaLs::get
void get(std::vector< float > &, const std::string &) const
Return all values for a specific 2D variable.
Definition: GeoVaLs.cc:268
ufo::PredictorMaker
Definition: PredictorBase.h:89
ufo::PredictorBase::geovars_
oops::Variables geovars_
required GeoVaLs
Definition: PredictorBase.h:61
ufo::ObsDiagnostics
Definition: src/ufo/ObsDiagnostics.h:35
ufo::PredictorBase
Base class for computing predictors.
Definition: PredictorBase.h:38
ufo::GeoVaLs
GeoVaLs: geophysical values at locations.
Definition: src/ufo/GeoVaLs.h:39
ufo::ObsDiagnostics::get
void get(std::vector< float > &, const std::string &) const
Definition: ObsDiagnostics.cc:51
Emissivity.h
ufo::PredictorBase::jobs_
const std::vector< int > jobs_
jobs(channels)
Definition: PredictorBase.h:60
conf
Definition: conf.py:1