19 #include "ioda/ObsDataVector.h"
20 #include "oops/util/IntSetParser.h"
21 #include "oops/util/missingValues.h"
28 static ObsFunctionMaker<ObsErrorFactorTopoRad>
40 std::copy(channelset.begin(), channelset.end(), std::back_inserter(
channels_));
47 std::string inst, sat;
49 ASSERT(inst ==
"amsua" || inst ==
"atms" ||
50 inst ==
"iasi" || inst ==
"cris-fsr" || inst ==
"airs" || inst ==
"avhrr3");
52 if (inst ==
"amsua" || inst ==
"atms") {
81 std::string inst, sat;
90 std::vector<float> zsges(
nlocs);
91 in.
get(
Variable(
"surface_geopotential_height@GeoVaLs"), zsges);
94 if (inst ==
"iasi" || inst ==
"cris-fsr" || inst ==
"airs" || inst ==
"avhrr3") {
95 std::vector<float> tao_sfc(
nlocs);
96 for (
size_t ich = 0; ich < nchans; ++ich) {
99 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
100 out[ich][iloc] = 1.0;
101 if (zsges[iloc] > 2000.0) {
102 float factor = pow((2000.0/zsges[iloc]), 4);
103 out[ich][iloc] = sqrt(1.0 / (1.0 - (1.0 - factor) * tao_sfc[iloc]));
107 }
else if (inst ==
"amsua" || inst ==
"atms") {
109 int ich238, ich314, ich503, ich528, ich536, ich544, ich549, ich890;
110 if (inst ==
"amsua") {
111 ich238 = 1, ich314 = 2, ich503 = 3, ich528 = 4, ich536 = 5;
112 ich544 = 6, ich549 = 7, ich890 = 15;
113 }
else if (inst ==
"atms") {
114 ich238 = 1, ich314 = 2, ich503 = 3, ich528 = 5, ich536 = 6;
115 ich544 = 7, ich549 = 8, ich890 = 16;
119 std::vector<int> qcflagdata;
120 std::vector<float> obserrdata;
126 for (
size_t ichan = 0; ichan < nchans; ++ichan) {
127 size_t channel = ichan + 1;
130 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
131 out[ichan][iloc] = 1.0;
132 if (flaggrp ==
"PreQC") obserrdata[iloc] ==
missing ? qcflagdata[iloc] = 100
133 : qcflagdata[iloc] = 0;
134 (qcflagdata[iloc] != 0) ? (factor = 0.0) : (factor = 1.0);
136 if (zsges[iloc] > 2000.0) {
137 if (channel <= ich544 || channel == ich890) {
138 out[ichan][iloc] = (2000.0/zsges[iloc]) * factor;
140 if ((zsges[iloc] > 4000.0) && (channel == ich549)) {
141 out[ichan][iloc] = (4000.0/zsges[iloc]) * factor;
143 if (factor > 0.0) out[ichan][iloc] = sqrt(1.0 / out[ichan][iloc]);
148 oops::Log::error() <<
"ObsErrorFactorTopoRad: Invalid instrument (sensor) specified: " << inst
149 <<
" The valid instruments are: iasi, cris-fsr, airs, avhrr3, "
std::vector< int > channels_
ObsErrorFactorTopoRad(const eckit::LocalConfiguration &)
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
const ufo::Variables & requiredVariables() const
geovals required to compute the function
ObsErrorFactorTopoRadParameters options_
oops::RequiredParameter< std::string > channelList
List of channels to 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< std::string > sensor
Name of the sensor for which the observation error factor applies.
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.
size_t nlevs(const Variable &) const
Returns the number of levels in the specified variable.
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< ObsErrorFactorTopoRad > makerObsErrorFactorTopoRad_("ObsErrorFactorTopoRad")
void splitInstSat(const std::string &instsat, std::string &inst, std::string &sat)