OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_Cphyt.c
Go to the documentation of this file.
1 /*
2  * get_Cphyt.c
3  *
4  * This algorithm returns the concentration of the phytoplankton carbon (Cphyt) in mg m^-3, calculated using an
5  * empirical relationship derived from field data between analytical measurements of Cphyt and particulate
6  * backscattering coefficient.
7  *
8  * Reference:
9  * Graff, J.R., Westberry, T.K., Milligan, A.J., Brown, M.B., Dall’Olmo, G., Dongen-Vogels, V.v., Reifel, K.M., & Behrenfeld, M.J. (2015).
10  * Analytical phytoplankton carbon measurements spanning diverse ecosystems.
11  * Deep Sea Research Part I: Oceanographic Research Papers, 102, 16-25
12  *
13  * Created on: Mar 4, 2021
14  * Author: Minwei Zhang
15  */
16 
17 #include "l12_proto.h"
18 
19 void get_Cphyt(l2str *l2rec, float cphyt[])
20 {
21  float bbp_470;
22  float a1=12128., b1=0.59;
23 
24  int32_t ip;
25  int32_t ipb;
26 
27  static int32_t firstcall=1,ib443, npix,nbands;
28  float *bbp,*bbp_s;
29  l1str *l1rec=l2rec->l1rec;
30 
31  if(firstcall){
32  firstcall=0;
33  ib443=bindex_get(443);
34  if (ib443 < 0) {
35  printf("get_Cphyt: incompatible sensor wavelengths (no 443 for bbp and bbp_s).\n");
36  exit(1);
37  }
38  npix = l1rec->npix;
39  nbands=l1rec->l1file->nbands;
40  }
41 
42  if (!giop_ran(l1rec->iscan)){
43  run_giop(l2rec);
44 
45  }
47  bbp_s=giop_get_bbp_s_pointer();
48  /* */
49  /* Compute desired products at each pixel */
50  /* */
51  for (ip = 0; ip < npix; ip++) {
52  cphyt[ip]=BAD_FLT;
53 
54  if(l2rec->l1rec->mask[ip] || l2rec->l1rec->solz[ip] >= SOLZNIGHT)
55  continue;
56 
57  ipb=ip*nbands+ib443;
58 
59  if(bbp[ipb]<0 || bbp[ipb]>0.15 || bbp_s[ip]<-3 || bbp_s[ip]>3)
60  continue;
61 
62  if(input->cphyt_opt==1){
63  bbp_470=bbp[ipb]*pow(470./443.,bbp_s[ip]);
64  cphyt[ip]=a1*bbp_470+b1;
65  }else if(input->cphyt_opt==2){
66  cphyt[ip]=13000.*bbp[ipb]-0.00035;
67  }else{
68  printf("get_Cphyt: unrecognized cphyt_opt=%d\n", input->cphyt_opt);
69  exit(1);
70  }
71 
72  }
73 
74 }
75 
read l1rec
void get_Cphyt(l2str *l2rec, float cphyt[])
Definition: get_Cphyt.c:19
instr * input
int giop_ran(int recnum)
Definition: giop.c:569
int bindex_get(int32_t wave)
Definition: windex.c:45
instead the metadata field ProcessingEnvinronment is filled in from the output of a call to the POSIX compliant function uname from within the L1B code A small bug in L1B_Tables an incorrect comparison of RVS coefficients for TEBs to RVS coefficients for RSBs was being made This was replaced with a comparison between TEB coefficients This error never resulted in an incorrect RVS correction but did lead to recalculating the coefficients for each detector in a thermal band even if the coefficients were the same for all detectors To reduce to overall size of the reflective LUT HDF fill values were eliminated from all LUTs previously dimensioned where and where NUM_TIMES is the number of time dependent table pieces In Preprocess a small error where the trailing dropped scan counter was incremented when the leading dropped scan counter should have been was fixed This counter is internal only and is not yet used for any chiefly to casting of were added to make it LINUX compatible Output of code run on LINUX machines displays differences of at most scaled sector incalculable values of the Emissive calibration factor b1
Definition: HISTORY.txt:576
float * giop_get_bbp_pointer()
Definition: giop.c:2775
#define SOLZNIGHT
Definition: l1.h:57
#define BAD_FLT
Definition: jplaeriallib.h:19
int32_t nbands
void run_giop(l2str *l2rec)
Definition: giop.c:1616
float * giop_get_bbp_s_pointer()
Definition: giop.c:2797
int npix
Definition: get_cmp.c:27