UFO
CLWRetSymmetricMW.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 <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 CLWRetSymmetricMW::CLWRetSymmetricMW(const eckit::LocalConfiguration & conf)
31  : invars_(), conf_(conf) {
32  CLWRetMW clwretfunc(conf_);
33  ASSERT(clwretfunc.clwVariableGroups().size() == 2);
34 
35  invars_ += clwretfunc.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 CLW retrievals from function
50  CLWRetMW clwretfunc(conf_);
51  oops::Variables clwvars(clwretfunc.clwVariableGroups());
52  ioda::ObsDataVector<float> clwret(in.obsspace(), clwvars, "ObsFunction", false);
53  clwretfunc.compute(in, clwret);
54 
55  // Get symmetric CLW amount
56  for (size_t iloc = 0; iloc < nlocs; ++iloc) {
57  out[0][iloc] = 0.5 * (clwret[0][iloc] + clwret[1][iloc]);
58  if (clwret[0][iloc] >= clwretfunc.getBadValue() || clwret[1][iloc] >= clwretfunc.getBadValue())
59  out[0][iloc] = clwretfunc.getBadValue();
60  }
61 }
62 
63 // -----------------------------------------------------------------------------
64 
66  return invars_;
67 }
68 
69 // -----------------------------------------------------------------------------
70 
71 } // namespace ufo
Retrieve cloud liquid water from 23.8 GHz and 31.4 GHz channels.
Definition: CLWRetMW.h:88
const std::vector< std::string > & clwVariableGroups() const
Definition: CLWRetMW.h:97
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
Definition: CLWRetMW.cc:100
static float getBadValue()
Definition: CLWRetMW.h:117
const ufo::Variables & requiredVariables() const
geovals required to compute the function
Definition: CLWRetMW.cc:364
eckit::LocalConfiguration conf_
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
CLWRetSymmetricMW(const eckit::LocalConfiguration &=eckit::LocalConfiguration())
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.
integer function nlocs(this)
Return the number of observational locations in this Locations object.
Definition: RunCRTM.h:27
static ObsFunctionMaker< CLWRetSymmetricMW > makerCLWRetSymmetricMW_("CLWRetSymmetricMW")