OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_smoke.c
Go to the documentation of this file.
1 /*---------------------------------------------------------------------*/
2 /* get_smoke.c - Eric Vermote's smoke index */
3 /* */
4 /* Inputs: */
5 /* l2rec - level-2 structure containing one complete scan after */
6 /* atmospheric correction. */
7 /* Outputs: */
8 /* smoke - smoke index, 1 value per pixel. */
9 /* */
10 /* Written by: Bryan Franz, SAIC-GSC, February 2000 */
11 /* */
12 /*---------------------------------------------------------------------*/
13 
14 #include <stdlib.h>
15 #include <math.h>
16 #include "l12_proto.h"
17 
18 static float fill = 0.0;
19 
20 void get_smoke(l2str *l2rec, float smoke[]) {
21  int32_t ip, ipb;
22 
23  float rho1;
24  float rho2;
25  float rho4;
26  float rho5;
27  float rho6;
28 
29  l1str *l1rec = l2rec->l1rec;
30 
31  for (ip = 0; ip < l1rec->npix; ip++) {
32 
33  ipb = l1rec->l1file->nbands*ip;
34 
35  rho1 = l1rec->rhos[ipb + 0];
36  rho2 = l1rec->rhos[ipb + 1];
37  rho4 = l1rec->rhos[ipb + 3];
38  rho5 = l1rec->rhos[ipb + 4];
39  rho6 = l1rec->rhos[ipb + 5];
40 
41  if (rho1 < 0.0 || rho6 > 0.4)
42  smoke[ip] = fill;
43 
44  else if (rho2 < rho4 || rho5 < rho6)
45  smoke[ip] = 0.0;
46 
47  else
48  smoke[ip] = rho1 * (rho2 - rho4) * (rho5 - rho6) * 10000.0;
49 
50  }
51 
52 }
53 
void get_smoke(l2str *l2rec, float smoke[])
Definition: get_smoke.c:20
read l1rec