OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_tricho.c
Go to the documentation of this file.
1 /* --------------------------------------------------------------- */
2 /* get_tricho.c - tricho classification function for MSl12. */
3 /* */
4 /* Inputs: */
5 /* l2rec - level-2 structure containing one complete scan */
6 /* after atmospheric correction. */
7 /* Outputs: */
8 /* tricho - flag 0=no, 1=yes */
9 /* */
10 /* Algorithm Provided By: Ajit Subramaniam. */
11 /* Written By: B. A. Franz, SAIC GSC, SIMBIOS Project, Sept 1999 */
12 /* */
13 /* --------------------------------------------------------------- */
14 
15 #include <stdlib.h>
16 #include <math.h>
17 #include "l12_proto.h"
18 
19 void get_tricho(l2str *l2rec, uint8 tricho[]) {
20 
21  int32_t ip, ipb;
22  float de, nu, tdn;
23  l1str *l1rec = l2rec->l1rec;
24 
25  for (ip = 0; ip < l1rec->npix; ip++) {
26 
27  ipb = l1rec->l1file->nbands*ip;
28 
29  tricho[ip] = 0;
30 
31  /* Skip shallow water or negative nLw conditions, */
32  /* high winds, or cold water */
33  if ((l1rec->flags && COASTZ) > 0 ||
34  l1rec->ws[ip] > 8.0 ||
35  l1rec->sstref[ip] < 25.0 ||
36  l2rec->nLw[ipb + 1] <= 0.0 || /* 443 */
37  l2rec->nLw[ipb + 2] <= 0.0 || /* 490 */
38  l2rec->nLw[ipb + 4] <= 0.0) { /* 555 */
39  continue;
40  }
41 
42  de = l2rec->nLw[ipb + 2] - l2rec->nLw[ipb + 1];
43  nu = l2rec->nLw[ipb + 2] - l2rec->nLw[ipb + 4];
44 
45  if (de > 0 && nu > 0) {
46  tdn = de / nu;
47  if ((l2rec->nLw[ipb + 2] > 1.4 && l2rec->nLw[ipb + 2] < 3.0) &&
48  (tdn > 0.4 && tdn < 0.6))
49  tricho[ip] = 1;
50  }
51 
52  }
53 }
void get_tricho(l2str *l2rec, uint8 tricho[])
Definition: get_tricho.c:19
read l1rec
#define COASTZ
Definition: l2_flags.h:17