OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
nlw_outband.c
Go to the documentation of this file.
1 #include "l12_proto.h"
2 
3 void nlw_outband(int32_t evalmask, int32_t sensorID, float wave[], int32_t nwave, float Lw[], float nLw[], float outband_correction[]) {
4  static float *a0;
5  static float *a1;
6  static float *a2;
7  static int32_t ib1;
8  static int32_t ib2;
9  static int firstCall = 1;
10 
11  int32_t ib;
12  float ratio;
13  float f;
14 
15  if (firstCall) {
16  firstCall = 0;
17  rdsensorinfo(sensorID, evalmask, "ooblw01", (void **) &a0);
18  rdsensorinfo(sensorID, evalmask, "ooblw02", (void **) &a1);
19  rdsensorinfo(sensorID, evalmask, "ooblw03", (void **) &a2);
20  if (sensorID == CZCS)
21  ib1 = windex(443., wave, nwave);
22  else
23  ib1 = windex(490., wave, nwave);
24  ib2 = windex(550., wave, nwave); /* not 555 for HMODIS */
25  }
26 
27  if (nLw[ib1] > 0.0 && nLw[ib2] > 0.0) {
28 
29  ratio = nLw[ib1] / nLw[ib2];
30 
31  /* limit needs to be wavelength-specific
32  if ((evalmask & NEWOOB) > 0)
33  ratio = MIN(nLw[ib1]/nLw[ib2],4.0);
34  else
35  ratio = nLw[ib1]/nLw[ib2];
36  */
37 
38  // should be ratio < 0 = 0, ratio > 10 = 10 ???
39 
40  if (ratio > 0.0 && ratio <= 10.0) {
41  for (ib = 0; ib < nwave; ib++) {
42  f = (a2[ib] * ratio + a1[ib]) * ratio + a0[ib];
43  nLw[ib] = nLw[ib] * f;
44  Lw [ib] = Lw [ib] * f;
45  outband_correction[ib] = f;
46  }
47  }
48 
49  }
50 
51 }
double precision function f(R1)
Definition: tmd.lp.f:1454
void nlw_outband(int32_t evalmask, int32_t sensorID, float wave[], int32_t nwave, float Lw[], float nLw[], float outband_correction[])
Definition: nlw_outband.c:3
int windex(float wave, float twave[], int ntwave)
Definition: windex.c:73
#define CZCS
Definition: sensorDefs.h:17
int32_t rdsensorinfo(int32_t, int32_t, const char *, void **)
Definition: rdsensorinfo.c:69
int32_t sensorID[MAXNFILES]
Definition: l2bin.cpp:97