19 #include "ioda/ObsDataVector.h"
20 #include "oops/util/IntSetParser.h"
21 #include "oops/util/missingValues.h"
28 static ObsFunctionMaker<InterChannelConsistencyCheck>
40 std::copy(channelset.begin(), channelset.end(), std::back_inserter(
channels_));
60 std::string inst, sat;
77 std::vector<int> qcflagdata(
nlocs);
78 std::vector<float> obserrdata(
nlocs);
79 std::vector<std::vector<float>> varinv(nchans, std::vector<float>(
nlocs, 0.0));
80 for (
size_t ichan = 0; ichan < nchans; ++ichan) {
83 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
84 if (flaggrp ==
"PreQC") obserrdata[iloc] ==
missing ? qcflagdata[iloc] = 100
85 : qcflagdata[iloc] = 0;
86 (qcflagdata[iloc] == 0) ? (varinv[ichan][iloc] = 1.0 / pow(obserrdata[iloc], 2))
87 : (varinv[ichan][iloc] = 0.0);
92 bool passive_bc =
true;
93 bool channel_passive =
false;
95 if (inst ==
"atms") ncheck = 7;
96 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
97 for (
int ichan = 0; ichan < nchans; ++ichan) out[ichan][iloc] = 0;
99 for (
int ichan = 1; ichan < ncheck; ++ichan) {
100 channel_passive = use_flag[ichan] == -1 || use_flag[ichan] == 0;
101 int channel = ichan + 1;
102 if (varinv[ichan][iloc] <= 0.0 &&
103 (use_flag[ichan] >= 1 || (passive_bc && channel_passive))) {
104 kval = std::max(channel-1, kval);
105 if ((inst ==
"amsua" || inst ==
"atms") && channel <= 3) kval = 0;
109 for (
int ichan = 0; ichan < kval; ++ichan) out[ichan][iloc] = 1;
110 if (inst ==
"amsua") {
112 out[channel-1][iloc] = 1;
114 if (inst ==
"atms") {
116 out[channel-1][iloc] = 1;
118 out[channel-1][iloc] = 1;
120 out[channel-1][iloc] = 1;
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
std::vector< int > channels_
InterChannelConsistencyCheck(const eckit::LocalConfiguration &)
~InterChannelConsistencyCheck()
InterChannelConsistencyCheckParameters options_
const ufo::Variables & requiredVariables() const
geovals required to compute the function
oops::RequiredParameter< std::vector< int > > useflagChannel
Useflag (-1: not used; 0: monitoring; 1: used) for each channel in channelList.
oops::RequiredParameter< std::string > sensor
Name of the sensor for which the observation error factor applies.
oops::RequiredParameter< std::string > channelList
List of channels available for assimilation.
oops::Parameter< std::string > testObserr
Name of the data group to which the observation error is applied (default: ObsErrorData)
oops::Parameter< std::string > testQCflag
Name of the data group to which the QC flag is applied (default is QCflagsData)
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.
integer function nlocs(this)
Return the number of observational locations in this Locations object.
static ObsFunctionMaker< InterChannelConsistencyCheck > makerInterChannelConsistencyCheck_("InterChannelConsistencyCheck")
void splitInstSat(const std::string &instsat, std::string &inst, std::string &sat)