OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
gas_trans.c
Go to the documentation of this file.
1 /* =========================================================== */
2 /* Module gaseous_transmittance.c */
3 /* */
4 /* Computes sensor-specific transmittance through various */
5 /* atmospheric gases. */
6 /* */
7 /* B. Franz, NASA/OBPG, July 2006 */
8 /* =========================================================== */
9 
10 #include "l12_proto.h"
11 #include <allocate3d.h>
12 #include "atrem_corl1.h"
13 
15 static float ***wvtbl = NULL;
16 static float *t_co2 = NULL;
17 static float *t_o2 = NULL;
18 static float *t_co = NULL;
19 static float *t_ch4 = NULL;
20 static float *t_n2o = NULL;
21 static float *cwv_all = NULL;
22 
23 void load_gas_tables(l1str *l1rec) {
24  /*
25  netcdf file that has water vapor transmittance as a function of wavelength and
26  cwv (6 profiles x number of bands x 220 water vapor value)
27  filename = /OCDATAROOT/sensor[/subsensor]/<sensorName>_gas_trans.nc
28  */
29  char *filedir;
30  char filename[FILENAME_MAX];
31  if ((filedir = getenv("OCDATAROOT")) == NULL) {
32  printf("-E- %s: OCDATAROOT env variable undefined.\n", __FILE__);
33  return;
34  }
35  strcpy(filename, filedir);
36 
37  strcat(filename, "/");
38  strcat(filename, sensorId2SensorDir(l1rec->l1file->sensorID));
39 
40  // SeaWiFS has a subsensorID, but the gas transmittance table isn't GAC/LAC specific
41  if ((l1rec->l1file->sensorID != SEAWIFS) && (l1rec->l1file->subsensorID != -1)) {
42  strcat(filename, "/");
43  strcat(filename, subsensorId2SubsensorDir(l1rec->l1file->subsensorID));
44  }
45 
46  char *sensorName = strdup(sensorId2SensorName(l1rec->l1file->sensorID));
47  lowcase(sensorName);
48  strcat(filename, "/");
49  strcat(filename, sensorName);
50  strcat(filename, "_gas_transmittance.nc");
51  free(sensorName);
52 
53  /* This will be the netCDF ID for the file and data variable. */
54  int32_t ncid, varid;
55  int32_t num_water_vapors_id, num_models_id, num_wavelengths_id;
56 
57  /* Open the file */
58  if ((nc_open(filename, NC_NOWRITE, &ncid)) != NC_NOERR) {
59  printf("-E- %s: Failed to open %s\n", __FILE__, filename);
60  exit(EXIT_FAILURE);
61  }
62 
63  if((nc_inq_dimid(ncid, "n_water_vapor", &num_water_vapors_id)) == NC_NOERR){
64  if((nc_inq_dimlen(ncid, num_water_vapors_id, &num_water_vapors)) != NC_NOERR){
65  printf("-E- %s: Failed to read dimension n_water_vapor\n", __FILE__);
66  exit(EXIT_FAILURE);
67  }
68  } else{
69  printf("-E- %s: Failed to find dimension n_water_vapor\n", __FILE__);
70  exit(EXIT_FAILURE);
71  }
72  if((nc_inq_dimid(ncid, "nmodels", &num_models_id)) == NC_NOERR){
73  if((nc_inq_dimlen(ncid, num_models_id, &num_models)) != NC_NOERR){
74  printf("-E- %s: Failed to read dimension nmodels\n", __FILE__);
75  exit(EXIT_FAILURE);
76  }
77  } else{
78  printf("-E- %s: Failed to find dimension nmodels\n", __FILE__);
79  exit(EXIT_FAILURE);
80  }
81 
82  if((nc_inq_dimid(ncid, "nwavelengths", &num_wavelengths_id)) == NC_NOERR){
83  if((nc_inq_dimlen(ncid, num_wavelengths_id, &num_wavelengths)) != NC_NOERR){
84  printf("-E- %s: Failed to read dimension nwavelengths\n", __FILE__);
85  exit(EXIT_FAILURE);
86  }
87  } else {
88  printf("-E- %s: Failed to find dimension nwavelengths\n", __FILE__);
89  exit(EXIT_FAILURE);
90  }
91 
92  /* Read the water vapor transmittance */
94  if(!wvtbl) {
95  printf("Error: allocating memory for water vapor transmittance tables\n");
96  exit(EXIT_FAILURE);
97  }
98 
99  if ((nc_inq_varid(ncid, "water_vapor_transmittance", &varid)) == NC_NOERR) {
100  if ((nc_get_var_float(ncid, varid, &wvtbl[0][0][0])) != NC_NOERR){
101  printf("-E- %s: failed to read water_vapor_transmittace from %s\n",
102  __FILE__, filename);
103  exit(EXIT_FAILURE);
104  }
105  } else {
106  printf("-E- %s: '%s' does not have water_vapor_transmittace.\n",
107  __FILE__, filename);
108  exit(EXIT_FAILURE);
109  }
110 
111  /* Read the water vapor table */
112  if ((cwv_all = (float *) calloc(num_water_vapors, sizeof(float))) == NULL) {
113  printf("Error: allocating memory for water vapor table\n");
114  exit(EXIT_FAILURE);
115  }
116  if ((nc_inq_varid(ncid, "water_vapor", &varid)) == NC_NOERR) {
117  if ((nc_get_var_float(ncid, varid, &cwv_all[0])) != NC_NOERR){
118  printf("-E- %s: failed to read water_vapor from %s\n",
119  __FILE__, filename);
120  exit(EXIT_FAILURE);
121  }
122  } else {
123  printf("-E- %s: '%s' does not have water_vapor\n",
124  __FILE__, filename);
125  exit(EXIT_FAILURE);
126  }
127 
128  /* Read the carbon monoxide transmittance */
129  if ((t_co = (float *) calloc(num_wavelengths, sizeof(float))) == NULL) {
130  printf("-E- %s line %d : error allocating memory for carbon monoxide transmitance table.\n",
131  __FILE__, __LINE__);
132  exit(1);
133  }
134  if ((nc_inq_varid(ncid, "carbon_monoxide_transmittance", &varid)) == NC_NOERR) {
135  if ((nc_get_var_float(ncid, varid, &t_co[0])) != NC_NOERR){
136  printf("-E- %s: failed to read carbon_monoxide_transmittance from %s\n",
137  __FILE__, filename);
138  exit(EXIT_FAILURE);
139  }
140  } else {
141  printf("-E- %s: '%s' does not have carbon_monoxide_transmittance\n",
142  __FILE__, filename);
143  exit(EXIT_FAILURE);
144  }
145 
146  /* Read the carbon dioxide transmittance */
147  if ((t_co2 = (float *) calloc(num_wavelengths, sizeof(float))) == NULL) {
148  printf("-E- %s line %d : error allocating memory for carbon dioxide transmitance table.\n",
149  __FILE__, __LINE__);
150  exit(1);
151  }
152  if ((nc_inq_varid(ncid, "carbon_dioxide_transmittance", &varid)) == NC_NOERR) {
153  if ((nc_get_var_float(ncid, varid, &t_co2[0])) != NC_NOERR){
154  printf("-E- %s: failed to read carbon_dioxide_transmittance from %s\n",
155  __FILE__, filename);
156  exit(EXIT_FAILURE);
157  }
158  } else {
159  printf("-E- %s: '%s' does not have carbon_dioxide_transmittance\n",
160  __FILE__, filename);
161  exit(EXIT_FAILURE);
162  }
163 
164  /* Read the oxygen transmittance */
165  if ((t_o2 = (float *) calloc(num_wavelengths, sizeof(float))) == NULL) {
166  printf("-E- %s line %d : error allocating memory for oxygen transmitance table.\n",
167  __FILE__, __LINE__);
168  exit(1);
169  }
170  if ((nc_inq_varid(ncid, "oxygen_transmittance", &varid)) == NC_NOERR) {
171  if ((nc_get_var_float(ncid, varid, &t_o2[0])) != NC_NOERR){
172  printf("-E- %s: failed to read oxygen_transmittance from %s\n",
173  __FILE__, filename);
174  exit(EXIT_FAILURE);
175  }
176  } else {
177  printf("-E- %s: '%s' does not have oxygen_transmittance\n",
178  __FILE__, filename);
179  exit(EXIT_FAILURE);
180  }
181 
182  /* Read the nitrous oxide transmittance */
183  if ((t_n2o = (float *) calloc(num_wavelengths, sizeof(float))) == NULL) {
184  printf("-E- %s line %d : error allocating memory for nitrous oxide transmitance table.\n",
185  __FILE__, __LINE__);
186  exit(1);
187  }
188  if ((nc_inq_varid(ncid, "nitrous_oxide_transmittance", &varid)) == NC_NOERR) {
189  if ((nc_get_var_float(ncid, varid, &t_n2o[0])) != NC_NOERR){
190  printf("-E- %s: failed to read nitrous_oxide_transmittance from %s\n",
191  __FILE__, filename);
192  exit(EXIT_FAILURE);
193  }
194  } else {
195  printf("-E- %s: '%s' does not have nitrous_oxide_transmittance\n",
196  __FILE__, filename);
197  exit(EXIT_FAILURE);
198  }
199 
200  /* Read the methane transmittance */
201  if ((t_ch4 = (float *) calloc(num_wavelengths, sizeof(float))) == NULL) {
202  printf("-E- %s line %d : error allocating memory for methane transmitance table.\n",
203  __FILE__, __LINE__);
204  exit(1);
205  }
206  if ((nc_inq_varid(ncid, "methane_transmittance", &varid)) == NC_NOERR) {
207  if ((nc_get_var_float(ncid, varid, &t_ch4[0])) != NC_NOERR){
208  printf("-E- %s: failed to read methane_transmittance from %s\n",
209  __FILE__, filename);
210  exit(EXIT_FAILURE);
211  }
212  } else {
213  printf("-E- %s: '%s' does not have methane_transmittance\n",
214  __FILE__, filename);
215  exit(EXIT_FAILURE);
216  }
217 
218  /* Close the file */
219  if ((nc_close(ncid)) != NC_NOERR){
220  printf("-E- %s: failed to close %s\n",
221  __FILE__, filename);
222  exit(EXIT_FAILURE);
223  }
224 }
225 
226 int32_t get_wvindex(float *wvtable,int32_t nwv, double wv)
227 {
228  int32_t index;
229  int32_t i;
230 
231  if(wv>wvtable[nwv-1])
232  i=nwv-1;
233  else
234  {
235  for(i=0;i<nwv;i++)
236  if(wv<wvtable[i])
237  break;
238  }
239 
240  index=i;
241  if( (wv-wvtable[i-1]) < (wvtable[i]-wv) )
242  index=i-1;
243 
244  return index;
245 }
246 
247 
248 void ozone_transmittance(l1str *l1rec, int32_t ip) {
249  float tau_oz;
250  int32_t iw;
251 
252  filehandle *l1file = l1rec->l1file;
253  int32_t nwave = l1file->nbands;
254  int32_t ipb = ip*nwave;
255 
256  for (iw = 0; iw < nwave; iw++) {
257  tau_oz = l1rec->oz[ip] * l1file->k_oz[iw];
258  l1rec->tg_sol[ipb + iw] *= exp(-(tau_oz / l1rec->csolz[ip]));
259  l1rec->tg_sen[ipb + iw] *= exp(-(tau_oz / l1rec->csenz[ip]));
260  }
261 }
262 
263 void co2_transmittance(l1str *l1rec, int32_t ip) {
264  int32_t iw;
265 
266  filehandle *l1file = l1rec->l1file;
267  int32_t nwave = l1file->nbands;
268  int32_t ipb = ip*nwave;
269 
270  if ((input->gas_opt & GAS_TRANS_TBL_BIT) == 0) {
271  if (t_co2 == NULL) {
272  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "t_co2", (void **) &t_co2);
273  }
274  }
275 
276  for (iw = 0; iw < nwave; iw++) {
277  l1rec->tg_sol[ipb + iw] *= pow(t_co2[iw], 1.0 / l1rec->csolz[ip]);
278  l1rec->tg_sen[ipb + iw] *= pow(t_co2[iw], 1.0 / l1rec->csenz[ip]);
279  }
280 
281 }
282 
283 void co_transmittance(l1str *l1rec, int32_t ip) {
284  int32_t iw;
285 
286  filehandle *l1file = l1rec->l1file;
287  int32_t nwave = l1file->nbands;
288  int32_t ipb = ip*nwave;
289 
290  /* Only compute if gas transmittance table was requested */
291  if ((input->gas_opt & GAS_TRANS_TBL_BIT) != 0) {
292  for (iw = 0; iw < nwave; iw++) {
293  l1rec->tg_sol[ipb + iw] *= pow(t_co[iw], 1.0 / l1rec->csolz[ip]);
294  l1rec->tg_sen[ipb + iw] *= pow(t_co[iw], 1.0 / l1rec->csenz[ip]);
295  }
296  } else {
297  printf("-E- carbon monoxide transmittance can only be computed if gas_opt includes bit %d\n", GAS_TRANS_TBL_BIT);
298  exit(EXIT_FAILURE);
299 
300  }
301 }
302 
303 void ch4_transmittance(l1str *l1rec, int32_t ip) {
304  int32_t iw;
305 
306  filehandle *l1file = l1rec->l1file;
307  int32_t nwave = l1file->nbands;
308  int32_t ipb = ip*nwave;
309 
310  /* Only compute if gas transmittance table was requested */
311  if ((input->gas_opt & GAS_TRANS_TBL_BIT) != 0) {
312  for (iw = 0; iw < nwave; iw++) {
313  l1rec->tg_sol[ipb + iw] *= pow(t_ch4[iw], 1.0 / l1rec->csolz[ip]);
314  l1rec->tg_sen[ipb + iw] *= pow(t_ch4[iw], 1.0 / l1rec->csenz[ip]);
315  }
316  } else {
317  printf("-E- methane transmittance can only be computed if gas_opt includes bit %d\n", GAS_TRANS_TBL_BIT);
318  exit(EXIT_FAILURE);
319  }
320 }
321 
322 void o2_transmittance(l1str *l1rec, int32_t ip) {
323  int32_t iw;
324 
325  filehandle *l1file = l1rec->l1file;
326  int32_t nwave = l1file->nbands;
327  int32_t ipb = ip*nwave;
328 
329  /* Only compute if gas transmittance table was requested */
330  if ((input->gas_opt & GAS_TRANS_TBL_BIT) != 0) {
331  for (iw = 0; iw < nwave; iw++) {
332  l1rec->tg_sol[ipb + iw] *= pow(t_o2[iw], 1.0 / l1rec->csolz[ip]);
333  l1rec->tg_sen[ipb + iw] *= pow(t_o2[iw], 1.0 / l1rec->csenz[ip]);
334  }
335  }
336 }
337 
338 void n2o_transmittance(l1str *l1rec, int32_t ip) {
339  int32_t iw;
340 
341  filehandle *l1file = l1rec->l1file;
342  int32_t nwave = l1file->nbands;
343  int32_t ipb = ip*nwave;
344 
345  /* Only compute if gas transmittance table was requested */
346  if ((input->gas_opt & GAS_TRANS_TBL_BIT) != 0) {
347  for (iw = 0; iw < nwave; iw++) {
348  l1rec->tg_sol[ipb + iw] *= pow(t_n2o[iw], 1.0 / l1rec->csolz[ip]);
349  l1rec->tg_sen[ipb + iw] *= pow(t_n2o[iw], 1.0 / l1rec->csenz[ip]);
350  }
351  } else {
352  printf("-E- nitrous oxide transmittance can only be computed if gas_opt includes bit %d\n", GAS_TRANS_TBL_BIT);
353  exit(EXIT_FAILURE);
354  }
355 }
356 
357 void no2_transmittance(l1str *l1rec, int32_t ip) {
358 
359  float a_285, a_225;
360  float tau_to200;
361  float no2_tr200;
362  int32_t iw;
363 
364  filehandle *l1file = l1rec->l1file;
365  int32_t nwave = l1file->nbands;
366  int32_t ipb = ip*nwave;
367 
368  float sec0 = 1.0 / l1rec->csolz[ip];
369  float sec = 1.0 / l1rec->csenz[ip];
370 
371  if (l1rec->no2_tropo[ip] > 0.0)
372  /* compute tropo no2 above 200m (Z.Ahmad)
373  no2_tr200 = exp(12.6615 + 0.61676*log(no2_tropo));
374  new, location-dependent method */
375  no2_tr200 = l1rec->no2_frac[ip] * l1rec->no2_tropo[ip];
376  else
377  no2_tr200 = 0.0;
378 
379 
380  for (iw = 0; iw < nwave; iw++) {
381 
382  if (l1file->k_no2[iw] > 0.0) {
383 
384  a_285 = l1file->k_no2[iw] * (1.0 - 0.003 * (285.0 - 294.0));
385  a_225 = l1file->k_no2[iw] * (1.0 - 0.003 * (225.0 - 294.0));
386 
387  tau_to200 = a_285 * no2_tr200 + a_225 * l1rec->no2_strat[ip];
388 
389  l1rec->tg_sol[ipb + iw] *= exp(-(tau_to200 * sec0));
390  l1rec->tg_sen[ipb + iw] *= exp(-(tau_to200 * sec));
391 
392  }
393  }
394 }
395 
396 void h2o_transmittance(l1str *l1rec, int32_t ip) {
397  static float *a_h2o = NULL;
398  static float *b_h2o = NULL;
399  static float *c_h2o = NULL;
400  static float *d_h2o = NULL;
401  static float *e_h2o = NULL;
402  static float *f_h2o = NULL;
403  static float *g_h2o = NULL;
404  int32_t model = 5;
405 
406  float t_h2o;
407  int32_t iw;
408 
409  filehandle *l1file = l1rec->l1file;
410  int32_t nwave = l1file->nbands;
411  int32_t ipb = ip*nwave;
412  float wv = l1rec->wv[ip];
413 
414  // Apply water vapor transmittance only for the MSE and multi-band AC from the netcdf
415  // if (input->aer_opt == AERRHMSEPS || input->aer_opt == AERRHMSEPS_lin || input->aer_opt == AERRHSM) {
416  if ((input->gas_opt & GAS_TRANS_TBL_BIT) != 0) {
417  int32_t ja_sol = 0;
418  int32_t ja_sen = 0;
419 
420  ja_sol = get_wvindex(cwv_all,num_water_vapors,wv / l1rec->csolz[ip]);
421  ja_sen = get_wvindex(cwv_all,num_water_vapors,wv / l1rec->csenz[ip]);
422 
423  for (iw = 0; iw < nwave; iw++) {
424  l1rec->tg_sol[ipb + iw] *= wvtbl[model][iw][ja_sol];
425  l1rec->tg_sen[ipb + iw] *= wvtbl[model][iw][ja_sen];
426 
427  }
428  } // otherwise apply Zia's tabel from Bo-cai
429  else {
430  if (a_h2o == NULL) {
431  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "a_h2o", (void **) &a_h2o);
432  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "b_h2o", (void **) &b_h2o);
433  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "c_h2o", (void **) &c_h2o);
434  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "d_h2o", (void **) &d_h2o);
435  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "e_h2o", (void **) &e_h2o);
436  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "f_h2o", (void **) &f_h2o);
437  rdsensorinfo(l1file->sensorID, l1_input->evalmask, "g_h2o", (void **) &g_h2o);
438  }
439 
440  for (iw = 0; iw < nwave; iw++) {
441  t_h2o = a_h2o[iw] + wv * (b_h2o[iw] + wv * (c_h2o[iw] + wv * (d_h2o[iw]
442  + wv * (e_h2o[iw] + wv * (f_h2o[iw] + wv * g_h2o[iw])))));
443  l1rec->tg_sol[ipb + iw] *= pow(t_h2o, 1.0 / l1rec->csolz[ip]);
444  l1rec->tg_sen[ipb + iw] *= pow(t_h2o, 1.0 / l1rec->csenz[ip]);
445  }
446  }
447  return;
448 }
449 
450 void gaseous_transmittance(l1str *l1rec, int32_t ip) {
451  static int32_t firstRun = TRUE;
452 
453  if ((input->gas_opt & ATREM_BIT) != 0) {
454  if (input->oxaband_opt == 1 && ((input->atrem_opt & ATREM_O2) != 0)){
455  printf("ATREM O2 correction is incompatible with the Ding and Gordon approach\n");
456  printf("Either unset the atrem_opt bit %d or set oxaband_opt=0\n",ATREM_O2);
457  exit(EXIT_FAILURE);
458  }
459  static float *rhot, *tg_tot;
460  float airmass, A;
461  int ib, ipb;
462  int nwave = l1rec->l1file->nbands;
463  if (firstRun) {
464  if ((rhot = (float *) calloc(nwave, sizeof (float))) == NULL) {
465  printf("-E- : Error allocating memory to rhot\n");
466  exit(EXIT_FAILURE);
467  }
468  if ((tg_tot = (float *) calloc(nwave, sizeof (float))) == NULL) {
469  printf("-E- : Error allocating memory to tg_tot\n");
470  exit(EXIT_FAILURE);
471  }
472  firstRun = FALSE;
473  }
474  /* Copy surface reflectance to temp. var for atrem calculation */
475  for (ib = 0; ib < nwave; ib++) {
476  ipb = ip * nwave + ib;
477  rhot [ib] = M_PI * l1rec->Lt[ipb] / l1rec->Fo[ib] / l1rec->csolz[ip];
478  }
479 
480  get_atrem_cor(l1rec, ip, rhot, tg_tot, &l1rec->tg_sol[ip * nwave], &l1rec->tg_sen[ip * nwave]);
481  if (input->atrem_splitpaths == 0) {
482  airmass = 1.0 / l1rec->csolz[ip] + 1.0 / l1rec->csenz[ip];
483 
484  for (ib = 0; ib < nwave; ib++) {
485  ipb = ip * nwave + ib;
486  // ATREM didn't do the path splitting, do it here
487  A = -log(tg_tot[ib]) / airmass; //effective optical depth
488  l1rec->tg_sol[ipb] = exp(-A / l1rec->csolz[ip]);
489  l1rec->tg_sen[ipb] = exp(-A / l1rec->csenz[ip]);
490  }
491  }
492  } else {
493  if ((input->gas_opt & GAS_TRANS_TBL_BIT) != 0) {
494  if (firstRun) {
496  firstRun = FALSE;
497  }
498  /*
499  o2 transmittance is special
500  If the oxaband_opt is set to use the gas_transmittance tables, oblige
501  */
502 
503  if (input->oxaband_opt == 2) {
504  o2_transmittance(l1rec, ip);
505  }
506  }
507 
508  if ((input->gas_opt & O3_BIT) != 0) {
510  }
511 
512  if ((input->gas_opt & CO2_BIT) != 0) {
514  }
515 
516  if ((input->gas_opt & NO2_BIT) != 0) {
518  }
519 
520  if ((input->gas_opt & H2O_BIT) != 0) {
522  }
523 
524  if ((input->gas_opt & CO_BIT) != 0) {
525  co_transmittance(l1rec, ip);
526  }
527  if ((input->gas_opt & CH4_BIT) != 0) {
529  }
530  if ((input->gas_opt & N2O_BIT) != 0) {
532  }
533  }
534 }
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
const char * sensorId2SensorDir(int sensorId)
Definition: sensorInfo.c:240
Utility functions for allocating and freeing three-dimensional arrays of various types.
#define H2O_BIT
Definition: l12_parms.h:60
char * lowcase(char *instr)
Definition: lowcase.c:10
size_t num_wavelengths
Definition: gas_trans.c:14
#define N2O_BIT
Definition: l12_parms.h:65
int32_t get_wvindex(float *wvtable, int32_t nwv, double wv)
Definition: gas_trans.c:226
#define FALSE
Definition: rice.h:164
#define NULL
Definition: decode_rs.h:63
read l1rec
#define CO2_BIT
Definition: l12_parms.h:58
#define TRUE
Definition: rice.h:165
#define O3_BIT
Definition: l12_parms.h:57
instr * input
void load_gas_tables(l1str *l1rec)
Definition: gas_trans.c:23
int get_atrem_cor(l1str *l1rec, int32_t ip, float *rhot, float *tg_tot, float *tg_sol, float *tg_sen)
void no2_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:357
#define ATREM_BIT
Definition: l12_parms.h:61
void h2o_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:396
void gaseous_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:450
#define CH4_BIT
Definition: l12_parms.h:64
char * strdup(const char *)
void ch4_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:303
#define CO_BIT
Definition: l12_parms.h:63
l1_input_t * l1_input
Definition: l1_options.c:9
#define NO2_BIT
Definition: l12_parms.h:59
void o2_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:322
float *** allocate3d_float(size_t nz, size_t ny, size_t nx)
Allocate a three-dimensional array of type float of a given size.
Definition: allocate3d.c:77
#define M_PI
Definition: pml_iop.h:15
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
void co_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:283
void co2_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:263
#define ATREM_O2
Definition: atrem_corl1.h:27
size_t num_models
Definition: gas_trans.c:14
const char * sensorId2SensorName(int sensorId)
Definition: sensorInfo.c:198
size_t num_water_vapors
Definition: gas_trans.c:14
#define GAS_TRANS_TBL_BIT
Definition: l12_parms.h:62
void ozone_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:248
int32_t rdsensorinfo(int32_t, int32_t, const char *, void **)
Definition: rdsensorinfo.c:69
int32_t model
Definition: atrem_corl1.h:132
const char * subsensorId2SubsensorDir(int subsensorId)
Definition: sensorInfo.c:254
#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")
void n2o_transmittance(l1str *l1rec, int32_t ip)
Definition: gas_trans.c:338