18 #include "ioda/ObsDataVector.h"
19 #include "oops/util/IntSetParser.h"
45 && channels.size() == 2);
54 invars_ +=
Variable(
"average_surface_temperature_within_field_of_view@GeoVaLs");
64 channels.size() == 2);
71 invars_ +=
Variable(
"brightness_temperature_assuming_clear_sky@ObsDiag" , channels);
81 channels.size() == 4);
107 const size_t ngrps = vargrp.size();
110 std::vector<float> water_frac(
nlocs);
111 in.
get(
Variable(
"water_area_fraction@GeoVaLs"), water_frac);
119 std::vector<float> szas(
nlocs);
120 in.
get(
Variable(
"sensor_zenith_angle@MetaData"), szas);
124 std::vector<float> tsavg(
nlocs);
125 in.
get(
Variable(
"average_surface_temperature_within_field_of_view@GeoVaLs"), tsavg);
128 std::vector<float> bt238(
nlocs), bt314(
nlocs);
129 for (
size_t igrp = 0; igrp < ngrps; ++igrp) {
131 in.
get(
Variable(
"brightness_temperature@" + vargrp[igrp], channels)[0], bt238);
132 in.
get(
Variable(
"brightness_temperature@" + vargrp[igrp], channels)[1], bt314);
135 std::vector<float> bias238(
nlocs), bias314(
nlocs);
142 bias238.assign(
nlocs, 0.0f);
143 bias314.assign(
nlocs, 0.0f);
148 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
149 bt238[iloc] = bt238[iloc] - bias238[iloc];
150 bt314[iloc] = bt314[iloc] - bias314[iloc];
162 const int jch37v = 0;
163 const int jch37h = 1;
164 std::vector<float> bt_clr_37v(
nlocs), bt_clr_37h(
nlocs);
165 in.
get(
Variable(
"brightness_temperature_assuming_clear_sky@ObsDiag" , channels)
166 [jch37v], bt_clr_37v);
167 in.
get(
Variable(
"brightness_temperature_assuming_clear_sky@ObsDiag" , channels)
168 [jch37h], bt_clr_37h);
170 std::vector<float> bt37v(
nlocs), bt37h(
nlocs);
171 for (
size_t igrp = 0; igrp < ngrps; ++igrp) {
173 in.
get(
Variable(
"brightness_temperature@" + vargrp[igrp], channels) [jch37v], bt37v);
174 in.
get(
Variable(
"brightness_temperature@" + vargrp[igrp], channels) [jch37h], bt37h);
177 std::vector<float> bias37v(
nlocs), bias37h(
nlocs);
185 bias37v.assign(
nlocs, 0.0f);
186 bias37h.assign(
nlocs, 0.0f);
191 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
192 bt37v[iloc] = bt37v[iloc] - bias37v[iloc];
193 bt37h[iloc] = bt37h[iloc] - bias37h[iloc];
207 const int jch18v = 0;
208 const int jch18h = 1;
209 const int jch36v = 2;
210 const int jch36h = 3;
216 for (
size_t igrp = 0; igrp < ngrps; ++igrp) {
218 const Variable btVar(
"brightness_temperature@" + vargrp[igrp], channels);
219 in.
get(btVar[jch18v], bt18v);
220 in.
get(btVar[jch18h], bt18h);
221 in.
get(btVar[jch36v], bt36v);
222 in.
get(btVar[jch36h], bt36h);
225 std::vector<float> bias18v(
nlocs), bias18h(
nlocs);
226 std::vector<float> bias36v(
nlocs), bias36h(
nlocs);
230 in.
get(testBias[jch18v], bias18v);
231 in.
get(testBias[jch18h], bias18h);
232 in.
get(testBias[jch36v], bias36v);
233 in.
get(testBias[jch36h], bias36h);
235 bias18v.assign(
nlocs, 0.0f);
236 bias18h.assign(
nlocs, 0.0f);
237 bias36v.assign(
nlocs, 0.0f);
238 bias36h.assign(
nlocs, 0.0f);
243 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
244 bt18v[iloc] = bt18v[iloc] - bias18v[iloc];
245 bt18h[iloc] = bt18h[iloc] - bias18h[iloc];
246 bt36v[iloc] = bt36v[iloc] - bias36v[iloc];
247 bt36h[iloc] = bt36h[iloc] - bias36h[iloc];
252 for (
size_t iloc = 0; iloc <
nlocs; ++iloc) {
253 bt18v[iloc] = bt18v[iloc] - sys_bias[6];
254 bt18h[iloc] = bt18h[iloc] - sys_bias[7];
255 bt36v[iloc] = bt36v[iloc] - sys_bias[10];
256 bt36h[iloc] = bt36h[iloc] - sys_bias[11];
267 const std::vector<float> & tsavg,
268 const std::vector<float> & water_frac,
269 const std::vector<float> & bt238,
270 const std::vector<float> & bt314,
271 std::vector<float> & out) {
280 const float d1 = 0.754, d2 = -2.265;
281 const float c1 = 8.240, c2 = 2.622, c3 = 1.846;
282 for (
size_t iloc = 0; iloc < water_frac.size(); ++iloc) {
283 if (water_frac[iloc] >= 0.99) {
285 float d0 = c1 - (c2 - c3 * cossza) * cossza;
286 if (tsavg[iloc] >
t0c - 1.0 && bt238[iloc] <= 284.0 && bt314[iloc] <= 284.0
287 && bt238[iloc] > 0.0 && bt314[iloc] > 0.0) {
288 out[iloc] = cossza * (d0 + d1 * std::log(285.0 - bt238[iloc])
289 + d2 * std::log(285.0 - bt314[iloc]));
290 out[iloc] = std::max(0.f, out[iloc]);
303 const std::vector<float> & bt_clr_37h,
304 const std::vector<float> & water_frac,
305 const std::vector<float> & bt37v,
306 const std::vector<float> & bt37h,
307 std::vector<float> & out) {
315 for (
size_t iloc = 0; iloc < water_frac.size(); ++iloc) {
316 if (water_frac[iloc] >= 0.99) {
317 if (bt37h[iloc] <= bt37v[iloc]) {
318 out[iloc] = 1.0 - (bt37v[iloc] - bt37h[iloc])/(bt_clr_37v[iloc] - bt_clr_37h[iloc]);
319 out[iloc] = std::max(0.f, out[iloc]);
333 const std::vector<float> & bt18h,
334 const std::vector<float> & bt36v,
335 const std::vector<float> & bt36h,
336 std::vector<float> & out) {
338 std::vector<float> pred_var_clw(2);
340 const float a0_clw = -0.65929;
342 float regr_coeff_clw[3] = {-0.00013, 1.64692, -1.51916};
344 for (
size_t iloc = 0; iloc < bt18v.size(); ++iloc) {
345 if (bt18v[iloc] <= bt18h[iloc]) {
347 }
else if (bt36v[iloc] <= bt36h[iloc]) {
351 pred_var_clw[0] = log(bt18v[iloc] - bt18h[iloc]);
352 pred_var_clw[1] = log(bt36v[iloc] - bt36h[iloc]);
353 clw = a0_clw + bt36h[iloc]*regr_coeff_clw[0];
354 for (
size_t nvar_clw=0; nvar_clw < pred_var_clw.size(); ++nvar_clw) {
355 clw =
clw + (pred_var_clw[nvar_clw] * regr_coeff_clw[nvar_clw+1]);
357 clw = std::max(0.0f,
clw);
358 clw = std::min(6.0f,
clw);
CLWRetMWParameters options_
static void cloudLiquidWater(const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, std::vector< float > &)
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
static float getBadValue()
static void CIret_37v37h_diff(const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, std::vector< float > &)
const ufo::Variables & requiredVariables() const
geovals required to compute the function
CLWRetMW(const eckit::LocalConfiguration &=eckit::LocalConfiguration())
static void clw_retr_amsr2(const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, std::vector< float > &)
Retrieve AMSR2_GCOM-W1 cloud liquid water. This retrieval function is taken from the subroutine "retr...
oops::OptionalParameter< int > ch37h
oops::OptionalParameter< std::vector< float > > origbias
oops::OptionalParameter< int > ch238
oops::OptionalParameter< int > ch18v
oops::OptionalParameter< int > ch37v
oops::Parameter< std::string > testBias
oops::Parameter< std::string > addBias
oops::RequiredParameter< std::vector< std::string > > varGroup
oops::OptionalParameter< int > ch18h
For retrieving AMSR2 cloud liquid water.
oops::OptionalParameter< int > ch314
oops::OptionalParameter< int > ch36v
oops::OptionalParameter< int > ch36h
ObsFilterData provides access to all data related to an ObsFilter.
size_t nlocs() const
Returns the number of locations in the associated ObsSpace.
bool has(const Variable &varname) const
Returns true if variable varname is known to ObsFilterData, false otherwise.
void get(const Variable &varname, std::vector< float > &values) const
Fills a std::vector with values of the specified variable.
real(kind_real), parameter, public t0c
integer function nlocs(this)
Return the number of observational locations in this Locations object.
static ObsFunctionMaker< CLWRetMW > makerCLWRetMW_("CLWRetMW")
static constexpr double deg2rad
static constexpr double t0c