NASA Logo
Ocean Color Science Software

ocssw V2022
get_uncertainty.c
Go to the documentation of this file.
1 //#include <stdio.h>
2 #include "l12_proto.h"
3 
4 #include <gsl/gsl_rng.h>
5 #include <gsl/gsl_randist.h>
6 #include <sys/time.h>
7 
8 #include <hdf5.h>
9 //--------------------------//
10 
11 #define ERRCODE 2
12 #define ERR(e) {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);}
13 
14 unsigned long int random_seed() {
15  /* Seed generator for gsl. */
16  struct timeval tv;
17  gettimeofday(&tv, 0);
18  return (tv.tv_sec + tv.tv_usec);
19 }
20 
21 float make_noise(float sigma) {
22  unsigned long randSeed = random_seed();
23  float noise;
24  gsl_rng *rng;
25  rng = gsl_rng_alloc(gsl_rng_mt19937);
26  gsl_rng_set(rng, randSeed);
27  noise = gsl_ran_gaussian(rng, sigma);
28  gsl_rng_free(rng);
29  return (noise);
30 }
31 
32 void noise_model_ocis(l1str *l1rec, float *noise) {
33 
34  static int firstcall=1;
35  static size_t nwave,ncoef;
36  static float *Lnoise_c;
37  static int16 *wave;
38 
39  int nbands=l1rec->l1file->nbands;
40  int npix=l1rec->npix;
41  float *wave_oci=l1rec->l1file->fwave;
42  static int *wvindx;
43  int i,j;
44 
45  if(firstcall){
46  firstcall=0;
47 
48  wvindx=(int *)malloc(nbands*sizeof(int));
49 
50  char *filedir;
51  char filename[FILENAME_MAX];
52  if ((filedir = getenv("OCDATAROOT")) == NULL) {
53  printf("-E- %s: OCDATAROOT env variable undefined.\n", __FILE__);
54  exit(EXIT_FAILURE);
55  }
56  strcpy(filename, filedir);
57  strcat(filename, "/");
58  strcat(filename, "ocis");
59  strcat(filename, "/");
60  strcat(filename, "oci_snr.h5");
61  printf("OCI SNR FILE: %s\n", filename);
62 
63  int ncid, varid1, varid2;
64  /* error handling. */
65  int retval;
66 
67  /* Open the file. NC_NOWRITE tells netCDF we want read-only access to the file.*/
68  if (retval = nc_open(filename, NC_NOWRITE, &ncid))
69  ERR(retval);
70 
71  /* Get the varid of the data variable, based on its name. */
72  if ((retval = nc_inq_varid(ncid, "LNOISE_C", &varid1)) )
73  ERR(retval);
74 
75  int dimids[2];
76  if(retval = nc_inq_vardimid(ncid, varid1, dimids))
77  ERR(retval);
78 
79  if(retval = nc_inq_dimlen(ncid, dimids[1], &nwave))
80  ERR(retval);
81  if(retval = nc_inq_dimlen(ncid, dimids[0], &ncoef))
82  ERR(retval);
83 
84  Lnoise_c=(float *)malloc(ncoef*nwave*sizeof(float));
85 
86  /* Read the data. */
87  if ((retval = nc_get_var_float(ncid, varid1, Lnoise_c)) )
88  ERR(retval);
89 
90  wave=(int16_t *)malloc(nwave*sizeof(int16_t));
91  if ((retval = nc_inq_varid(ncid, "WAVE", &varid2)) )
92  ERR(retval);
93  if ((retval = nc_get_var_short(ncid, varid2, wave)) )
94  ERR(retval);
95 
96  /* Close the file, freeing all resources. */
97  if ((retval = nc_close(ncid)))
98  ERR(retval);
99 
100  float wavedif;
101  for (i=0;i<nbands;i++) {
102  wavedif=fabs(wave_oci[i]-(float)wave[0]);
103  wvindx[i]=0;
104  for(j=1;j<nwave;j++){
105  if(fabs(wave_oci[i]-(float)wave[j])<wavedif){
106  wavedif=fabs(wave_oci[i]-(float)wave[j]);
107  wvindx[i]=j;
108  }
109  }
110  }
111  free(wave);
112  }
113 
114  float scaled_lt;
115  for (i=0;i<npix;i++) {
116  for(j=0;j<nbands;j++){
117  scaled_lt=l1rec->Lt[i*nbands+j]*10; //covert from mw.cm-2.sr-1.um-1 to w.m-2.sr-1.um-1.
118  noise[i*nbands+j]=sqrt(Lnoise_c[wvindx[j]]+Lnoise_c[nwave+wvindx[j]]*scaled_lt );// /snr_scale[wvindx[j]];
119  }
120  }
121 }
122 
124 int noise_index_oci(float wave)
125 {
126  int i, index;
127  float wave_modis[16]={412,443,469,488,531,547,555,645,667,678,748,859,869,1240,1640,2130};
128 
129  if(wave<wave_modis[0])
130  index=0;
131  else if(wave>wave_modis[15])
132  index=15;
133  else{
134  for(i=0;i<16;i++){
135  if(wave<wave_modis[i])
136  break;
137  }
138  index=i;
139  if(fabs(wave-wave_modis[i-1])< fabs(wave-wave_modis[i]))
140  index=i-1;
141  }
142  return index;
143 }
144 
145 void set_error_input(l1str *l1rec, float *sensor_noise)
146 {
147  filehandle *l1file=l1rec->l1file;
148  uncertainty_t *uncertainty=l1rec->uncertainty;
149  int32_t sensorID=l1file->sensorID;
150  int32_t nbands=l1file->nbands;
151  float *wave=l1file->fwave;
152  int32_t npix=l1rec->npix;
153  int32_t ip,ib,ipb;
154  float mu,mu0;
155  //float *pr=l1rec->pr;
156  float *Tau_r=l1file->Tau_r;
157  static float p0 = STDPR;
158  //int ib869=windex(869,l1file->fwave,nbands);
159  //float *vcgain=l1_input->gain;
160  //float *offset=l1_input->offset;
161  static float *dvc_rel;
162  static float *noise;
163  static int firstcall=1;
164 
165  //read the relative uncertainty coefficients in VC from a file?
166  float dvc_rel_temp[16]={0.0077, 0.0083,1.0,0.0093,0.0105,0.0116,0.0121,1.0,0.0236,0.0249,0.035,1.0,0.05,1.0,1.0,1.0};//new version 869nm=5%, Moby 5%
167 
168  // 412 443 469 488 531 547 555 645 667 678 748 859 869 1240 1640 2130
169  //float corr_nir_s[16]={0.2851,0.3336,0.0,0.3993,0.4906,0.5589,0.5870,0.0000,0.9443,0.9585,1.0000,0.0000,0.9724,1.0,1.0,1.0};
170  //float corr_nir_l[16]={0.2172,0.2116,0.0,0.2177,0.2973,0.3710,0.4002,0.0000,0.8534,0.8784,0.9724,0.0000,1.0000,1.0,1.0,1.0};
171 
172  // 412 443 469 488 531 547 555 645 667 678 748 859 869 1240 1640 2130
173  //float corr_nir_s[16]={0.2851,0.3336,0.0,0.3993,0.4906,0.5589,0.5870,0.0,1.000,1.000,1.0,0.0,1.0,0.0,0.0,0.0};
174  //float corr_nir_l[16]={0.2172,0.2116,0.0,0.2177,0.2973,0.3710,0.4002,0.0,1.000,1.000,1.0,0.0,1.0,0.0,0.0,0.0};
175 
176 
177  if(firstcall){
178  firstcall=0;
179  dvc_rel=(float *)malloc(nbands*sizeof(float));
180  noise=(float *)malloc(npix*nbands*sizeof(float));
181 
182  for(ib=0;ib<nbands;ib++)
183  dvc_rel[ib]=0.;
184 
185  if(uncertainty){
186  switch(sensorID){
187  case OCI:
188  case OCIS:
189  for(ib=0;ib<nbands;ib++){
190 
191  if(wave[ib]<400)
192  dvc_rel[ib]=0.0047;
193  else if(wave[ib]<=865)
194  dvc_rel[ib]=0.004;
195 
196  }
197  ib=bindex_get(820.0);
198  dvc_rel[ib]=0.0075;
199 
200  //for glimr
201  for(ib=0;ib<nbands;ib++){
202  // uncertainty->corr_nir_s[ib]=0.59;
203  //uncertainty->corr_nir_l[ib]=0.53;
204  // dvc_rel[ib]=0.005;
205  }
206  //uncertainty->corr_nir_s[222]=0.97;
207  // uncertainty->corr_nir_l[176]=0.97;
208  break;
209  case MODISA:
210  //float dvc_rel[16]={0.0074, 0.0078,1.0,0.0082,0.0078,0.0082,0.0084,1.0,0.0144,0.0151,0.021,1.0,0.03,1.0,1.0,1.0}; //new version 869nm=3%, Moby 5%
211  //float dvc_rel_temp[16]={0.0077, 0.0083,1.0,0.0093,0.0105,0.0116,0.0121,1.0,0.0236,0.0249,0.035,1.0,0.05,1.0,1.0,1.0};//new version 869nm=5%, Moby 5%
212  //float dvc_rel[16]={0.0056, 0.0063,1.0,0.0075,0.0101,0.0114,0.0118,1.0,0.0236,0.0249,0.035,1.0,0.05,1.0,1.0,1.0};//new version 869nm=5%, Moby 3%
213  for(ib=0;ib<nbands;ib++){
214  dvc_rel[ib]=dvc_rel_temp[ib];
215  }
216  break;
217  default:
218  break;
219  }
220  }
221 
222 
223  }
224 
225  switch (sensorID) {
226  case OCI:
227  case OCIS:
228  noise_model_ocis(l1rec,noise);
229  break;
230 
231  case SEAWIFS:
232  case MERIS:
233  case OCTS:
234  case OCM1:
235  case OCM2:
236  case MOS:
237  case HICO:
238  case CZCS:
239  case OSMI:
240  case VIIRSN:
241  case VIIRSJ1:
242  case VIIRSJ2:
243  case OCRVC:
244  case GOCI:
245  printf("%s Line %d: need a noise mode for this sensor\n",
246  __FILE__, __LINE__);
247  exit(1);
248  break;
249  default:
250  printf("%s Line %d: need a noise mode for this sensor\n",
251  __FILE__, __LINE__);
252  exit(1);
253  break;
254  }
255 
256  //lt_agregat_ocis(l1rec);
257 
258  if(!uncertainty){
259  for(ip=0;ip<npix; ip++)
260  for(ib=0;ib<nbands;ib++){
261  ipb=ip*nbands+ib;
262  sensor_noise[ipb]=noise[ipb]/10.;
263  }
264  return;
265  }
266 
267  for(ip=0;ip<npix; ip++){
268 
269  for(ib=0;ib<nbands;ib++){
270  ipb=ip*nbands+ib;
271 
272  //indx=noise_index_oci(wave[ib]);
273 
274  // random noise for sensor
275  //noise[ipb]=0.;
276  uncertainty->dsensor[ipb]=noise[ipb]/10.; //covert w.m-2.sr-1.um-1 to mw.cm-2.sr-1.um-1 .
277 
278  //uncertainty->dsensor[ipb]*=vcgain[ib];
279 
280  uncertainty->dvc[ipb]=dvc_rel[ib]*l1rec->Lt[ipb];
281  //uncertainty->dvc[ipb]=0.0;
282 
283  //if(ib!=ib869)
284  // uncertainty->dsensor[ipb]+=0.005*l1rec->Lt[ipb];
285 
286  // Rayleigh systematic error based on Wang et al.(2005)
287  // uncertainty->dLr[ipb]=l1rec->Lr[ipb]*0.001;
288  //uncertainty->dLr[ipb]=0.0;
289  }
290  }
291 
292  // error in ancillary data
293  float rel_error=0.0;
294  for(ip=0;ip<npix; ip++)
295  {
296  uncertainty->drh[ip]=rel_error*l1rec->rh[ip];
297  uncertainty->doz[ip]=rel_error*l1rec->oz[ip];
298  uncertainty->dpr[ip]=rel_error*l1rec->pr[ip];
299  uncertainty->dwv[ip]=rel_error*l1rec->wv[ip];
300  uncertainty->dws[ip]=rel_error*l1rec->ws[ip];
301 
302  uncertainty->dno2_tropo[ip]=rel_error*l1rec->no2_tropo[ip];
303  uncertainty->dno2_strat[ip]=rel_error*l1rec->no2_strat[ip];
304  }
305 
306  //error in diffuse transmittance resulted from the ancillary data
307  for(ip=0;ip<npix;ip++)
308  {
309  mu0=l1rec->csolz[ip];
310  mu= l1rec->csenz[ip];
311  for(ib=0;ib<nbands;ib++)
312  {
313  ipb=ip*nbands+ib;
314  uncertainty->dt_sol[ipb]=l1rec->t_sol [ipb]*0.5 / p0 * Tau_r[ib] / mu0*uncertainty->dpr[ip];
315  uncertainty->dt_sen[ipb]=l1rec->t_sen [ipb]*0.5 / p0 * Tau_r[ib] / mu*uncertainty->dpr[ip];
316  }
317  }
318 
319  /* error in gas transmittance */
320 
322 
323 }
324 
325 
326 /*
327 if uncertainty products are produced, calculate the uncertainty of the uncertainty sources, return NULL.
328 Otherwise, calculate the sensor noise, that is used by the mbac AC algorithm, return sensor_noise.
329 
330 */
331 float *get_uncertainty(l1str *l1rec) {
332 
333 #define N_anc 7
334 
335  int ip,iw,ib,ipb,iw_table;
336  int nbands=l1rec->l1file->nbands;
337  uncertainty_t *uncertainty=l1rec->uncertainty;
338  int npix=l1rec->npix;
339  float *wave=l1rec->l1file->fwave;
340  static int firstcall=1;
341  static float *SNR_scale, *noise_coef, *corr_coef_rhot, *rel_unc_vc,*temp_corr_coef;
342  static float Lr_unc=0.0;
343  int polynomial_order=4, iorder;
344  float tmp_poly;
345  static float *noise_temp=NULL;
346  static char model_type[20]="\0";
347  static int nbands_table=0, *bandindex;
348  static float *wave_table;
349  static int sensorID;
350 
351  float scaled_lt;
352  static int uncertainty_lut=1;
353 
354  if(firstcall){
355  firstcall=0;
356 
357  /* if(l1rec->l1file->sensorID==OCI ||l1rec->l1file->sensorID==OCIS ){
358  if(firstcall){
359  firstcall=0;
360 
361  if(!uncertainty)
362  noise_temp=(float *)malloc(nbands*npix*sizeof(float));
363  }
364  set_error_input(l1rec,noise_temp);
365  return noise_temp;
366  }*/
367 
368 
369  if(uncertainty)
370  corr_coef_rhot=uncertainty->corr_coef_rhot;
371 
372  if(input->uncertaintyfile[0]=='\0'){
373  uncertainty_lut=0;
374  return NULL;
375  }
376 
377  sensorID=l1rec->l1file->sensorID;
378 
379  bandindex=(int *)malloc(nbands*sizeof(int));
380 
381  for(iw=0;iw<nbands;iw++)
382  bandindex[iw]=iw;
383 
384  noise_temp = (float *)malloc(nbands * npix * sizeof(float));
385 
386  char filename[FILENAME_MAX];
387  sprintf(filename, "%s",input->uncertaintyfile);
388  printf("Reading uncertainty from: %s\n", filename);
389 
390  int ncid;
391  int32 sds_id,group_id;
392  nc_type rh_type; /* variable type */
393  int rh_dimids[H4_MAX_VAR_DIMS]; /* dimension IDs */
394  int rh_natts; /* number of attributes */
395  int rh_ndims; /* number of dims */
396  int status;
397 
398  if (nc_open(filename, NC_NOWRITE, &ncid) == NC_NOERR) {
399 
400  status = nc_inq_varid(ncid, "wave", &sds_id);
401  if (status != NC_NOERR) {
402  fprintf(stderr, "-E- %s line %d: Error reading %s from %s.\n",
403  __FILE__, __LINE__, "wave", filename);
404  exit(1);
405  }
406  status = nc_inq_var(ncid, sds_id, 0, &rh_type, &rh_ndims, rh_dimids,
407  &rh_natts);
408 
409  size_t tmpSize;
410  DPTB( nc_inq_dimlen( ncid, rh_dimids[0], &tmpSize ) );
411  nbands_table = tmpSize;
412 
413  wave_table=(float *)malloc(nbands_table*sizeof(float));
414  SNR_scale=(float *)malloc(nbands_table*sizeof(float));
415  noise_coef=(float *)malloc(nbands_table*5*sizeof(float));
416 
417  temp_corr_coef=(float *)malloc(nbands_table*nbands_table*sizeof(float));
418  rel_unc_vc= (float *)malloc (nbands_table*sizeof(float));
419 
420  if (nc_get_var(ncid, sds_id, wave_table) != NC_NOERR) {
421  fprintf(stderr, "-E- %s line %d: Error reading %s from %s.\n",
422  __FILE__, __LINE__, "wave", filename);
423  exit(1);
424  }
425  if(nbands_table!=nbands){
426  printf("The band No. in uncertainty.nc is not equal to the band No. of sensor,interpolation is used\n");
427 
428  for(iw=0;iw<nbands;iw++) {
429 
430  for(iorder=0;iorder<nbands_table;iorder++){
431  if(wave[iw]<=wave_table[iorder])
432  break;
433  }
434  if(iorder==0)
435  iw_table=0;
436  else if(iorder==nbands_table)
437  iw_table=nbands_table-1;
438  else{
439  iw_table=iorder;
440  if(fabs(wave[iw]-wave_table[iorder])>fabs(wave[iw]-wave_table[iorder-1]))
441  iw_table=iorder-1;
442  }
443  bandindex[iw]=iw_table;
444  }
445  }
446 
447  status = nc_inq_ncid(ncid,"random_noise",&group_id);
448  status = nc_inq_varid(group_id, "SNR_scale", &sds_id);
449  if (nc_get_var(group_id, sds_id, SNR_scale) != NC_NOERR) {
450  fprintf(stderr, "-E- %s line %d: Error reading %s from %s.\n",
451  __FILE__, __LINE__, "SNR_scale", filename);
452  exit(1);
453  }
454  status = nc_inq_varid(group_id, "sensor_noise", &sds_id);
455  if(nc_get_att_text(group_id,sds_id,"model_type",model_type)!=NC_NOERR){
456  fprintf(stderr, "-E- %s line %d: Error reading model_type attribute from %s.\n",
457  __FILE__, __LINE__,filename);
458  exit(1);
459  }
460  if (nc_get_var(group_id, sds_id, noise_coef) != NC_NOERR) {
461  fprintf(stderr, "-E- %s line %d: Error reading %s from %s.\n",
462  __FILE__, __LINE__, "sensor_noise", filename);
463  exit(1);
464  }
465 
466  status = nc_inq_ncid(ncid,"vicarious_cal",&group_id);
467  status = nc_inq_varid(group_id, "correlation_coefficient", &sds_id);
468  if (nc_get_var(group_id, sds_id, temp_corr_coef) != NC_NOERR) {
469  fprintf(stderr, "-E- %s line %d: Error reading %s from %s.\n",
470  __FILE__, __LINE__, "correlation_coefficient", filename);
471  exit(1);
472  }
473  status = nc_inq_varid(group_id, "relative_uncertainty", &sds_id);
474  if (nc_get_var(group_id, sds_id, rel_unc_vc) != NC_NOERR) {
475  fprintf(stderr, "-E- %s line %d: Error reading %s from %s.\n",
476  __FILE__, __LINE__, "relative_uncertainty", filename);
477  exit(1);
478  }
479 
480  if (nc_close(ncid) != NC_NOERR) {
481  fprintf(stderr, "-E- %s line %d: error closing %s.\n",
482  __FILE__, __LINE__, filename);
483  exit(1);
484  }
485  }
486 
487  }
488 
489  if(!uncertainty){
490  if(!uncertainty_lut)
491  return NULL;
492  for (ip=0;ip<npix;ip++)
493  for(iw=0;iw<nbands;iw++){
494  tmp_poly=0.;
495  ipb=ip*nbands+iw;
496  scaled_lt=l1rec->Lt[ipb]*10.;
497 
498  iw_table=bandindex[iw];
499 
500  if(strstr(model_type,"polynomial"))
501  for(iorder=0;iorder<=polynomial_order;iorder++)
502  tmp_poly+=noise_coef[iw_table*(polynomial_order+1)+iorder]*pow(scaled_lt,iorder);
503 
504  noise_temp[ipb]=tmp_poly/SNR_scale[iw_table]/10.;
505  if(sensorID==OCI || sensorID==OCIS)
506  noise_temp[ipb]=sqrt(tmp_poly)/SNR_scale[iw_table]/10.;
507 
508  noise_temp[ipb] =
509  sqrt(l1rec->Lt[ipb] * rel_unc_vc[iw_table] * l1rec->Lt[ipb] * rel_unc_vc[iw_table] +
510  noise_temp[ipb] * noise_temp[ipb]);
511 
512  }
513  return noise_temp;
514  }
515 
516  if(uncertainty){
517  for(iw=0;iw<nbands;iw++){
518  iw_table=bandindex[iw];
519 
520  for(ib=0;ib<nbands;ib++)
521  corr_coef_rhot[iw*nbands+ib]=temp_corr_coef[iw_table*nbands_table+bandindex[ib]];
522 
523  if(sensorID==OCI || sensorID==OCIS){
524  for(ib=0;ib<nbands;ib++){
525  corr_coef_rhot[iw*nbands+ib]=0.;
526  if(ib==iw)
527  corr_coef_rhot[iw*nbands+ib]=1.;
528  }
529  }
530  }
531  }
532 
533  // calculate uncertainty of uncertainty sources
534  for (ip=0;ip<npix;ip++) {
535  for(iw=0;iw<nbands;iw++){
536  tmp_poly=0.;
537  ipb=ip*nbands+iw;
538  scaled_lt=l1rec->Lt[ipb]*10.;
539 
540  iw_table=bandindex[iw];
541  if(strstr(model_type,"polynomial"))
542  for(iorder=0;iorder<=polynomial_order;iorder++)
543  tmp_poly+=noise_coef[iw_table*(polynomial_order+1)+iorder]*pow(scaled_lt,iorder);
544 
545  uncertainty->dsensor[ipb]=tmp_poly/SNR_scale[iw_table]/10.;
546 
547  if(sensorID==OCI || sensorID==OCIS)
548  uncertainty->dsensor[ipb]=sqrt(tmp_poly)/SNR_scale[iw_table]/10.;
549 
550  uncertainty->dvc[ipb]=rel_unc_vc[iw_table]*l1rec->Lt[ipb];
551  uncertainty->dLr[ipb]=l1rec->Lr[ipb]*Lr_unc;
552 
553  noise_temp[ipb] =sqrt(uncertainty->dvc[ipb] * uncertainty->dvc[ipb] +uncertainty->dsensor[ipb]*uncertainty->dsensor[ipb]);
554  }
555  }
556 
557  /* error in gas transmittance */
558 
560 
561  return noise_temp;
562 }
563 
564 
int32 l1file(int32 sdfid, int32 *nsamp, int32 *nscans, int16 *dtynum)
Definition: l1stat_chk.c:586
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of it will be treated as a constant LUT The manner in which Earth View data is checked for saturation was changed Previously the raw Earth View DNs and Space View DNs were checked against the lookup table values contained in the table dn_sat The change made is to check the raw Earth and Space View DNs to be sure they are less than the maximum saturation value and to check the Space View subtracted Earth View dns against a set of values contained in the new lookup table dn_sat_ev The metadata configuration and ASSOCIATEDINSTRUMENTSHORTNAME from the MOD02HKM product The same metatdata with extensions and were removed from the MOD021KM and MOD02OBC products ASSOCIATEDSENSORSHORTNAME was set to MODIS in all products These changes are reflected in new File Specification which users may consult for exact the pow functions were eliminated in Emissive_Cal and Emissive bands replaced by more efficient code Other calculations throughout the code were also made more efficient Aside from a few round off there was no difference to the product The CPU time decreased by about for a day case and for a night case A minor bug in calculating the uncertainty index for emissive bands was corrected The frame index(0-based) was previously being used the frame number(1-based) should have been used. There were only a few minor changes to the uncertainty index(maximum of 1 digit). 3. Some inefficient arrays(Sigma_RVS_norm_sq) were eliminated and some code lines in Preprocess_L1A_Data were moved into Process_OBCEng_Emiss. There were no changes to the product. Required RAM was reduced by 20 MB. Now
integer, parameter int16
Definition: cubeio.f90:3
int j
Definition: decode_rs.h:73
int status
Definition: l1_czcs_hdf.c:32
#define OCI
Definition: sensorDefs.h:42
#define OSMI
Definition: sensorDefs.h:16
#define NULL
Definition: decode_rs.h:63
read l1rec
#define VIIRSN
Definition: sensorDefs.h:23
#define MERIS
Definition: sensorDefs.h:22
float mu
float make_noise(float sigma)
void set_error_input(l1str *l1rec, float *sensor_noise)
instr * input
#define DPTB(function)
Definition: passthebuck.h:24
int bindex_get(int32_t wave)
Definition: windex.c:45
void noise_model_ocis(l1str *l1rec, float *noise)
#define OCIS
Definition: sensorDefs.h:43
unsigned long int random_seed()
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
#define MOS
Definition: sensorDefs.h:13
#define STDPR
Definition: l12_parms.h:85
int noise_index_oci(float wave)
derive the index of OCI wavelength in MODIS wavelength domain
#define OCTS
Definition: sensorDefs.h:14
int32_t nbands
#define OCM1
Definition: sensorDefs.h:20
#define fabs(a)
Definition: misc.h:93
#define CZCS
Definition: sensorDefs.h:17
float mu0
float * get_uncertainty(l1str *l1rec)
#define VIIRSJ2
Definition: sensorDefs.h:44
void gas_trans_uncertainty(l1str *l1rec)
Definition: gas_trans.c:742
#define HICO
Definition: sensorDefs.h:25
#define OCRVC
Definition: sensorDefs.h:24
#define SEAWIFS
Definition: sensorDefs.h:12
int i
Definition: decode_rs.h:71
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
int32_t sensorID[MAXNFILES]
Definition: l2bin.cpp:91
#define MODISA
Definition: sensorDefs.h:19
#define VIIRSJ1
Definition: sensorDefs.h:37
int npix
Definition: get_cmp.c:28
#define OCM2
Definition: sensorDefs.h:21
#define ERR(e)
#define GOCI
Definition: sensorDefs.h:26