OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
whitecaps.c
Go to the documentation of this file.
1 #include "l12_proto.h"
2 
3 /* -----------------------------------------------------------------
4  * whitecaps() - whitecap radiances per band in mW/cm^2/um/sr
5  *
6  * Inputs:
7  * mu0[] - Cosine of solar zenith angle
8  * mu[] - Cosine of sensor zenith angle
9  * Fo[] - Solar irradiance (mW/cm^2/um/Sr)
10  * tau_r[] - Rayleigh optical thickness per band
11  * press - Atmospheric pressure (millibars)
12  * ws - Wind speed (m/s)
13  * ws_max - Maximum allowed wind speed (m/s)
14  *
15  * Ouputs:
16  * tLf[] - Whitecap radiance at sensor (mW/cm^2/um/Sr)
17  *
18  * History:
19  *
20  * B. A. Franz, SAIC, Ocean Discipline Processing Group, Feb. 1999
21  *
22  * - Reduced whitecap reflectance by 75%, as suggested by Gordon
23  * and implemented by the SeaWiFS project. BAF, 26 June 1998.
24  *
25  * - Added Frouin wavelength dependence. BAF, 13 May 1999.
26  *
27  * - Raised albedo multiplier from 0.25 to 0.4 and updated to new
28  * Frouin wavelength dependence, BAF, 24 May 1999
29  *
30  * - Converted to C. Externalized albedos, BAF, 5 Aug 2004.
31  *
32  * - remove ozone transmittance, BAF, Aug 2006.
33  *
34  * - replace with Stramska model for eval, SWB, Nov 2008.
35  * ----------------------------------------------------------------- */
36 
37 void whitecap_spectral_shape(int32_t nwave, float *wave, float *awc) {
38  int nwc_tab = 8;
39  float awc_wav[] = {412, 443, 490, 510, 555, 670, 765, 865};
40  float awc_tab[] = {1.0, 1.0, 1.0, 1.0, 1.0, 0.889225, 0.760046, 0.644950};
41  int iw;
42 
43  for (iw = 0; iw < nwave; iw++) {
44  if (wave[iw] < 1000)
45  awc[iw] = linterp(awc_wav, awc_tab, nwc_tab, wave[iw]);
46  else
47  awc[iw] = 0.0;
48  }
49 }
50 
51 void whitecaps(int32_t sensorID, int32_t evalmask, int32_t nwave,
52  float ws, float ws_max, float rhof[]) {
53  static int firstCall = 1;
54  static float *awhite;
55 
56  float rhowc; /* White cap reflectance */
57  int32_t iw;
58 
59  // get spectral shape of whitecap reflectance, interpolated to
60  // sensor spectral bands
61 
62  if (firstCall) {
63  float *wave;
64  firstCall = 0;
65  rdsensorinfo(sensorID, evalmask, "fwave", (void **) &wave);
66  if ((awhite = (float *) calloc(nwave, sizeof (float))) == NULL) {
67  printf("Unable to allocate space for awhite.\n");
68  exit(1);
69  }
70  whitecap_spectral_shape(nwave, wave, awhite);
71  }
72 
73  // Stramska and Petelski (2003) wc fractional coverage for underdeveloped seas
74  float ws_min = 6.33;
75  if (ws > ws_min && ws_max > ws_min) {
76  rhowc = 1.925E-5 * pow((MIN(ws, ws_max) - ws_min), 3.00);
77  for (iw = 0; iw < nwave; iw++)
78  rhof[iw] = awhite[iw] * rhowc;
79  } else {
80  for (iw = 0; iw < nwave; iw++)
81  rhof[iw] = 0.0;
82  }
83 
84 }
85 
86 
#define MIN(x, y)
Definition: rice.h:169
void whitecaps(int32_t sensorID, int32_t evalmask, int32_t nwave, float ws, float ws_max, float rhof[])
Definition: whitecaps.c:51
#define NULL
Definition: decode_rs.h:63
void whitecap_spectral_shape(int32_t nwave, float *wave, float *awc)
Definition: whitecaps.c:37
float linterp(float xin[], float yin[], int32_t nin, float xout)
Definition: lspline.c:59
int32_t rdsensorinfo(int32_t, int32_t, const char *, void **)
Definition: rdsensorinfo.c:69
int32_t sensorID[MAXNFILES]
Definition: l2bin.cpp:97