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");
52 if (inst ==
"amsua" || inst ==
"atms") {
81 std::string inst, sat;
85 size_t nlocs = in.
nlocs();
90 std::vector<float> zsges(nlocs);
91 in.
get(
Variable(
"surface_geopotential_height@GeoVaLs"), zsges);
94 if (inst ==
"iasi" || inst ==
"cris-fsr" || inst ==
"airs") {
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, amsua and atms"