18 #include "ioda/ObsDataVector.h"
19 #include "oops/util/IntSetParser.h"
20 #include "oops/util/missingValues.h"
43 std::string inst, sat;
45 ASSERT(inst ==
"amsua" || inst ==
"atms");
49 std::copy(channelset.begin(), channelset.end(), std::back_inserter(
channels_));
89 std::string inst, sat;
91 ASSERT(inst ==
"amsua" || inst ==
"atms");
101 std::vector<float> water_frac(
nlocs);
102 in.
get(
Variable(
"water_area_fraction@GeoVaLs"), water_frac);
107 in.
get(obserrlat, errflat);
112 in.
get(obserrtaotop, errftaotop);
117 in.
get(obserrtopo, errftopo);
122 in.
get(obserrvar, obserr);
125 int ich238, ich314, ich503, ich528, ich536, ich544, ich549, ich890;
126 if (inst ==
"amsua") {
127 ich238 = 1, ich314 = 2, ich503 = 3, ich528 = 4, ich536 = 5;
128 ich544 = 6, ich549 = 7, ich890 = 15;
129 }
else if (inst ==
"atms") {
130 ich238 = 1, ich314 = 2, ich503 = 3, ich528 = 5, ich536 = 6;
131 ich544 = 7, ich549 = 8, ich890 = 16;
135 std::vector<float> obserrdata(
nlocs);
136 std::vector<int> qcflagdata(
nlocs);
141 for (
size_t ichan = 0; ichan < nchans; ++ichan) {
142 int channel = ichan + 1;
145 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
146 if (flaggrp ==
"PreQC") obserrdata[iloc] ==
missing ? qcflagdata[iloc] = 100
147 : qcflagdata[iloc] = 0;
148 (qcflagdata[iloc] == 0) ? (varinv = 1.0 / pow(obserrdata[iloc], 2)) : (varinv = 0.0);
149 out[ichan][iloc] = obserr[ichan][iloc];
151 if (water_frac[iloc] > 0.99) {
152 if (inst ==
"amsua") {
153 if (channel <= ich536 || channel == ich890) {
154 out[ichan][iloc] = 3.0 * obserr[ichan][iloc]
155 * (1.0 / pow(errflat[0][iloc], 2))
156 * (1.0 / pow(errftaotop[ichan][iloc], 2))
157 * (1.0 / pow(errftopo[ichan][iloc], 2));
159 out[ichan][iloc] = std::fmin((3.0 * obserr[ichan][iloc]
160 * (1.0 / pow(errflat[0][iloc], 2))
161 * (1.0 / pow(errftaotop[ichan][iloc], 2))
162 * (1.0 / pow(errftopo[ichan][iloc], 2))),
163 obserr_bound_max[ichan]);
166 if (inst ==
"atms") {
167 if (channel <= ich536 || channel >= ich890) {
168 out[ichan][iloc] = std::fmin((3.0 * obserr[ichan][iloc]
169 * (1.0 / pow(errflat[0][iloc], 2))
170 * (1.0 / pow(errftaotop[ichan][iloc], 2))
171 * (1.0 / pow(errftopo[ichan][iloc], 2))), 10.0);
173 out[ichan][iloc] = std::fmin((3.0 * obserr[ichan][iloc]
174 * (1.0 / pow(errflat[0][iloc], 2))
175 * (1.0 / pow(errftaotop[ichan][iloc], 2))
176 * (1.0 / pow(errftopo[ichan][iloc], 2))),
177 obserr_bound_max[ichan]);
181 out[ichan][iloc] = std::fmin((3.0 * obserr[ichan][iloc]
182 * (1.0 / pow(errflat[0][iloc], 2))
183 * (1.0 / pow(errftaotop[ichan][iloc], 2))
184 * (1.0 / pow(errftopo[ichan][iloc], 2))),
185 obserr_bound_max[ichan]);
ObsErrorBoundMWParameters options_
std::vector< int > channels_
const ufo::Variables & requiredVariables() const
geovals required to compute the function
ObsErrorBoundMW(const eckit::LocalConfiguration &)
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
oops::RequiredParameter< Variable > obserrBoundTopo
Function to set the observation bound based on terrain height.
oops::RequiredParameter< std::string > channelList
List of channels available for assimilation.
oops::RequiredParameter< Variable > obserrBoundLat
Function to set the observation bound based on latitude.
oops::RequiredParameter< Variable > obserrBoundTransmittop
Function to set the observation bound based on transmittance at model top.
oops::RequiredParameter< std::string > sensor
Name of the sensor for which the observation error factor applies.
oops::Parameter< std::string > testObserr
Name of the data group to which the observation error is applied (default: ObsErrorData)
oops::RequiredParameter< Variable > obserrFunction
Function to estimate observation error based on symmetric cloud amount.
oops::Parameter< std::string > testQCflag
Name of the data group to which the QC flag is applied (default is QCflagsData)
oops::RequiredParameter< std::vector< float > > obserrBoundMax
The maximum value of the observation error bound for each channel in channelList.
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.
void get(const Variable &varname, std::vector< float > &values) const
Fills a std::vector with values of the specified variable.
oops::Variables toOopsVariables() const
integer function nlocs(this)
Return the number of observational locations in this Locations object.
static ObsFunctionMaker< ObsErrorBoundMW > makerObsErrorBoundMW_("ObsErrorBoundMW")
void splitInstSat(const std::string &instsat, std::string &inst, std::string &sat)