88 float angstrom,
float *wl,
float *fo,
float *ko3,
float *taumolbar) {
93 float rp[
nbands], transa, sa, ps0, del;
95 float gamma, cos2x, pmol;
98 float par0, integtrans, delt, saavg;
99 float tmstep, sz, cossz, tg, td;
103 float sumSa, sumrc, sumtdir, sumtdif,
denom, tatemp, ravgsat;
105 float q, q4, taucons, q4tau,
f, asat, asbar, abar, acldmax;
106 float fcsolz, fcsenz, fcossz;
111 int widx490, widx510;
112 float ang500, ta500,
slope;
116 static float kavg_oz = 5.2e-05;
117 static float kavg_wv = 0.002;
122 float *modelAngstrom;
124 l1str *
l1rec = l2rec->l1rec;
126 int16_t
year, month, mday,
doy;
144 if (
l1rec->solz[ip] < 0.0f ||
l1rec->solz[ip] > 90.0f) {
145 printf(
"Error: subroutine CalcPAR. computation failed.\n");
146 printf(
"SolZen (outside valid range 0-90) = %f\n",
l1rec->solz[ip]);
151 if (
l1rec->senz[ip] < 0.0f ||
l1rec->senz[ip] > 90.0f) {
152 printf(
"Error: subroutine CalcPAR. computation failed.\n");
153 printf(
"ViewZen (outside valid range 0-90) = %f\n",
l1rec->senz[ip]);
158 if (
l1rec->delphi[ip] < -180.0f ||
l1rec->delphi[ip] > 180.0f) {
159 printf(
"Error: subroutine CalcPAR. computation failed.\n");
160 printf(
"delphi (outside valid range -180:180) = %f\n",
166 float dobson =
l1rec->oz[ip];
168 csolz =
l1rec->csolz[ip];
169 csenz =
l1rec->csenz[ip];
170 cos2x = powf(cosf((
l1rec->scattang[ip] *
M_PI / 180.0)), 2.0);
172 if (
l1rec->scattang[ip] < 0.0 ||
l1rec->scattang[ip] > 180.0) {
173 printf(
"Error: subroutine CalcPAR. computation failed.\n");
174 printf(
"scatang (outside valid range 0-180) = %f\n",
175 l1rec->scattang[ip]);
176 printf(
"scatang = -(cossz*zosvz)+(sinsz*sinvz*cosra)\n");
185 float surfpress =
l1rec->pr[ip];
186 if (surfpress <= 0.0
f) {
187 surfpress = 1013.15f;
200 angstrom = -1 * angstrom;
207 float watvap =
l1rec->wv[ip];
216 float Airmass = (1.f / csolz) + (1.
f / csenz);
221 transg = expf((-ko3[
band] * dobson * Airmass));
234 pmol = (2.0f * (1.0f - del) * 0.75
f * (1.0
f + cos2x) + 3.0f * del)
237 asymfac = 0.6666667f;
238 beta = 0.5f * (1.0f + asymfac);
239 gamma = 1.0f - asymfac;
250 weight[0] = (wl[0] - 400.0) + (wl[1] - wl[0]) / 2.0;
259 taumol[
band] = taumolbar[
band] * (surfpress / ps0);
262 * powf(wl[
band] / (
float)
input->aer_wave_long,
263 modelAngstrom[
band]);
269 / (4.0
f * csolz * csenz);
273 transa = expf(-(taumol[
band] + tauaer[
band]) / csolz)
274 * expf((0.52
f * taumol[
band] +
beta * tauaer[
band]) / csolz);
275 transav = expf(-(taumol[
band] + tauaer[
band]) / csenz)
276 * expf((0.52
f * taumol[
band] +
beta * tauaer[
band]) / csenz);
279 tdir = expf(-tau[
band] / csolz);
281 tdif = (expf(-tau[
band] / csolz))
282 * (expf((0.52
f * taumol[
band] +
beta * tauaer[
band]) / csolz)
284 sumtdir += (tdir * fo[
band]);
285 sumtdif += (tdif * fo[
band]);
291 sumSa += sa * fo[
band] * weight[
band];
295 / ((transa * transav) + (sa * (rp[
band] - ra[
band])));
301 switch (
l1rec->l1file->sensorID) {
322 slope = (modelAngstrom[widx510] - modelAngstrom[widx490])
323 / (wl[widx510] - wl[widx490]);
324 ang500 = modelAngstrom[widx490] +
slope * (wl[widx510] - wl[widx490]);
325 ta500 = taua * powf((500.0 / (
float)
input->aer_wave_long), ang500);
333 saavg = sumSa /
denom;
335 ravgsat = sumrc /
denom;
341 q = 1.0f / (3.0f * (1.0f - 0.853f));
345 q4tau = q4 / (taucons + q4);
347 fcsenz = (3.f / 7.f) * (1.0
f + 2.0
f * csenz);
348 fcsolz = (3.f / 7.f) * (1.0
f + 2.0
f * csolz);
350 f = (1.0f - q4tau * fcsolz)
351 / (0.49
f * ((1.
f + 4.
f * csolz * csenz) / (csolz + csenz))
352 - q4tau * fcsolz * fcsenz);
362 asat = (ravgsat - asbar) *
f + asbar;
368 acldmax = 1.0f - (q4 / (300.0f + q4)) * fcsolz;
370 if ((asat - asbar) >= acldmax) {
373 q4tau = q4 / (taucons + q4);
376 taucons = q4 * ((fcsolz / (1.0f - (asat - asbar))) - 1.0
f);
382 if (taucons > 15.0
f) {
383 q4tau = q4 / (taucons + q4);
385 f = (1.0f - q4tau * fcsolz)
386 / (0.49
f * ((1.
f + 4.
f * csolz * csenz) / (csolz + csenz))
387 - q4tau * fcsolz * fcsenz);
388 asat = (ravgsat - asbar) *
f + asbar;
392 if ((asat - asbar) >= acldmax) {
395 q4tau = q4 / (taucons + q4);
399 q4tau = q4 / (taucons + q4);
417 delt = (tset - trise) / 10.0
f;
423 for (
i = 0;
i < 11;
i++) {
424 tmstep = trise +
i * delt;
430 cossz = cosf(sz * (
float)
M_PI / 180.0
f);
431 fcossz = (3.f / 7.f) * (1.0
f + 2.0
f * cossz);
441 tg_oz = expf(-kavg_oz * powf((dobson * 1000. / cossz), 0.99
f));
442 tg_wv = expf(-kavg_wv * powf((watvap / cossz), 0.87
f));
453 tatemp = expf(-(taumol[
band] + tauaer[
band]) / cossz)
457 td += tatemp * fo[
band] * weight[
band];
476 abar = 1.0f - q4tau * fcossz;
478 abar = asat * (1.0f - q4tau * fcossz) / (1.0
f - q4tau * fcsolz);
484 q4tau = q4 / (taucons + q4);
485 abar = 1.0f - q4tau * fcossz;
493 func[
i] = cossz * tg * td / (1.0 - abar * saavg);
495 func[
i] = cossz * tg * td * (1.0f - abar) / (1.0
f - asavg)
496 / (1.0f - abar * saavg);
504 for (
i = 0;
i < 10;
i++) {
505 integtrans += delt * (
func[
i] +
func[
i + 1]) / 2.0
f;
512 par = par0 *
l1rec->fsol * integtrans / 24.0f;