Go to the documentation of this file.
11 #include <gsl/gsl_poly.h>
14 #define Z_CHL_MAX 15.0
38 static int ib490 = -1;
43 const float c1 [] = {-0.057, 0.482, 4.221};
44 const float c2 [] = {0.183, 0.702, -2.567};
45 const float alpha[] = {0.090, 1.465, -0.667};
54 l1str *
l1rec = l2rec->l1rec;
67 if (
p->prod_ix <= 0 ||
p->prod_ix > 100) {
68 printf(
"Zeu_lee: percent light should be between 1 and 100.\n");
71 tau = -log(
p->prod_ix / 100.0);
76 printf(
"IOP-based Z*_lee product requires iop model selection (iop_opt). ");
77 printf(
"Using default model.\n");
85 printf(
"Zeu_lee: a 490nm channel is required for this algorithm\n");
90 for (ip = 0; ip <
l1rec->npix; ip++) {
92 ipb = ip *
l1rec->l1file->nbands + ib490;
95 bb490 = l2rec->bb[ipb];
99 if (
l1rec->mask[ip] || a490 <= 0.0 || bb490 <= 0.0) {
104 k1 = (c1[0] + c1[1] * sqrt(a490) + c1[2] * bb490)*(1 +
alpha[0] * stheta);
105 k2 = (c2[0] + c2[1]* (a490) + c2[2] * bb490)*(
alpha[1] +
alpha[2] *
ctheta);
106 y1 = (k1 * k1 - k2 * k2 - 2.0 * tau * k1) / (k1 * k1);
107 y2 = (tau * tau - 2.0 * tau * k1) / (k1 * k1);
108 y3 = (tau * tau) / (k1 * k1);
109 gsl_poly_solve_cubic(y1, y2, y3, &z1, &z2, &z3);
110 if (z2 > 0.0 && z3 > 0.0)
111 Zp[ip] =
MIN(z2, z3);
112 else if (z1 > 0.0 && z2 > 0.0)
113 Zp[ip] =
MIN(z1, z2);
114 else if (z1 > 0.0 && z3 > 0.0)
115 Zp[ip] =
MIN(z1, z3);
152 l1str *
l1rec = l2rec->l1rec;
154 for (ip = 0; ip <
l1rec->npix; ip++) {
156 chl = l2rec->chl[ip];
162 if (
l1rec->mask[ip] || chl <= 0.0) {
163 Zeu[ip] =
p->badData;
167 Zeu[ip] = pow(10.0, 1.524 +
x * (-0.460 +
x * (-0.00051 +
x * 0.0282)));
202 l1str *
l1rec = l2rec->l1rec;
204 for (ip = 0; ip <
l1rec->npix; ip++) {
206 chl = l2rec->chl[ip];
213 Zsd[ip] =
p->badData;
217 Zsd[ip] = 8.50 +
x * (-12.6 +
x * (7.36 -
x * 1.43));
233 l1str *
l1rec = l2rec->l1rec;
235 for (ip = 0; ip <
l1rec->npix; ip++) {
237 chl = l2rec->chl[ip];
243 if (
l1rec->mask[ip] || chl <= 0.0) {
244 intchl[ip] =
p->badData;
248 Zeu = pow(10.0, 1.524 +
x * (-0.460 +
x * (-0.00051 +
x * 0.0282)));
249 intchl[ip] = Zeu*chl;
260 void Zsd_gbr(l2str *l2rec, l2prodstr *
p,
float *Zsd) {
261 static int firstCall = 1;
265 l1str *
l1rec = l2rec->l1rec;
269 switch (
l1rec->l1file->sensorID) {
285 for (ip = 0; ip <
l1rec->npix; ip++) {
288 Zsd[ip] = pow(10.0, (log10(Zsd[ip]) - a0) / a1);
290 Zsd[ip] =
p->badData;
void Zsd_morel(l2str *l2rec, l2prodstr *p, float *Zsd)
real, dimension(4) ctheta
int bindex_get(int32_t wave)
void get_iops(l2str *l2rec, int32_t iop_opt)
void intchl_morel(l2str *l2rec, l2prodstr *p, float *intchl)
void Zsd_gbr(l2str *l2rec, l2prodstr *p, float *Zsd)
void get_photic_depth(l2str *l2rec, l2prodstr *p, float prod[])
void Zphotic_lee(l2str *l2rec, l2prodstr *p, float Zp[])
void Zeu_morel(l2str *l2rec, l2prodstr *p, float *Zeu)