47 0.0904221, 0.164818, 0.266515, 0.401776, 0.581261, 0.824689, 1.17436 };
51 0.401776, 0.531394, 0.635031, 0.693147 };
53 const float DbAlgorithm::htab[8] = {0.0, 11.0, 20.0, 32.0, 47.0, 51.0, 71.0, 84.852};
55 270.65, 214.65, 186.946};
57 1.0945601E-3, 6.6063531E-4, 3.9046834E-5, 3.68501E-6};
95 bgascorrect_ =
static_cast<ddval<bool>*
>(imap[
"bgascorrect"])->
val;
100 status = initialize_LUT_data( imap );
101 if (
status != DTDB_SUCCESS) {
102 std::cerr <<
"DtProcess:: LUT initialization failure" << std::endl;
116 int status = DTDB_SUCCESS;
118 size_t num_lines = (size_t)
static_cast<ddval<int>*
>(imap[
"num_lines"])->
val;
119 size_t num_pixels = (size_t)
static_cast<ddval<int>*
>(imap[
"num_pixels"])->
val;
126 float maxlat = -90.0;
127 float minlon = 180.0;
128 float maxlon = -180.0;
129 for (
size_t i = 0;
i < num_lines;
i++) {
130 for (
size_t j = 0;
j < num_pixels;
j++) {
135 minlat = (
lat < minlat) ?
lat : minlat;
136 maxlat = (
lat > maxlat) ?
lat : maxlat;
137 minlon = (
lon < minlon) ?
lon : minlon;
138 maxlon = (
lon > maxlon) ?
lon : maxlon;
141 if (minlon < -175.0 && maxlon > 175.0) {
144 for (
size_t i = 0;
i < num_lines;
i++) {
145 for (
size_t j = 0;
j < num_pixels;
j++) {
149 if (
lon > 0.0 &&
lon < eastedge)
151 if (lon < 0.0 && lon > westedge)
155 ler_start_[0] = 10*(180 + floor(eastedge) - 1);
156 if (ler_start_[0] < 0) {
159 dateline_ = 3600 - ler_start_[0];
160 ler_edge_[0] = 10*(180 + (floor(westedge) + 2)) + dateline_;
162 ler_start_[0] = 10*(180 + (floor(minlon) - 1));
163 if (ler_start_[0] < 0) {
166 ler_edge_[0] = 10*(180 + (floor(maxlon) + 2)) - ler_start_[0];
167 if (ler_edge_[0] + ler_start_[0] > 3600) {
168 ler_edge_[0] = 3600 - ler_start_[0];
171 ler_start_[1] = 10*(90 + (floor(minlat) - 1));
172 if (ler_start_[1] < 0) {
175 ler_edge_[1] = 10*(90 + (floor(maxlat) + 2)) - ler_start_[1];
176 if (ler_edge_[1] + ler_start_[1] > 1800) {
177 ler_edge_[1] = 1800 - ler_start_[1];
191 map<string, ddata*> imap)
193 map<string, ddata*> omap;
194 int status = DTDB_SUCCESS;
196 omap.insert({
"status", pstat});
218 int jm = (ju + jl) / 2;
229 }
else if (
x ==
y[
size-1]) {
263 int status = DTDB_SUCCESS;
267 float xwv = pwv_/2.0;
269 float xsp = ps_/1013.25;
282 float oz_coeffs[NTWL][2] = {{-3.09E-07, 4.71E-07},
283 {-5.72E-05, 2.99E-06,},
284 {-1.25E-04, 1.98E-05},
285 {-4.75E-05, 9.08E-05},
286 {-4.79E-05, 4.37E-05},
287 {4.18E-07, 2.24E-06},
288 {1.19E-07, 5.17E-26},
290 {1.19E-07, 1.03E-25},
291 {-2.61E-08, 3.28E-09}};
293 float wv_coeffs[NTWL][3] = {{-9.61E+00, 9.16E-01, -2.01E-02},
294 {-8.52E+00, 9.90E-01, -1.49E-03},
295 {-9.65E+00, 9.87E-01, 1.80E-04},
296 {-7.50E+00, 9.84E-01, -3.87E-03},
297 {-7.69E+00, 9.95E-01, -1.10E-02},
298 {-6.05E+00, 9.65E-01, -1.53E-02},
299 {-5.16E+00, 9.59E-01, -2.67E-02},
301 {-6.43E+00, 1.02E+00, -3.60E-03},
302 {-5.85E+00, 1.28E+00, -5.04E-03}};
304 float cs_coeffs[NTWL] = {2.47E-04, 3.77E-04, 1.84E-03, 8.34E-04,
305 1.44E-03, 2.45E-05, 1.19E-02, 0.0, 2.13E-02, 5.32E-02};
308 for (
int ib=0; ib<NTWL; ib++) {
313 mu = cos(xvza*DEGtoRAD);
315 amf_coeffs[0] = 268.45;
317 amf_coeffs[2] = 115.42;
318 amf_coeffs[3] = -3.2922;
319 amf_oz =
mu + amf_coeffs[0] * (pow(xvza, amf_coeffs[1]) *
320 pow((amf_coeffs[2]-xvza),amf_coeffs[3]));
321 amf_oz = 1.0 / amf_oz;
322 trans_oz = exp(oz_coeffs[ib][0] + oz_coeffs[ib][1]*amf_oz*xoz);
324 amf_coeffs[0] = 0.0311;
326 amf_coeffs[2] = 92.471;
327 amf_coeffs[3] = -1.3814;
328 amf_wv =
mu + amf_coeffs[0] * (pow(xvza,amf_coeffs[1]) *
329 pow((amf_coeffs[2]-xvza),amf_coeffs[3]));
330 amf_wv = 1.0 / amf_wv;
331 trans_wv = exp(exp(wv_coeffs[ib][0] + wv_coeffs[ib][1]*log(amf_wv*xwv) +
332 wv_coeffs[ib][2]*pow(log(amf_wv*xwv),2)));
334 amf_coeffs[0] = 0.4567;
335 amf_coeffs[1] = 0.07;
336 amf_coeffs[2] = 96.484;
337 amf_coeffs[3] = -1.697;
338 amf_cs =
mu + amf_coeffs[0] * (pow(xvza,amf_coeffs[1]) *
339 pow((amf_coeffs[2]-xvza),amf_coeffs[3]));
340 amf_cs = 1.0 / amf_cs;
341 trans_cs = exp(cs_coeffs[ib] * amf_cs * xsp);
342 gasc_[ib] = trans_oz * trans_wv * trans_cs;
346 mu = cos(xsza*DEGtoRAD);
347 amf_coeffs[0] = 268.45;
349 amf_coeffs[2] = 115.42;
350 amf_coeffs[3] = -3.2922;
351 amf_oz =
mu + amf_coeffs[0] * (pow(xsza,amf_coeffs[1]) *
352 pow((amf_coeffs[2]-xsza),amf_coeffs[3]));
353 amf_oz = 1.0 / amf_oz;
354 trans_oz = exp(oz_coeffs[ib][0]+oz_coeffs[ib][1]*amf_oz*xoz);
356 amf_coeffs[0] = 0.0311;
358 amf_coeffs[2] = 92.471;
359 amf_coeffs[3] = -1.3814;
360 amf_wv =
mu + amf_coeffs[0] * (pow(xsza,amf_coeffs[1]) *
361 pow((amf_coeffs[2]-xsza),amf_coeffs[3]));
362 amf_wv = 1.0 / amf_wv;
363 trans_wv = exp(exp(wv_coeffs[ib][0] + wv_coeffs[ib][1]*log(amf_wv*xwv) +
364 wv_coeffs[ib][2]*pow(log(amf_wv*xwv),2)));
366 amf_coeffs[0] = 0.4567;
367 amf_coeffs[1] = 0.07;
368 amf_coeffs[2] = 96.484;
369 amf_coeffs[3] = -1.697;
370 amf_cs =
mu + amf_coeffs[0] * (pow(xsza,amf_coeffs[1]) *
371 pow((amf_coeffs[2]-xsza),amf_coeffs[3]));
372 amf_cs = 1.0 / amf_cs;
373 trans_cs = exp(cs_coeffs[ib] * amf_cs * xsp);
374 gasc_[ib] = gasc_[ib] * trans_oz * trans_wv * trans_cs;
397 float& ps,
float& theta)
399 int status = DTDB_SUCCESS;
401 const float REARTH = 6369.0;
402 const float GMR = 34.163195;
413 float htab[
NTAB] = {0.0, 11.0, 20.0, 32.0, 47.0, 51.0, 71.0, 84.852};
414 float ttab[
NTAB] = {288.15, 216.65, 216.65, 228.65, 270.65,
415 270.65, 214.65, 186.946};
416 float ptab[
NTAB] = {1.0, 2.233611E-1, 5.403295E-2, 8.5666784E-3,
417 1.0945601E-3, 6.6063531E-4, 3.9046834E-5, 3.68501E-6};
418 float gtab[
NTAB] = {-6.5, 0.0, 1.0, 2.8, 0.0, -2.8, -2.0, 0.0};
420 float alt = height/1000;
421 h=alt*REARTH/(alt+REARTH);
426 }
while (
h > htab[ip] && ip <
NTAB);
433 tlocal=tbase+tgrad*deltah;
434 theta=tlocal/ttab[0];
437 ps=ptab[ip]*exp(-GMR*deltah/tbase);
439 ps=ptab[ip]*pow((tbase/tlocal),(GMR/tgrad));
456 int status = DTDB_SUCCESS;
459 if((solz_> 0.0) && (senz_> 0.0) && (raa_> 0.0)) {
460 glint_angle = cos(solz_*DEGtoRAD)*cos(senz_*DEGtoRAD)
461 + sin(solz_*DEGtoRAD)*sin(senz_*DEGtoRAD)*cos(raa_*DEGtoRAD);
462 glint_angle = acos(glint_angle)*RADtoDEG;
465 double cc = DEGtoRAD;
468 double zx = (sin(senz_*cc)*sin(raa_*cc))/
469 (cos(solz_*cc)+cos(senz_*cc));
470 double zy = (sin(solz_*cc)-sin(senz_*cc)*cos(raa_*cc))/
471 (cos(solz_*cc)+cos(senz_*cc));
472 double sigx = sqrt(0.003+0.00192*ws_);
473 double sigy = sqrt(0.00316*ws_);
474 double zeta = zx / sigx;
475 double eta = zy / sigy;
476 double p = (1.0/(2.0*
M_PI*sigx*sigy))*exp(-0.5*(zeta*zeta + eta*eta));
477 double costwoomega = cos(senz_*cc)*cos(solz_*cc) -
478 sin(senz_*cc)*sin(solz_*cc)*cos(raa_*cc);
479 double cosbeta = (cos(solz_*cc)+cos(senz_*cc))/
480 (sqrt(2.0 + 2.0*costwoomega));
481 double w = 0.5 * acos(costwoomega);
482 double wp = asin(sin(w)/nr);
483 double a1 = sin(w - wp);
484 double b1 = sin(w+wp);
485 double c1 = tan(w-wp);
486 double d1 = tan(w+wp);
487 double R = 0.5*((a1*a1)/(
b1*
b1)+(c1*c1)/(d1*d1));
488 glint_refl_ =
p*
R/(4*cos(senz_*cc)*pow(cosbeta,4.0));
502 int status = DTDB_SUCCESS;
505 +sin(solz_*DEGtoRAD)*sin(senz_*DEGtoRAD)*cos(raa_*DEGtoRAD);