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
ObsFilterData provides access to all data related to an ObsFilter.
size_t nlocs() const
Returns the number of locations in the associated ObsSpace.
void get(const Variable &varname, std::vector< float > &values) const
Fills a std::vector with values of the specified variable.
ObsFunctionScattering(const eckit::LocalConfiguration conf=eckit::LocalConfiguration())
const ufo::Variables & requiredVariables() const
geovals required to compute the function
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
integer function nlocs(this)
Return the number of observational locations in this Locations object.
Definition: RunCRTM.h:27
static ObsFunctionMaker< ObsFunctionScattering > makerObsFuncScattering_("Scattering")