18 #include "ioda/ObsDataVector.h"
19 #include "oops/util/IntSetParser.h"
48 invars_ +=
Variable(
"average_surface_temperature_within_field_of_view@GeoVaLs");
66 const size_t nlocs = in.
nlocs();
67 const size_t ngrps = vargrp.size();
71 std::vector<float> szas(nlocs);
72 in.
get(
Variable(
"sensor_zenith_angle@MetaData"), szas);
76 std::vector<float> tsavg(nlocs);
77 in.
get(
Variable(
"average_surface_temperature_within_field_of_view@GeoVaLs"), tsavg);
80 std::vector<float> water_frac(nlocs);
81 in.
get(
Variable(
"water_area_fraction@GeoVaLs"), water_frac);
84 std::vector<float> bt238(nlocs), bt314(nlocs);
85 for (
size_t igrp = 0; igrp < ngrps; ++igrp) {
87 in.
get(
Variable(
"brightness_temperature@" + vargrp[igrp], channels_)[channels_[0]-1], bt238);
88 in.
get(
Variable(
"brightness_temperature@" + vargrp[igrp], channels_)[channels_[1]-1], bt314);
91 std::vector<float> bias238(nlocs), bias314(nlocs);
94 [channels_[0]-1], bias238);
96 [channels_[1]-1], bias314);
98 bias238.assign(nlocs, 0.0f);
99 bias314.assign(nlocs, 0.0f);
103 for (
size_t iloc = 0; iloc < nlocs; ++iloc) {
104 bt238[iloc] = bt238[iloc] - bias238[iloc];
105 bt314[iloc] = bt314[iloc] - bias314[iloc];
108 for (
size_t iloc = 0; iloc < nlocs; ++iloc) {
109 bt238[iloc] = bt238[iloc] + bias238[iloc];
110 bt314[iloc] = bt314[iloc] + bias314[iloc];
123 const std::vector<float> & tsavg,
124 const std::vector<float> & water_frac,
125 const std::vector<float> & bt238,
126 const std::vector<float> & bt314,
127 std::vector<float> & out,
128 const std::size_t nlocs) {
137 const float d1 = 0.754, d2 = -2.265;
138 const float c1 = 8.240, c2 = 2.622, c3 = 1.846;
139 for (
size_t iloc = 0; iloc < nlocs; ++iloc) {
140 if (water_frac[iloc] >= 0.99) {
142 float d0 = c1 - (c2 - c3 * cossza) * cossza;
143 if (tsavg[iloc] >
t0c - 1.0 && bt238[iloc] <= 284.0 && bt314[iloc] <= 284.0
144 && bt238[iloc] > 0.0 && bt314[iloc] > 0.0) {
145 out[iloc] = cossza * (d0 + d1 * std::log(285.0 - bt238[iloc])
146 + d2 * std::log(285.0 - bt314[iloc]));
147 out[iloc] = std::max(0.f, out[iloc]);