OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_toa_refl.c
Go to the documentation of this file.
1 /* --------------------------------------------------------------- */
2 /* get_toa_refl.c - compute top-of-atmosphere reflectance. */
3 /* */
4 /* Inputs: */
5 /* l2rec - level-2 structure containing one complete scan */
6 /* after atmospheric correction. */
7 /* band = band number 0-7 */
8 /* Outputs: */
9 /* rhot - toa reflectance */
10 /* */
11 /* Written By: B. Franz, SAIC GSC, SIMBIOS Project, 11 April 2000 */
12 /* */
13 /* --------------------------------------------------------------- */
14 
15 #include <stdlib.h>
16 #include <math.h>
17 #include "l12_proto.h"
18 
19 void get_toa_refl(l2str *l2rec, int band, float rhot[]) {
20  static float pi = 3.141592654;
21  static float radeg = 57.29577951;
22 
23  float mu0;
24  int32_t ip, ipb;
25 
26  l1str *l1rec = l2rec->l1rec;
27  int32_t nbands = l1rec->l1file->nbands;
28 
29  for (ip = 0; ip < l1rec->npix; ip++) {
30  ipb = ip * nbands + band;
31  mu0 = cos(l1rec->solz[ip] / radeg);
32  rhot[ip] = pi * l2rec->l1rec->Lt[ipb] / l1rec->Fo[band] / mu0;
33  }
34 
35  return;
36 }
read l1rec
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second band
const double pi
int32_t nbands
float mu0
void get_toa_refl(l2str *l2rec, int band, float rhot[])
Definition: get_toa_refl.c:19