UFO
ObsFunctionScattering.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2019 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 <math.h>
11 #include <vector>
12 
13 #include "ioda/ObsDataVector.h"
14 #include "ufo/filters/Variable.h"
15 
16 namespace ufo {
17 
19 
20 // -----------------------------------------------------------------------------
21 
22 ObsFunctionScattering::ObsFunctionScattering(const eckit::LocalConfiguration)
23  : invars_() {
24  // empiracal formula is used to calculate AMSU-A scattering over ocean
25  std::vector<int> channels{1, 2, 15};
26  invars_ += Variable("brightness_temperature@ObsValue", channels);
27 }
28 
29 // -----------------------------------------------------------------------------
30 
32 
33 // -----------------------------------------------------------------------------
34 
36  ioda::ObsDataVector<float> & out) const {
37  // TODO(AS): should use constants for variable names
38  const size_t nlocs = input.nlocs();
39  std::vector<float> bt1, bt2, bt15;
40  input.get(Variable("brightness_temperature_1@ObsValue"), bt1);
41  input.get(Variable("brightness_temperature_2@ObsValue"), bt2);
42  input.get(Variable("brightness_temperature_15@ObsValue"), bt15);
43  for (size_t jj = 0; jj < nlocs; ++jj) {
44  out[0][jj] = -113.2+(2.41-0.0049*bt1[jj])*bt1[jj]+0.454*bt2[jj]-bt15[jj];
45  oops::Log::debug() << "Tb1, Tb2, Tb15: " << bt1[jj] << ", " << bt2[jj] << ", " << bt15[jj]
46  << ", scattering=" << out[0][jj] << std::endl;
47  }
48 }
49 
50 // -----------------------------------------------------------------------------
51 
53  return invars_;
54 }
55 
56 // -----------------------------------------------------------------------------
57 
58 } // namespace ufo
ufo::ObsFunctionScattering::compute
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
Definition: ObsFunctionScattering.cc:35
ufo::ObsFilterData::nlocs
size_t nlocs() const
Returns number of locations.
Definition: ObsFilterData.cc:66
ufo::Variables
Definition: src/ufo/filters/Variables.h:24
ufo::ObsFunctionScattering::ObsFunctionScattering
ObsFunctionScattering(const eckit::LocalConfiguration conf=eckit::LocalConfiguration())
Definition: ObsFunctionScattering.cc:22
ufo_radiancerttov_utils_mod::debug
logical, public debug
Definition: ufo_radiancerttov_utils_mod.F90:100
ufo::ObsFunctionScattering::requiredVariables
const ufo::Variables & requiredVariables() const
geovals required to compute the function
Definition: ObsFunctionScattering.cc:52
ObsFunctionScattering.h
ufo
Definition: RunCRTM.h:27
ufo::ObsFunctionMaker
Definition: ObsFunctionBase.h:60
ufo::ObsFunctionScattering::~ObsFunctionScattering
~ObsFunctionScattering()
Definition: ObsFunctionScattering.cc:31
ioda::ObsDataVector
Definition: BackgroundCheck.h:26
ufo::makerObsFuncScattering_
static ObsFunctionMaker< ObsFunctionScattering > makerObsFuncScattering_("Scattering")
ufo::ObsFunctionScattering::invars_
ufo::Variables invars_
Definition: ObsFunctionScattering.h:29
ufo::ObsFilterData::get
void get(const Variable &, std::vector< float > &) const
Gets requested data from ObsFilterData.
Definition: ObsFilterData.cc:130
ufo::Variable
Definition: Variable.h:23
ufo::ObsFilterData
ObsFilterData provides access to all data related to an ObsFilter.
Definition: src/ufo/filters/ObsFilterData.h:40
Variable.h