UFO
SIRetSymmetricMW.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 <algorithm>
11 #include <cmath>
12 #include <iomanip>
13 #include <iostream>
14 #include <set>
15 #include <string>
16 #include <vector>
17 
18 #include "ioda/ObsDataVector.h"
19 #include "oops/util/IntSetParser.h"
21 #include "ufo/filters/Variable.h"
22 #include "ufo/utils/Constants.h"
23 
24 namespace ufo {
25 
27 
28 // -----------------------------------------------------------------------------
29 
30 SIRetSymmetricMW::SIRetSymmetricMW(const eckit::LocalConfiguration & conf)
31  : invars_(), conf_(conf) {
32  SIRetMW siretfunc(conf_);
33  ASSERT(siretfunc.siVariableGroups().size() == 2);
34 
35  invars_ += siretfunc.requiredVariables();
36 }
37 
38 // -----------------------------------------------------------------------------
39 
41 
42 // -----------------------------------------------------------------------------
43 
45  ioda::ObsDataVector<float> & out) const {
46  // Get dimension
47  const size_t nlocs = in.nlocs();
48 
49  // Get SI retrievals from function
50  SIRetMW siretfunc(conf_);
51  oops::Variables sivars(siretfunc.siVariableGroups());
52  ioda::ObsDataVector<float> siret(in.obsspace(), sivars, "ObsFunction", false);
53  siretfunc.compute(in, siret);
54 
55  // Get symmetric SI amount
56  for (size_t iloc = 0; iloc < nlocs; ++iloc) {
57  out[0][iloc] = 0.5 * (siret[0][iloc] + siret[1][iloc]);
58  if (siret[0][iloc] >= siretfunc.getBadValue() || siret[1][iloc] >= siretfunc.getBadValue())
59  out[0][iloc] = siretfunc.getBadValue();
60  }
61 }
62 
63 // -----------------------------------------------------------------------------
64 
66  return invars_;
67 }
68 
69 // -----------------------------------------------------------------------------
70 
71 } // 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.
ioda::ObsSpace & obsspace() const
Returns reference to ObsSpace associated with ObsFilterData.
Retrieve scattering index from MHS 89.0 GHz and 157.0 GHz channels.
Definition: SIRetMW.h:72
const ufo::Variables & requiredVariables() const
geovals required to compute the function
Definition: SIRetMW.cc:136
static float getBadValue()
Definition: SIRetMW.h:84
const std::vector< std::string > & siVariableGroups() const
Definition: SIRetMW.h:81
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
Definition: SIRetMW.cc:59
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
eckit::LocalConfiguration conf_
ufo::Variables invars_
SIRetSymmetricMW(const eckit::LocalConfiguration &=eckit::LocalConfiguration())
integer function nlocs(this)
Return the number of observational locations in this Locations object.
Definition: RunCRTM.h:27
static ObsFunctionMaker< SIRetSymmetricMW > makerSIRetSymmetricMW_("SIRetSymmetricMW")