Go to the documentation of this file.
   15 int convl21(l2str *l2rec, tgstr *tgrec, int32_t spix, int32_t 
epix,
 
   16         float *vLt, vcstr *vrec) {
 
   17     static int firstCall = 1;
 
   18     static int vcal_opt = -1;
 
   19     static float *brdfsensor;
 
   20     static float *brdfinsitu;
 
   39     l1str *
l1rec = l2rec->l1rec;
 
   46         if ((brdfsensor = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
   47             printf(
"-E- %s line %d : error allocating memory for brdfsensor in convl21.\n",
 
   51         if ((brdfinsitu = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
   52             printf(
"-E- %s line %d : error allocating memory for brdfinsitu in convl21.\n",
 
   56         if ((
F0 = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
   57             printf(
"-E- %s line %d : error allocating memory for F0 in convl21.\n",
 
   61         if ((wave = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
   62             printf(
"-E- %s line %d : error allocating memory for wave in convl21.\n",
 
   67         for (ib = 0; ib < 
nbands; ib++) {
 
   78         for (ib = 0; ib < 
nbands; ib++)
 
   79             wave[ib] = 
l1file->fwave[ib];
 
   89             printf(
"%s: Unknown calibration inversion option %d %d\n",
 
   94     if ((
Rrs = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
   95         printf(
"-E- %s line %d : error allocating memory for Rrs in convl21.\n",
 
   99     if ((nLw = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
  100         printf(
"-E- %s line %d : error allocating memory for nLw in convl21.\n",
 
  104     if ((Lw = (
float *) calloc(
nbands, 
sizeof (
float))) == 
NULL) {
 
  105         printf(
"-E- %s line %d : error allocating memory for Lw in convl21.\n",
 
  111     memset(vLt, 0, 
sizeof (
float)*
l1rec->npix * 
l1file->nbands);
 
  121             for (ib = 0; ib < 
nbands; ib++) {
 
  139             for (ib = 0; ib < 
nbands; ib++) {
 
  142                     if (tgrec->Lw[ipb] < 0.0)
 
  145                     if (tgrec->nLw[ipb] < 0.0)
 
  150         if (foundneg) 
continue;
 
  155             if (tgrec->solz[ip] >= 0.0)
 
  156                 solz_insitu = tgrec->solz[ip];
 
  158                 solz_insitu = 
l1rec->solz[ip];
 
  160             if (
input->vcal_solz >= 0.0)
 
  161                 solz_insitu = 
input->vcal_solz;
 
  163                 solz_insitu = 
l1rec->solz[ip];
 
  165         mu0_insitu = cos(solz_insitu / 
RADEG);
 
  169         for (ib = 0; ib < 
nbands; ib++) {
 
  172                 tau = -log(
l1rec->tg_sol[ipb] * 
l1rec->t_sol[ipb])
 
  175                     Lw[ib] = tgrec->Lw[ipb];
 
  177                     Lw[ib] = 
input->vcal_Lw[ib];
 
  180                         / exp(-tau / mu0_insitu)
 
  184                     nLw[ib] = tgrec->nLw[ipb];
 
  186                     nLw[ib] = 
input->vcal_nLw[ib];
 
  190             Rrs[ib] = nLw[ib] / 
F0[ib];
 
  195             if (
input->vcal_chl >= 0.0)
 
  196                 chl = 
input->vcal_chl;
 
  199                 if (chl < 0.0) 
continue;
 
  211                     chl, nLw, 
F0, brdfsensor);
 
  216                         solz_insitu, 0.0, 0.0, 
l1rec->ws[ip],
 
  217                         chl, nLw, 
F0, brdfinsitu);
 
  224         for (ib = 0; ib < 
nbands; ib++) {
 
  247                 tLw = nLw[ib] * brdfinsitu[ib]
 
  266                     * 
l1rec->polcor[ipb])
 
  268                     * 
l1rec->tg_sen[ipb];
 
  271                 vrec->tLw [ipb] = tLw;
 
  272                 vrec->Lw [ipb] = Lw[ib];
 
  273                 vrec->nLw [ipb] = nLw[ib];
 
  274                 vrec->brdfsat[ipb] = brdfsensor[ib];
 
  275                 vrec->brdftgt[ipb] = brdfinsitu[ib];
 
  
int32 l1file(int32 sdfid, int32 *nsamp, int32 *nscans, int16 *dtynum)
 
float get_default_chl(l2str *l2rec, float Rrs[])
 
int convl21(l2str *l2rec, tgstr *tgrec, int32_t spix, int32_t epix, float *vLt, vcstr *vrec)
 
int32_t rdsensorinfo(int32_t, int32_t, const char *, void **)
 
int ocbrdf(l2str *l2rec, int32_t ip, int32_t brdf_opt, float wave[], int32_t nwave, float solz, float senz, float phi, float ws, float chl, float nLw[], float Fo[], float brdf[])