OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
msl12_input.c
Go to the documentation of this file.
1 #include "l12_proto.h"
2 #include <l1.h>
3 #include <string.h>
4 #include <clo.h>
5 #include <sensorInfo.h>
6 
7 #include <assert.h>
8 #include <strings.h>
9 #include "version.h"
10 #include <sys/types.h>
11 #include <dirent.h>
12 
13 
14 static int32_t numTauas = -1;
15 static int32_t numGainUncs = -1;
16 static int32_t numNoiseScales = -1;
17 static int32_t numBiasFracs = -1;
18 instr *input;
19 
20 int defnaermodels = 80;
21 char defaermodels[][32] = {"r30f95v01", "r30f80v01", "r30f50v01", "r30f30v01", "r30f20v01", "r30f10v01", "r30f05v01", "r30f02v01", "r30f01v01", "r30f00v01",
22  "r50f95v01", "r50f80v01", "r50f50v01", "r50f30v01", "r50f20v01", "r50f10v01", "r50f05v01", "r50f02v01", "r50f01v01", "r50f00v01",
23  "r70f95v01", "r70f80v01", "r70f50v01", "r70f30v01", "r70f20v01", "r70f10v01", "r70f05v01", "r70f02v01", "r70f01v01", "r70f00v01",
24  "r75f95v01", "r75f80v01", "r75f50v01", "r75f30v01", "r75f20v01", "r75f10v01", "r75f05v01", "r75f02v01", "r75f01v01", "r75f00v01",
25  "r80f95v01", "r80f80v01", "r80f50v01", "r80f30v01", "r80f20v01", "r80f10v01", "r80f05v01", "r80f02v01", "r80f01v01", "r80f00v01",
26  "r85f95v01", "r85f80v01", "r85f50v01", "r85f30v01", "r85f20v01", "r85f10v01", "r85f05v01", "r85f02v01", "r85f01v01", "r85f00v01",
27  "r90f95v01", "r90f80v01", "r90f50v01", "r90f30v01", "r90f20v01", "r90f10v01", "r90f05v01", "r90f02v01", "r90f01v01", "r90f00v01",
28  "r95f95v01", "r95f80v01", "r95f50v01", "r95f30v01", "r95f20v01", "r95f10v01", "r95f05v01", "r95f02v01", "r95f01v01", "r95f00v01"};
29 
30 // need a place to store the default product lists
31 static char default_l2prod[MAX_OFILES][L1_PRODSTRLEN];
32 
33 static char default_flaguse[1024];
34 
35 // store the name of program we are running.
36 static char mainProgramName[50];
37 
38 static char *l2gen_optionKeys[] = {
39  "-help",
40  "-version",
41  "-dump_options",
42  "-dump_options_paramfile",
43  "-dump_options_xmlfile",
44  "par",
45  "pversion",
46  "suite",
47  "eval",
48  "ifile",
49  "ilist",
50  "geofile",
51  "ofile",
52  "oformat",
53  "il2file",
54  "tgtfile",
55  "aerfile",
56  "metafile",
57  "l2prod",
58  "ctl_pt_incr",
59  "proc_ocean",
60  "proc_land",
61  "proc_sst",
62  "proc_cloud",
63  "atmocor",
64  "mode",
65  "aer_opt",
66  "aer_wave_short",
67  "aer_wave_long",
68  "aer_swir_short",
69  "aer_swir_long",
70  "aer_rrs_short",
71  "aer_rrs_long",
72  "aermodmin",
73  "aermodmax",
74  "aermodrat",
75  "aer_angstrom",
76  "aer_iter_max",
77  "mumm_alpha",
78  "mumm_gamma",
79  "mumm_epsilon",
80  "absaer_opt",
81  "glint_opt",
82  "oxaband_opt",
83  "cirrus_opt",
84  "filter_opt",
85  "filter_file",
86  "brdf_opt",
87  "fqfile",
88  "parfile",
89  "gas_opt",
90  "atrem_opt",
91  "atrem_full",
92  "atrem_geom",
93  "atrem_model",
94  "atrem_splitpaths",
95  "iop_opt",
96  "cphyt_opt",
97  "seawater_opt",
98  "polfile",
99  "pol_opt",
100  "band_shift_opt",
101  "add_ws_noise",
102  "add_wd_noise",
103  "add_mw_noise",
104  "add_zw_noise",
105  "add_rh_noise",
106  "add_pr_noise",
107  "add_wv_noise",
108  "add_oz_noise",
109  "add_lt_noise",
110  "add_no2_tropo_noise",
111  "add_no2_strat_noise",
112  "lt_noise_scale",
113  "bias_frac",
114  "giop_aph_opt",
115  "giop_aph_file",
116  "giop_aph_s",
117  "giop_adg_opt",
118  "giop_adg_file",
119  "giop_adg_s",
120  "giop_bbp_opt",
121  "giop_bbp_file",
122  "giop_bbp_s",
123  "giop_acdom_opt",
124  "giop_acdom_file",
125  "giop_anap_opt",
126  "giop_anap_file",
127  "giop_bbph_opt",
128  "giop_bbph_file",
129  "giop_bbnap_opt",
130  "giop_bbnap_file",
131  "giop_rrs_opt",
132  "giop_rrs_diff",
133  "giop_grd",
134  "giop_wave",
135  "giop_maxiter",
136  "giop_fit_opt",
137  "gsm_opt",
138  "gsm_fit",
139  "gsm_adg_s",
140  "gsm_bbp_s",
141  "gsm_aphw",
142  "gsm_aphs",
143  "qaa_adg_s",
144  "qaa_wave",
145  "chloc2_wave",
146  "chloc2_coef",
147  "chloc3_wave",
148  "chloc3_coef",
149  "chloc4_wave",
150  "chloc4_coef",
151  "kd2_wave",
152  "kd2_coef",
153  "flh_offset",
154  "vcnnfile",
155  "picfile",
156  "owtfile",
157  "owtchlerrfile",
158  "aermodfile",
159  "aermodels",
160  "met1",
161  "met2",
162  "met3",
163  "ozone1",
164  "ozone2",
165  "ozone3",
166  "anc_profile1",
167  "anc_profile2",
168  "anc_profile3",
169  "anc_aerosol1",
170  "anc_aerosol2",
171  "anc_aerosol3",
172  "sfc_albedo",
173  "anc_cor_file",
174  "pixel_anc_file",
175  "land",
176  "water",
177  "demfile",
178  "dem_auxfile",
179  "mldfile",
180  "icefile",
181  "ice_threshold",
182  "sstcoeffile",
183  "dsdicoeffile",
184  "sstssesfile",
185  "sst4coeffile",
186  "sst4ssesfile",
187  "sst3coeffile",
188  "sst3ssesfile",
189  "sstfile",
190  "sstreftype",
191  "sstrefdif",
192  "viirsnv7",
193  "viirsnosisaf",
194  "no2file",
195  "alphafile",
196  "tauafile",
197  "flaguse",
198  "xcalbox",
199  "xcalboxcenter",
200  "xcalpervalid",
201  "xcalsubsmpl",
202  "chlthreshold",
203  "aotthreshold",
204  "coccolith",
205  "cirrus_thresh",
206  "taua",
207  "absaer",
208  "rhoamin",
209  "epsmin",
210  "epsmax",
211  "tauamax",
212  "nLwmin",
213  "wsmax",
214  "windspeed",
215  "windangle",
216  "pressure",
217  "ozone",
218  "relhumid",
219  "watervapor",
220  "vcal_opt",
221  "vcal_chl",
222  "vcal_solz",
223  "vcal_nLw",
224  "vcal_Lw",
225  "vcal_depth",
226  "vcal_min_nbin",
227  "vcal_min_nscene",
228  "owmcfile",
229  "north",
230  "south",
231  "east",
232  "west",
233  "xbox",
234  "ybox",
235  "subsamp",
236  "prodxmlfile",
237  "breflectfile",
238  "bpar_validate_opt",
239  "bpar_elev_opt",
240  "bpar_elev_value",
241  "deflate",
242  "raman_opt",
243  "gmpfile",
244  "water_spectra_file",
245  "shallow_water_depth",
246  "avw_coef",
247  "cloud_hgt_file",
248 
249  // lib L1 options
250  "calfile",
251  "rad_opt",
252  "viirscalparfile",
253  "geom_per_band",
254  "xcalfile",
255  "xcal_opt",
256  "xcal_wave",
257  "resolution",
258  "newavhrrcal",
259  "ch22detcor",
260  "ch23detcor",
261  "sl_pixl",
262  "sl_frac",
263  "outband_opt",
264  "maskland",
265  "maskbath",
266  "maskcloud",
267  "maskglint",
268  "masksunzen",
269  "masksatzen",
270  "maskhilt",
271  "maskstlight",
272  "sunzen",
273  "satzen",
274  "hipol",
275  "glint_thresh",
276  "cloud_thresh",
277  "cloud_wave",
278  "cloud_eps",
279  "cloud_mask_file",
280  "offset",
281  "gain",
282  "spixl",
283  "epixl",
284  "dpixl",
285  "sline",
286  "eline",
287  "dline",
288 
289 
290 
291  NULL
292 };
293 
294 static char *l1bgen_optionKeys[] = {
295  "-help",
296  "-version",
297  "-dump_options",
298  "-dump_options_paramfile",
299  "-dump_options_xmlfile",
300  "par",
301  "pversion",
302  "suite",
303  "ifile",
304  "ofile",
305  "oformat",
306  "fqfile",
307  "parfile",
308 
309  // lib L1 options
310  "calfile",
311  "xcalfile",
312  "sl_pixl",
313  "sl_frac",
314  "gain",
315  "offset",
316  "spixl",
317  "epixl",
318  "sline",
319  "eline",
320 
321  NULL
322 };
323 
324 static char *l1mapgen_optionKeys[] = {
325  "-help",
326  "-version",
327  "-dump_options",
328  "-dump_options_paramfile",
329  "-dump_options_xmlfile",
330  "par",
331  "pversion",
332  "suite",
333  "ifile",
334  "geofile",
335  "ofile",
336  "oformat",
337  "north",
338  "south",
339  "east",
340  "west",
341  "width",
342  "threshold",
343  "rgb",
344  "atmocor",
345  "datamin",
346  "datamax",
347  "stype",
348  "help_true_color",
349  "cirrus_opt",
350  "atrem_opt",
351  "atrem_full",
352  "atrem_geom",
353  "atrem_model",
354  "atrem_splitpaths",
355 
356  // lib L1 options
357  "resolution",
358 
359  NULL
360 };
361 
362 static char *l1brsgen_optionKeys[] = {
363  "-help",
364  "-version",
365  "-dump_options",
366  "-dump_options_paramfile",
367  "-dump_options_xmlfile",
368  "par",
369  "pversion",
370  "suite",
371  "ifile",
372  "geofile",
373  "ofile",
374  "oformat",
375  "oformat_depth",
376  "subsamp",
377  "rgb",
378  "atmocor",
379  "datamin",
380  "datamax",
381  "stype",
382  "help_true_color",
383  "cirrus_opt",
384  "atrem_opt",
385  "atrem_full",
386  "atrem_geom",
387  "atrem_model",
388  "atrem_splitpaths",
389 
390  // lib L1 options
391  "resolution",
392  "spixl",
393  "epixl",
394  "sline",
395  "eline",
396 
397  NULL
398 };
399 
400 static char *l1det2det_optionKeys[] = {
401  "-help",
402  "-version",
403  "-dump_options",
404  "-dump_options_paramfile",
405  "-dump_options_xmlfile",
406  "par",
407  "pversion",
408  "suite",
409  "ifile",
410  "help_ifile",
411  "ofile",
412  "oformat",
413  "geofile",
414  "l2prod",
415  "ybox",
416  "chlthreshold",
417  "aotthreshold",
418  "cloud_thresh",
419  "flaguse",
420 
421  // lib L1 options
422  "glint_thresh",
423  "spixl",
424  "epixl",
425  "sline",
426  "eline",
427 
428  NULL
429 };
430 
431 static char *vcalmerge_optionKeys[] = {
432  "-help",
433  "-version",
434  "-dump_options",
435  "-dump_options_paramfile",
436  "-dump_options_xmlfile",
437  "par",
438  "pversion",
439  "ifile",
440  "help_ifile",
441  "ofile",
442  "oformat",
443  "spixl",
444  "epixl",
445  "sline",
446  "eline",
447  "flaguse",
448  "deflate",
449  NULL
450 };
451 
452 void msl12_input_nbands_init(instr *input, int32_t nbands) {
453  /* allocate and initialize dynamic arrays in input struc */
454 
455  input->gsm_aphs = calloc_nbandsf(nbands, input->gsm_aphs, -1.0);
456  input->gsm_aphw = calloc_nbandsf(nbands, input->gsm_aphw, -1.0);
457  input->giop_wave = calloc_nbandsf(nbands, input->giop_wave, -1.0);
458  input->giop_rrs_unc = calloc_nbandsf(nbands, input->giop_rrs_unc, -1.0);
459  input->gain_unc = calloc_nbandsf(nbands, input->gain_unc, 0.0);
460  input->taua = calloc_nbandsf(nbands, input->taua, 0.0);
461  input->vcal_nLw = calloc_nbandsf(nbands, input->vcal_nLw, 0.0);
462  input->vcal_Lw = calloc_nbandsf(nbands, input->vcal_Lw, 0.0);
463  input->lt_noise_scale = calloc_nbandsf(nbands, input->lt_noise_scale, 1.0);
464  input->bias_frac = calloc_nbandsf(nbands, input->bias_frac, 0.0);
465 
466 }
467 
468 /*-----------------------------------------------------------------------------
469  Function: msl12_input_init
470 
471  Returns: int (status)
472  The return code is a negative value if any error occurs, otherwise,
473  returns 0.
474 
475  Description:
476  Set default values for input structure.
477 
478  Parameters: (in calling order)
479  Type Name I/O Description
480  ---- ---- --- -----------
481  instr input O structure variable for inputs
482 
483 ----------------------------------------------------------------------------*/
484 
486  int i;
487 
488  l1_input_init();
489 
490  /* Start fresh */
491  input = allocateMemory(sizeof (instr), "input structure");
492 
493  /* */
494  /* Set input values to defaults */
495  /* */
496  input->mode = FORWARD;
497 
498  input->ctl_pt_incr = 8;
499 
500  input->proc_ocean = 1;
501  input->proc_sst = -1;
502  input->proc_land = 0;
503  input->proc_cloud = 0;
504  input->atmocor = 1;
505 
506  input->glint_opt = 1;
507  input->aer_iter_max = 10;
508  input->brdf_opt = -1;
509  input->gas_opt = 1;
510  input->atrem_opt = 0;
511  input->atrem_full = 0;
512  input->atrem_geom = 0;
513  input->atrem_model = 0;
514  input->atrem_splitpaths = 0;
515  input->iop_opt = IOPNONE;
516  input->cphyt_opt=1;
517  input->pol_opt = -1;
518  input->absaer_opt = 0;
519  input->cirrus_opt = 0;
520  input->gsm_opt = 0;
521  input->gsm_fit = 0;
522  input->gsm_adg_s = 0.02061;
523  input->gsm_bbp_s = 1.03373;
524 
525  input->giop_maxiter = -1;
526  input->giop_fit_opt = -1;
527  input->giop_aph_opt = -1;
528  input->giop_adg_opt = -1;
529  input->giop_bbp_opt = -1;
530  input->giop_acdom_opt = -1;
531  input->giop_anap_opt = -1;
532  input->giop_bbph_opt = -1;
533  input->giop_bbnap_opt = -1;
534  input->giop_rrs_opt = -1;
535  input->giop_rrs_diff = -1.0;
536  input->giop_iterate = 0;
537  input->giop_aph_s = -1000.0;
538  input->giop_adg_s = -1000.0;
539  input->giop_bbp_s = -1000.0;
540  input->giop_aph_w = -1.0;
541  input->giop_adg_w = -1.0;
542  input->giop_bbp_w = -1.0;
543  input->giop_grd[0] = -1000.0;
544  input->giop_grd[1] = -1000.0;
545 
546  input->qaa_adg_s = 0.015;
547 
548  input->flh_offset = 0.0;
549 
550  input->seawater_opt = 0;
551  input->aer_opt = 99;
552  input->oxaband_opt = 99;
553  input->filter_opt = 99;
554 
555  input->aer_wave_short = 765;
556  input->aer_wave_long = 865;
557  input->aer_swir_short = -1;
558  input->aer_swir_long = -1;
559  input->aer_rrs_short = -1.0;
560  input->aer_rrs_long = -1.0;
561  input->aer_angstrom = -999.0;
562 
563  input->band_shift_opt = 0;
564  input->add_lt_noise = 0.0;
565  input->add_ws_noise = -1.0;
566  input->add_wd_noise = -1.0;
567  input->add_mw_noise = -1.0;
568  input->add_zw_noise = -1.0;
569  input->add_rh_noise = -1.0;
570  input->add_pr_noise = -1.0;
571  input->add_wv_noise = -1.0;
572  input->add_oz_noise = -1.0;
573  input->add_no2_strat_noise = -1.0;
574  input->add_no2_tropo_noise = -1.0;
575 
576  input->vcal_chl = -1.0;
577  input->vcal_solz = -1.0;
578  input->vcal_opt = -1;
579 
580  input->aermodrat = 0.0;
581  input->aermodmin = -1;
582  input->aermodmax = -1;
583 
584  input->absaer = 0.0;
585  input->rhoamin = 0.0001;
586  input->epsmin = 0.85;
587  input->epsmax = 1.35;
588  input->tauamax = 0.30;
589  input->nlwmin = 0.15;
590  input->wsmax = 8.0;
591 
592  input->mumm_alpha = 1.72;
593  input->mumm_gamma = 1.00;
594  input->mumm_epsilon = 1.00;
595 
596  input->windspeed = -1000;
597  input->windangle = -1000;
598  input->pressure = -1000;
599  input->ozone = -1000;
600  input->relhumid = -1000;
601  input->watervapor = -1000;
602  input->ice_threshold = 0.1;
603 
604  for (i = 0; i < 8; i++) input->coccolith[0] = 0.0;
605  for (i = 0; i < 2; i++) input->cirrus_thresh[i] = -1;
606  for (i = 0; i < 2; i++) input->chloc2w [i] = -1;
607  for (i = 0; i < 3; i++) input->chloc3w [i] = -1;
608  for (i = 0; i < 4; i++) input->chloc4w [i] = -1;
609  for (i = 0; i < 2; i++) input->kd2w [i] = -1;
610 
611  strcpy(input->suite, "");
612 
613  fctl_init(&(input->fctl));
614 
615  /* for inverse (calibration) modes */
616  input->chlthreshold = CHL_MAX;
617  input->aotthreshold = AOT_MAX;
618  input->maxpointdist = 0.0;
619  strcpy(default_flaguse, "ATMFAIL,LAND,HIGLINT,HILT,HISATZEN,STRAYLIGHT,CLDICE,COCCOLITH,LOWLW,CHLFAIL,NAVWARN,ABSAER,MAXAERITER,ATMWARN,HISOLZEN,NAVFAIL");
620  strcpy(input->flaguse, default_flaguse);
621 
622  input->xcalbox = 0;
623  input->xcalboxcenter[0] = 0;
624  input->xcalboxcenter[1] = 0;
625  input->xcalpervalid = 0;
626  input->xcalsubsmpl = 1;
627 
628  input->vcal_depth = -1000;
629  input->vcal_min_nbin = 4;
630  input->vcal_min_nscene = 3;
631 
632  /* for sst */
633  input->sstreftype = 0;
634  input->sstrefdif = 100.0; /* some large number so it doesn't hurt */
635  input->viirsnv7 = -1; /* VIIRSN v7 high satz latband equation */
636  input->viirsnosisaf = 0; /* VIIRSN OSI-SAF equation */
637 
638  /* for l1mapgen and l1brsgen */
639  input->datamin = 0.01;
640  input->datamax = 0.9;
641  input->west = -999;
642  input->east = -999;
643  input->north = -999;
644  input->south = -999;
645  input->width = 600;
646  input->threshold = 0.1;
647  input->subsamp = 1;
648  input->stype = 0;
649  for (i = 0; i < 3; i++) {
650  input->rgb[i] = 1;
651  }
652  input->xbox = -1;
653  input->ybox = -1;
654 
655  input->deflate = 0;
656 
657  input->raman_opt = 0;
658 
659  input->shallow_water_depth=30.;
660 
661  return;
662 }
663 
664 //-----------------------------------------------------------------------
665 
667 int l2gen_init_options(clo_optionList_t* list, const char* prog) {
668  char tmpStr[2048];
669  char tmpStr1[2048];
670  char tmpStr2[32];
671  clo_option_t* option;
672  int i;
673 
674  // set the min program name
675  strcpy(mainProgramName, prog);
676 
677  if (!strcmp(prog, "msl12")) {
678  clo_setSelectOptionKeys(l2gen_optionKeys);
679  } else if (!strcmp(prog, "l2gen")) {
680  clo_setSelectOptionKeys(l2gen_optionKeys);
681  } else if (!strcmp(prog, "l3gen")) {
682  clo_setSelectOptionKeys(l2gen_optionKeys);
683  } else if (!strcmp(prog, "l1bgen_generic")) {
684  clo_setSelectOptionKeys(l1bgen_optionKeys);
685  } else if (!strcmp(prog, "l1mapgen")) {
686  clo_setSelectOptionKeys(l1mapgen_optionKeys);
687  } else if (!strcmp(prog, "l1brsgen")) {
688  clo_setSelectOptionKeys(l1brsgen_optionKeys);
689  } else if (!strcmp(prog, "l1det2det")) {
690  clo_setSelectOptionKeys(l1det2det_optionKeys);
691  } else if (!strcmp(prog, "vcalmerge")) {
692  clo_setSelectOptionKeys(vcalmerge_optionKeys);
693  }
694 
695  sprintf(tmpStr, "%s %d.%d.%d-%s (%s %s)", prog, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, GITSHA, __DATE__, __TIME__);
696  clo_setVersion(tmpStr);
697  clo_addXmlProgramMetadata("progressRegex", "Processing scan .+?\\((\\d+) of (\\d+)\\)");
698 
699  sprintf(tmpStr, "Usage: %s argument-list\n\n", prog);
700  strcat(tmpStr, " The argument-list is a set of keyword=value pairs. The arguments can\n");
701  strcat(tmpStr, " be specified on the commandline, or put into a parameter file, or the\n");
702  strcat(tmpStr, " two methods can be used together, with commandline over-riding.\n\n");
703  strcat(tmpStr, " return value: 0=OK, 1=error, 110=north,south,east,west does not intersect\n");
704  strcat(tmpStr, " file data.\n\n");
705  strcat(tmpStr, "The list of valid keywords follows:\n");
706  clo_setHelpStr(tmpStr);
707 
708  strcpy(tmpStr, "product suite string for loading\n");
709  strcat(tmpStr, " suite-specific defaults");
710  clo_addOption(list, "suite", CLO_TYPE_STRING, "OC", tmpStr);
711 
712  strcpy(tmpStr, "input L1 file name");
713  option = clo_addOption(list, "ifile", CLO_TYPE_IFILE, NULL, tmpStr);
714  clo_addOptionAlias(option, "ifile1");
715 
716  strcpy(tmpStr, "ifile[#]=input L1 file names (1-original and 2-vicarious) to be cross-calibrated\n");
717  strcat(tmpStr, " or input HDF file names containing cross-calibration pixels");
718  clo_addOption(list, "help_ifile", CLO_TYPE_HELP, NULL, tmpStr);
719 
720  clo_addOption(list, "ilist", CLO_TYPE_IFILE, NULL, "file containing list of input files, one per line");
721 
722  strcpy(tmpStr, "input L1 geolocation file name (MODIS/VIIRS only)");
723  clo_addOption(list, "geofile", CLO_TYPE_IFILE, NULL, tmpStr);
724 
725  if (!strcmp(prog, "l1mapgen")) {
726  option = clo_addOption(list, "ofile", CLO_TYPE_OFILE, "output", "output file name");
727  clo_addOptionAlias(option, "ofile1");
728 
729  strcpy(tmpStr, "output file format\n");
730  strcat(tmpStr, " ppm: output a netPBM PPM file\n");
731  strcat(tmpStr, " png: output a PNG file\n");
732  strcat(tmpStr, " tiff: output a geoTIFF file");
733  clo_addOption(list, "oformat", CLO_TYPE_STRING, "ppm", tmpStr);
734 
735  } else if (!strcmp(prog, "l1brsgen")) {
736  option = clo_addOption(list, "ofile", CLO_TYPE_OFILE, "output", "output file name");
737  clo_addOptionAlias(option, "ofile1");
738 
739  strcpy(tmpStr, "output file format\n");
740  strcat(tmpStr, " hdf4: output a HDF4 file\n");
741  strcat(tmpStr, " bin: output a flat binary file\n");
742  strcat(tmpStr, " png: output a PNG file\n");
743  strcat(tmpStr, " ppm: output a netPBM PPM file");
744  clo_addOption(list, "oformat", CLO_TYPE_STRING, "hdf4", tmpStr);
745 
746  } else if (!strcmp(prog, "l1bgen_generic") || !strcmp(prog, "l1det2det")) {
747  option = clo_addOption(list, "ofile", CLO_TYPE_OFILE, "output", "output file name");
748  clo_addOptionAlias(option, "ofile1");
749 
750  strcpy(tmpStr, "output file format\n");
751  strcat(tmpStr, " netcdf4: output a netCDF version 4 file\n");
752  strcat(tmpStr, " hdf4: output a HDF version 4 file");
753  clo_addOption(list, "oformat", CLO_TYPE_STRING, "netCDF4", tmpStr);
754 
755  } else {
756  strcpy(tmpStr, "output file #1 name,\n");
757  strcat(tmpStr, " output vicarious L1B for inverse mode\n");
758  strcat(tmpStr, " ofile[#] = additional output L2 file name");
759  option = clo_addOption(list, "ofile", CLO_TYPE_OFILE, "output", tmpStr);
760  clo_addOptionAlias(option, "ofile1");
761 
762  strcpy(tmpStr, "output file format\n");
763  strcat(tmpStr, " netcdf4: output a netCDF version 4 file\n");
764  strcat(tmpStr, " hdf4: output a HDF version 4 file");
765  clo_addOption(list, "oformat", CLO_TYPE_STRING, "netCDF4", tmpStr);
766  }
767 
768  strcpy(tmpStr, "output file color depth for HDF4 file\n");
769  strcat(tmpStr, " 8bit: output 8 bit color depth\n");
770  strcat(tmpStr, " 24bit: output 24 bit color depth");
771  clo_addOption(list, "oformat_depth", CLO_TYPE_STRING, "8bit", tmpStr);
772 
773  clo_addOption(list, "deflate", CLO_TYPE_INT, "0", "deflation level");
774 
775  strcpy(tmpStr, "input L2 file names for sensor to be\n");
776  strcat(tmpStr, " used as a calibrator. Alternatively, a data point can be used as a\n");
777  strcat(tmpStr, " calibrator (e.g. MOBY)\n");
778  strcat(tmpStr, " il2file[#] = additional L2 calibration file names");
779  option = clo_addOption(list, "il2file", CLO_TYPE_IFILE, NULL, tmpStr);
780  clo_addOptionAlias(option, "il2file1");
781 
782  clo_addOption(list, "tgtfile", CLO_TYPE_IFILE, NULL, "vicarious calibration target file");
783  clo_addOption(list, "aerfile", CLO_TYPE_IFILE, NULL, "aerosol model specification file");
784  clo_addOption(list, "metafile", CLO_TYPE_IFILE, NULL, "output meta-data file");
785 
786  strcpy(tmpStr, "L2 products to be included in ofile #1\n");
787  strcat(tmpStr, " l2prod[#] = L2 products to be included in ofile[#]");
788  option = clo_addOption(list, "l2prod", CLO_TYPE_STRING, NULL, tmpStr);
789  clo_addOptionAlias(option, "l2prod1");
790 
791  strcpy(tmpStr, " control-point pixel increment for lon/lat\n");
792  strcat(tmpStr, " arrays");
793  clo_addOption(list, "ctl_pt_incr", CLO_TYPE_INT, "8", tmpStr);
794 
795  strcpy(tmpStr, "toggle ocean processing\n");
796  strcat(tmpStr, " 1: On\n");
797  strcat(tmpStr, " 0: Off\n");
798  strcat(tmpStr, " 2: force all pixels to be processed as ocean");
799  clo_addOption(list, "proc_ocean", CLO_TYPE_INT, "1", tmpStr);
800 
801  clo_addOption(list, "proc_land", CLO_TYPE_BOOL, "off", "toggle land processing");
802  clo_addOption(list, "proc_cloud", CLO_TYPE_BOOL, "off", "toggle cloud processing");
803 
804  strcpy(tmpStr, "toggle SST processing\n");
805  strcat(tmpStr, " (default=1 for MODIS, 0 otherwise)");
806  clo_addOption(list, "proc_sst", CLO_TYPE_BOOL, NULL, tmpStr);
807 
808  strcpy(tmpStr, "processing mode\n");
809  strcat(tmpStr, " 0: forward processing\n");
810  strcat(tmpStr, " 1: inverse (calibration) mode, targeting to nLw=0\n");
811  strcat(tmpStr, " 2: inverse (calibration) mode, given nLw target\n");
812  strcat(tmpStr, " 3: inverse (calibration) mode, given Lw target (internally normalized)");
813  clo_addOption(list, "mode", CLO_TYPE_INT, "0", tmpStr);
814 
815  strcpy(tmpStr, "seawater IOP options\n");
816  strcat(tmpStr, " 0: static values\n");
817  strcat(tmpStr, " 1: temperature & salinity-dependent seawater nw, aw, bbw\n");
818  clo_addOption(list, "seawater_opt", CLO_TYPE_INT, "0", tmpStr);
819 
820  clo_addOption(list, "atmocor", CLO_TYPE_BOOL, "on", "toggle atmospheric correction");
821 
822  sprintf(tmpStr, "aerosol mode option\n");
823  strncpy(tmpStr1, tmpStr, 2048);
824  sprintf(tmpStr, "%s %3d: No aerosol subtraction\n", tmpStr1, AERNULL);
825  strncpy(tmpStr1, tmpStr, 2048);
826  sprintf(tmpStr, "%s >0: Multi-scattering with fixed model (provide model number, 1-N,\n", tmpStr1);
827  strncpy(tmpStr1, tmpStr, 2048);
828  sprintf(tmpStr, "%s relative to aermodels list)\n", tmpStr1);
829  strncpy(tmpStr1, tmpStr, 2048);
830  sprintf(tmpStr, "%s %3d: White aerosol extrapolation.\n", tmpStr1, AERWHITE);
831  strncpy(tmpStr1, tmpStr, 2048);
832  sprintf(tmpStr, "%s %3d: Multi-scattering with 2-band model selection\n", tmpStr1, AERWANG);
833  strncpy(tmpStr1, tmpStr, 2048);
834  sprintf(tmpStr, "%s %3d: Multi-scattering with 2-band, RH-based model selection and\n", tmpStr1, AERRHNIR);
835  strncpy(tmpStr1, tmpStr, 2048);
836  sprintf(tmpStr, "%s iterative NIR correction\n", tmpStr1);
837  strncpy(tmpStr1, tmpStr, 2048);
838  sprintf(tmpStr, "%s %3d: Multi-scattering with 2-band model selection\n", tmpStr1, AERWANGNIR);
839  strncpy(tmpStr1, tmpStr, 2048);
840  sprintf(tmpStr, "%s and iterative NIR correction\n", tmpStr1);
841  strncpy(tmpStr1, tmpStr, 2048);
842  sprintf(tmpStr, "%s %3d: Multi-scattering with fixed model pair\n", tmpStr1, FIXMODPAIR);
843  strncpy(tmpStr1, tmpStr, 2048);
844  sprintf(tmpStr, "%s (requires aermodmin, aermodmax, aermodrat specification)\n", tmpStr1);
845  strncpy(tmpStr1, tmpStr, 2048);
846  sprintf(tmpStr, "%s %3d: Multi-scattering with fixed model pair\n", tmpStr1, FIXMODPAIRNIR);
847  strncpy(tmpStr1, tmpStr, 2048);
848  sprintf(tmpStr, "%s and iterative NIR correction\n", tmpStr1);
849  strncpy(tmpStr1, tmpStr, 2048);
850  sprintf(tmpStr, "%s (requires aermodmin, aermodmax, aermodrat specification)\n", tmpStr1);
851  strncpy(tmpStr1, tmpStr, 2048);
852  sprintf(tmpStr, "%s %3d: Multi-scattering with fixed angstrom\n", tmpStr1, FIXANGSTROM);
853  strncpy(tmpStr1, tmpStr, 2048);
854  sprintf(tmpStr, "%s (requires aer_angstrom specification)\n", tmpStr1);
855  strncpy(tmpStr1, tmpStr, 2048);
856  sprintf(tmpStr, "%s %3d: Multi-scattering with fixed angstrom\n", tmpStr1, FIXANGSTROMNIR);
857  strncpy(tmpStr1, tmpStr, 2048);
858  sprintf(tmpStr, "%s and iterative NIR correction\n", tmpStr1);
859  strncpy(tmpStr1, tmpStr, 2048);
860  sprintf(tmpStr, "%s (requires aer_angstrom specification)\n", tmpStr1);
861  strncpy(tmpStr1, tmpStr, 2048);
862  sprintf(tmpStr, "%s %3d: Multi-scattering with fixed aerosol optical thickness\n", tmpStr1, FIXAOT);
863  strncpy(tmpStr1, tmpStr, 2048);
864  sprintf(tmpStr, "%s (requires taua specification)\n", tmpStr1);
865  strncpy(tmpStr1, tmpStr, 2048);
866  sprintf(tmpStr, "%s %3d: Multi-scattering with 2-band model selection using Wang et al. 2009\n", tmpStr1, AERWANGSWIR);
867  strncpy(tmpStr1, tmpStr, 2048);
868  sprintf(tmpStr, "%s to switch between SWIR and NIR. (MODIS only, requires aer_swir_short,\n", tmpStr1);
869  strncpy(tmpStr1, tmpStr, 2048);
870  sprintf(tmpStr, "%s aer_swir_long, aer_wave_short, aer_wave_long)\n", tmpStr1);
871  strncpy(tmpStr1, tmpStr, 2048);
872  sprintf(tmpStr, "%s %3d: Multi-scattering with MUMM correction\n", tmpStr1, AERMUMM);
873  strncpy(tmpStr1, tmpStr, 2048);
874  sprintf(tmpStr, "%s and MUMM NIR calculation\n", tmpStr1);
875  strncpy(tmpStr1, tmpStr, 2048);
876  sprintf(tmpStr, "%s %3d: Multi-scattering epsilon, RH-based model selection\n", tmpStr1, AERRHMSEPS);
877  strncpy(tmpStr1, tmpStr, 2048);
878  sprintf(tmpStr, "%s and iterative NIR correction\n", tmpStr1);
879  strncpy(tmpStr1, tmpStr, 2048);
880  sprintf(tmpStr, "%s %3d: Spectral Matching of aerosols reflectance\n", tmpStr1, AERRHSM);
881  strncpy(tmpStr1, tmpStr, 2048);
882  sprintf(tmpStr, "%s and iterative NIR correction\n", tmpStr1);
883  strncpy(tmpStr1, tmpStr, 2048);
884  sprintf(tmpStr, "%s %3d: Multi-scattering epsilon (linear), RH-based model selection\n", tmpStr1, AERRHMSEPS_lin);
885  strncpy(tmpStr1, tmpStr, 2048);
886  sprintf(tmpStr, "%s and iterative NIR correction\n", tmpStr1);
887  clo_addOption(list, "aer_opt", CLO_TYPE_INT, "99", tmpStr);
888 
889  clo_addOption(list, "aermodfile", CLO_TYPE_IFILE, NULL, "aerosol model filename leader");
890 
891  clo_addOption(list, "aer_wave_short", CLO_TYPE_INT, "765", "shortest sensor wavelength for aerosol\n model selection");
892  clo_addOption(list, "aer_wave_long", CLO_TYPE_INT, "865", "longest sensor wavelength for aerosol\n model selection");
893  clo_addOption(list, "aer_swir_short", CLO_TYPE_INT, "-1", "shortest sensor wavelength for\n SWIR-based NIR Lw correction");
894  clo_addOption(list, "aer_swir_long", CLO_TYPE_INT, "-1", "longest sensor wavelength for SWIR-based\n NIR Lw correction");
895  clo_addOption(list, "aer_rrs_short", CLO_TYPE_FLOAT, "-1.0", "Rrs at shortest sensor wavelength for\n aerosol model selection");
896  clo_addOption(list, "aer_rrs_long", CLO_TYPE_FLOAT, "-1.0", "Rrs at longest sensor wavelength for\n aerosol model selection");
897  clo_addOption(list, "aermodmin", CLO_TYPE_INT, "-1", "lower-bounding model to use for fixed model\n pair aerosol option");
898  clo_addOption(list, "aermodmax", CLO_TYPE_INT, "-1", "upper-bounding model to use for fixed model\n pair aerosol option");
899  clo_addOption(list, "aermodrat", CLO_TYPE_FLOAT, "0.0", "ratio to use for fixed model pair aerosol\n option");
900  clo_addOption(list, "aer_angstrom", CLO_TYPE_FLOAT, "-999.0", "aerosol angstrom exponent for model\n selection");
901  clo_addOption(list, "aer_iter_max", CLO_TYPE_INT, "10", "maximum number of iterations for NIR\n water-leaving radiance estimation.");
902  clo_addOption(list, "mumm_alpha", CLO_TYPE_FLOAT, "1.72", "water-leaving reflectance ratio for MUMM\n turbid water atmospheric correction");
903  clo_addOption(list, "mumm_gamma", CLO_TYPE_FLOAT, "1.0", "two-way Rayleigh-aerosol transmittance\n ratio for MUMM turbid water atmospheric correction");
904  clo_addOption(list, "mumm_epsilon", CLO_TYPE_FLOAT, "1.0", "aerosol reflectance ratio for MUMM\n turbid water atmospheric correction");
905 
906  strcpy(tmpStr, "absorbing aerosol flagging option\n");
907  strcat(tmpStr, " 0: disabled\n");
908  strcat(tmpStr, " 1: use rhow_412 aerosol index test\n");
909  strcat(tmpStr, " 2: GMAO ancillary aerosol test\n");
910  clo_addOption(list, "absaer_opt", CLO_TYPE_INT, "0", tmpStr);
911 
912  strcpy(tmpStr, "glint correction:\n");
913  strcat(tmpStr, " 0: glint correction off\n");
914  strcat(tmpStr, " 1: standard glint correction\n");
915  strcat(tmpStr, " 2: simple glint correction");
916  clo_addOption(list, "glint_opt", CLO_TYPE_INT, "1", tmpStr);
917 
918  clo_addOption(list, "cirrus_opt", CLO_TYPE_BOOL, NULL, "cirrus cloud reflectance correction option");
919 
920  strcpy(tmpStr, "oxygen A-band correction\n");
921  strcat(tmpStr, " 0: no correction\n");
922  strcat(tmpStr, " 1: Apply Ding and Gordon (1995) correction\n");
923  strcat(tmpStr, " 3: Apply oxygen transmittance from gas transmittance table (see gas_opt)\n");
924  clo_addOption(list, "oxaband_opt", CLO_TYPE_INT, "0", tmpStr);
925  clo_addOption(list, "filter_opt", CLO_TYPE_BOOL, NULL, "filtering input data option");
926  clo_addOption(list, "filter_file", CLO_TYPE_IFILE, "$OCDATAROOT/sensor/sensor_filter.dat", "\n data file for input filtering");
927 
928  strcpy(tmpStr, "Bidirectional reflectance correction\n");
929  strcat(tmpStr, " 0: no correction\n");
930  strcat(tmpStr, " 1: Fresnel reflection/refraction correction for sensor path\n");
931  strcat(tmpStr, " 3: Fresnel reflection/refraction correction for sensor + solar path\n");
932  strcat(tmpStr, " 7: Morel f/Q + Fresnel solar + Fresnel sensor\n");
933  strcat(tmpStr, " 15: Gordon DT + Morel f/Q + Fresnel solar + Fresnel sensor\n");
934  strcat(tmpStr, " 19: Morel Q + Fresnel solar + Fresnel sensor");
935  clo_addOption(list, "brdf_opt", CLO_TYPE_INT, "0", tmpStr);
936 
937  strcpy(tmpStr, "gaseous transmittance bitmask selector\n");
938  strcat(tmpStr, " 0: no correction\n");
939  strcat(tmpStr, " 1: Ozone\n");
940  strcat(tmpStr, " 2: CO2\n");
941  strcat(tmpStr, " 4: NO2\n");
942  strcat(tmpStr, " 8: H2O\n");
943  strcat(tmpStr, " 16: Use ATREM\n");
944  strcat(tmpStr, " 32: Use <sensor>_gas_transmittance.nc tables\n");
945  strcat(tmpStr, " 64: CO\n");
946  strcat(tmpStr, " 128: CH4\n");
947  strcat(tmpStr, " 256: N2O");
948  clo_addOption(list, "gas_opt", CLO_TYPE_INT, "1", tmpStr);
949 
950  strcpy(tmpStr, "ATREM gaseous transmittance bitmask selector\n");
951  strcat(tmpStr, " 0: H2O only\n");
952  strcat(tmpStr, " 1: Ozone\n");
953  strcat(tmpStr, " 2: CO2\n");
954  strcat(tmpStr, " 4: NO2\n");
955  strcat(tmpStr, " 8: CO\n");
956  strcat(tmpStr, " 16: CH4\n");
957  strcat(tmpStr, " 32: O2\n");
958  strcat(tmpStr, " 64: N2O ");
959  clo_addOption(list, "atrem_opt", CLO_TYPE_INT, "0", tmpStr);
960  strcpy(tmpStr, "ATREM gaseous transmittance geometry option\n");
961  strcat(tmpStr, " 0: Only recalculate geometry when error threshold reached (fast)\n");
962  strcat(tmpStr, " 1: Recalculate geometry every pixel (slow)");
963  clo_addOption(list, "atrem_geom", CLO_TYPE_INT, "0", tmpStr);
964  strcpy(tmpStr, "ATREM gaseous transmittance calculation option\n");
965  strcat(tmpStr, " 0: Calculate transmittance using k-distribution method (fast)\n");
966  strcat(tmpStr, " 1: Calculate transmittance using full method (slow)");
967  clo_addOption(list, "atrem_full", CLO_TYPE_INT, "0", tmpStr);
968  strcpy(tmpStr, "ATREM gaseous transmittance Atm. model selection\n");
969  strcat(tmpStr, " 0: Use pixel's latitude and date to determine model \n");
970  strcat(tmpStr, " 1: tropical\n");
971  strcat(tmpStr, " 2: mid latitude summer\n");
972  strcat(tmpStr, " 3: mid latitude winter\n");
973  strcat(tmpStr, " 4: subarctic summer\n");
974  strcat(tmpStr, " 5: subarctic winter\n");
975  strcat(tmpStr, " 6: US standard 1962");
976  clo_addOption(list, "atrem_model", CLO_TYPE_INT, "0", tmpStr);
977  strcpy(tmpStr, "ATREM gaseous transmittance split paths between solar and sensor (turns atrem_full on)\n");
978  strcat(tmpStr, " 0: Calculates transmittance over total path length (default)\n");
979  strcat(tmpStr, " 1: Calculates transmittance over separate solar and sensor paths (slow)");
980  clo_addOption(list, "atrem_splitpaths", CLO_TYPE_INT, "0", tmpStr);
981 
982  strcpy(tmpStr, "IOP model for use in downstream products\n");
983  strcat(tmpStr, " 0: None (products requiring a or bb will fail)\n");
984  strcat(tmpStr, " 1: Carder\n");
985  strcat(tmpStr, " 2: GSM\n");
986  strcat(tmpStr, " 3: QAA\n");
987  strcat(tmpStr, " 4: PML\n");
988  strcat(tmpStr, " 5: NIWA\n");
989  strcat(tmpStr, " 6: LAS\n");
990  strcat(tmpStr, " 7: GIOP");
991  clo_addOption(list, "iop_opt", CLO_TYPE_INT, "0", tmpStr);
992 
993  strcpy(tmpStr, "model for phytoplankton carbon\n");
994  strcat(tmpStr, " 1: Graff/Westberry\n");
995  strcat(tmpStr, " 2: Behrenfeld\n");
996  clo_addOption(list, "cphyt_opt", CLO_TYPE_INT, "1", tmpStr);
997 
998  clo_addOption(list, "polfile", CLO_TYPE_IFILE, NULL, "polarization sensitivities filename leader");
999 
1000  strcpy(tmpStr, "polarization correction (sensor-specific)\n");
1001  strcat(tmpStr, " 0: no correction\n");
1002  strcat(tmpStr, " 1: only Rayleigh component is polarized\n");
1003  strcat(tmpStr, " 2: all radiance polarized like Rayleigh\n");
1004  strcat(tmpStr, " 3: only Rayleigh and Glint are polarized (MODIS default)\n");
1005  strcat(tmpStr, " 4: all radiance polarized like Rayleigh + Glint");
1006  clo_addOption(list, "pol_opt", CLO_TYPE_INT, "-1", tmpStr);
1007 
1008  strcpy(tmpStr, "bandshifting option \n");
1009  strcat(tmpStr, " 1: apply bio-optical bandshift\n");
1010  strcat(tmpStr, " 0: linear interpolation");
1011  clo_addOption(list, "band_shift_opt", CLO_TYPE_INT, "0", tmpStr);
1012 
1013  strcpy(tmpStr, "wind speed uncertainty simulation option \n");
1014  strcat(tmpStr, " <0.0: no noise added\n");
1015  strcat(tmpStr, " =0.0: use ws_unc to inform noise model\n");
1016  strcat(tmpStr, " >0.0: use input to inform noise model");
1017  clo_addOption(list, "add_ws_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1018 
1019  strcpy(tmpStr, "wind direction uncertainty simulation option \n");
1020  strcat(tmpStr, " <0.0: no noise added\n");
1021  strcat(tmpStr, " =0.0: use wd_unc to inform noise model\n");
1022  strcat(tmpStr, " >0.0: use input to inform noise model");
1023  clo_addOption(list, "add_wd_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1024 
1025  strcpy(tmpStr, "meridional wind uncertainty simulation option \n");
1026  strcat(tmpStr, " <0.0: no noise added\n");
1027  strcat(tmpStr, " =0.0: use mw_unc to inform noise model\n");
1028  strcat(tmpStr, " >0.0: use input to inform noise model");
1029  clo_addOption(list, "add_mw_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1030 
1031  strcpy(tmpStr, "zonal wind uncertainty simulation option \n");
1032  strcat(tmpStr, " <0.0: no noise added\n");
1033  strcat(tmpStr, " =0.0: use zw_unc to inform noise model\n");
1034  strcat(tmpStr, " >0.0: use input to inform noise model");
1035  clo_addOption(list, "add_zw_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1036 
1037  strcpy(tmpStr, "relative humidity uncertainty simulation option \n");
1038  strcat(tmpStr, " <0.0: no noise added\n");
1039  strcat(tmpStr, " =0.0: use rh_unc to inform noise model\n");
1040  strcat(tmpStr, " >0.0: use input to inform noise model");
1041  clo_addOption(list, "add_rh_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1042 
1043  strcpy(tmpStr, "pressure uncertainty simulation option \n");
1044  strcat(tmpStr, " <0.0: no noise added\n");
1045  strcat(tmpStr, " =0.0: use pr_unc to inform noise model\n");
1046  strcat(tmpStr, " >0.0: use input to inform noise model");
1047  clo_addOption(list, "add_pr_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1048 
1049  strcpy(tmpStr, "water vapor uncertainty simulation option \n");
1050  strcat(tmpStr, " <0.0: no noise added\n");
1051  strcat(tmpStr, " =0.0: use wv_unc to inform noise model\n");
1052  strcat(tmpStr, " >0.0: use input to inform noise model");
1053  clo_addOption(list, "add_wv_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1054 
1055  strcpy(tmpStr, "ozone uncertainty simulation option \n");
1056  strcat(tmpStr, " <0.0: no noise added\n");
1057  strcat(tmpStr, " =0.0: use oz_unc to inform noise model\n");
1058  strcat(tmpStr, " >0.0: use input to inform noise model");
1059  clo_addOption(list, "add_oz_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1060 
1061  strcpy(tmpStr, "tropospheric no2 uncertainty simulation option \n");
1062  strcat(tmpStr, " <0.0: no noise added\n");
1063  strcat(tmpStr, " =0.0: use no2_tropo_unc to inform noise model\n");
1064  strcat(tmpStr, " >0.0: use input to inform noise model");
1065  clo_addOption(list, "add_no2_tropo_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1066 
1067  strcpy(tmpStr, "stratospheric no2 uncertainty simulation option \n");
1068  strcat(tmpStr, " <0.0: no noise added\n");
1069  strcat(tmpStr, " =0.0: use no2_strat_unc to inform noise model\n");
1070  strcat(tmpStr, " >0.0: use input to inform noise model");
1071  clo_addOption(list, "add_no2_strat_noise", CLO_TYPE_FLOAT, "-1.0", tmpStr);
1072 
1073  strcpy(tmpStr, "Lt uncertainty simulation option \n");
1074  strcat(tmpStr, " >0.0: add random normal noise to gain\n");
1075  strcat(tmpStr, " 0.0: no random noise added");
1076  clo_addOption(list, "add_lt_noise", CLO_TYPE_FLOAT, "0.0", tmpStr);
1077 
1078  strcpy(tmpStr, "Lt noise scale factor option \n");
1079  strcat(tmpStr, " !=1.0: scales noise by factoring SNR\n");
1080  strcat(tmpStr, " =1.0: noise not scaled");
1081  clo_addOption(list, "lt_noise_scale", CLO_TYPE_FLOAT, NULL, tmpStr);
1082 
1083  strcpy(tmpStr, "bias fraction factor option \n");
1084  strcat(tmpStr, " !=0.0: adds bias as a fraction of Lt\n");
1085  strcat(tmpStr, " =0.0: no bias added");
1086  clo_addOption(list, "bias_frac", CLO_TYPE_FLOAT, NULL, tmpStr);
1087 
1088  strcpy(tmpStr, "GIOP model aph function type\n");
1089  strcat(tmpStr, " 0: tabulated (supplied via giop_aph_file)\n");
1090  strcat(tmpStr, " 2: Bricaud et al. 1995 (chlorophyll supplied via default empirical algorithm)\n");
1091  strcat(tmpStr, " 3: Ciotti and Bricaud 2006 (size fraction supplied via giop_aph_s)");
1092  clo_addOption(list, "giop_aph_opt", CLO_TYPE_INT, "2", tmpStr);
1093  clo_addOption(list, "giop_aph_file", CLO_TYPE_IFILE, "$OCDATAROOT/common/aph_default.txt", "\n GIOP model, tabulated aph spectra");
1094  clo_addOption(list, "giop_aph_s", CLO_TYPE_FLOAT, "-1000.0", "GIOP model, spectral parameter\n for aph");
1095 
1096  strcpy(tmpStr, "GIOP model adg function type\n");
1097  strcat(tmpStr, " 0: tabulated (supplied via giop_adg_file)\n");
1098  strcat(tmpStr, " 1: exponential with exponent supplied via giop_adg_s)\n");
1099  strcat(tmpStr, " 2: exponential with exponent derived via Lee et al. (2002)\n");
1100  strcat(tmpStr, " 3: exponential with exponent derived via OBPG method");
1101  clo_addOption(list, "giop_adg_opt", CLO_TYPE_INT, "1", tmpStr);
1102  clo_addOption(list, "giop_adg_file", CLO_TYPE_STRING, "$OCDATAROOT/common/adg_default.txt", "\n GIOP model, tabulated adg spectra");
1103  clo_addOption(list, "giop_adg_s", CLO_TYPE_FLOAT, "0.018", "GIOP model, spectral parameter\n for adg");
1104 
1105  strcpy(tmpStr, "GIOP model acdom function type\n");
1106  strcat(tmpStr, " 0: tabulated (supplied via giop_acdom_file)\n");
1107  strcat(tmpStr, " 1: no data");
1108  clo_addOption(list, "giop_acdom_opt", CLO_TYPE_INT, "1", tmpStr);
1109  clo_addOption(list, "giop_acdom_file", CLO_TYPE_IFILE, NULL, "\n file of specific CDOM absorption coefficients for aLMI");
1110 
1111  strcpy(tmpStr, "GIOP model anap function type\n");
1112  strcat(tmpStr, " 0: tabulated (supplied via giop_anap_file)\n");
1113  strcat(tmpStr, " 1: no data");
1114  clo_addOption(list, "giop_anap_opt", CLO_TYPE_INT, "1", tmpStr);
1115  clo_addOption(list, "giop_anap_file", CLO_TYPE_IFILE, NULL, "\n file of specific NAP absorption coefficients for aLMI");
1116 
1117  strcpy(tmpStr, "GIOP model bbp function type\n");
1118  strcat(tmpStr, " 0: tabulated (supplied via giop_bbp_file)\n");
1119  strcat(tmpStr, " 1: power-law with exponent supplied via giop_bbp_s)\n");
1120  strcat(tmpStr, " 2: power-law with exponent derived via Hoge & Lyon (1996)\n");
1121  strcat(tmpStr, " 3: power-law with exponent derived via Lee et al. (2002)\n");
1122  strcat(tmpStr, " 5: power-law with exponent derived via Ciotti et al. (1999)\n");
1123  strcat(tmpStr, " 6: power-law with exponent derived via Morel & Maritorena (2001)\n");
1124  strcat(tmpStr, " 7: power-law with exponent derived via Loisel & Stramski (2000)\n");
1125  strcat(tmpStr, " 8: spectrally independent vector derived via Loisel & Stramski (2000)\n");
1126  strcat(tmpStr, " 9: fixed vector derived via Loisel & Stramski (2000)\n");
1127  strcat(tmpStr, " 10: fixed vector derived via lee et al. (2002)");
1128  clo_addOption(list, "giop_bbp_opt", CLO_TYPE_INT, "3", tmpStr);
1129  clo_addOption(list, "giop_bbp_file", CLO_TYPE_IFILE, "$OCDATAROOT/common/bbp_default.txt", "\n GIOP model, tabulated bbp spectra");
1130  clo_addOption(list, "giop_bbp_s", CLO_TYPE_FLOAT, "-1000.0", "GIOP model, spectral parameter\n for bbp");
1131 
1132  strcpy(tmpStr, "GIOP model bbph function type\n");
1133  strcat(tmpStr, " 0: tabulated (supplied via giop_bbph_file)\n");
1134  strcat(tmpStr, " 1: no data");
1135  clo_addOption(list, "giop_bbph_opt", CLO_TYPE_INT, "1", tmpStr);
1136  clo_addOption(list, "giop_bbph_file", CLO_TYPE_IFILE, NULL, "\n file of specific phytoplankton backscattering coefficients for aLMI");
1137 
1138  strcpy(tmpStr, "GIOP model bbnap function type\n");
1139  strcat(tmpStr, " 0: tabulated (supplied via giop_bbnap_file)\n");
1140  strcat(tmpStr, " 1: no data");
1141  clo_addOption(list, "giop_bbnap_opt", CLO_TYPE_INT, "1", tmpStr);
1142  clo_addOption(list, "giop_bbnap_file", CLO_TYPE_IFILE, NULL, "\n file of specific nap backscattering coefficients for aLMI");
1143 
1144  strcpy(tmpStr, "GIOP model Rrs to bb/(a+bb) method\n");
1145  strcat(tmpStr, " 0: Gordon quadratic (specified with giop_grd)\n");
1146  strcat(tmpStr, " 1: Morel f/Q");
1147  clo_addOption(list, "giop_rrs_opt", CLO_TYPE_INT, "0", tmpStr);
1148  clo_addOption(list, "giop_grd", CLO_TYPE_FLOAT, "[0.0949,0.0794]", "GIOP model, Gordon\n Rrs to bb/(a+bb) quadratic coefficients");
1149  clo_addOption(list, "giop_rrs_diff", CLO_TYPE_FLOAT, "0.33", "GIOP model, maximum difference between input and modeled Rrs");
1150  strcpy(tmpStr, "GIOP model list of sensor wavelengths for\n");
1151  strcat(tmpStr, " optimization comma-separated list, default is all visible bands (400-700nm)");
1152  clo_addOption(list, "giop_wave", CLO_TYPE_FLOAT, "-1", tmpStr);
1153  clo_addOption(list, "giop_rrs_unc", CLO_TYPE_FLOAT, "-1", tmpStr);
1154  clo_addOption(list, "giop_maxiter", CLO_TYPE_INT, "50", "GIOP Model iteration limit");
1155 
1156  strcpy(tmpStr, "GIOP model optimization method\n");
1157  strcat(tmpStr, " 0: Amoeba optimization\n");
1158  strcat(tmpStr, " 1: Levenberg-Marquardt optimization\n");
1159  strcat(tmpStr, " 3: SVD matrix inversion\n");
1160  strcat(tmpStr, " 4: SIOP adaptive matrix inversion");
1161  clo_addOption(list, "giop_fit_opt", CLO_TYPE_INT, "1", tmpStr);
1162 
1163  strcpy(tmpStr, "GSM model options\n");
1164  strcat(tmpStr, " 0: default coefficients\n");
1165  strcat(tmpStr, " 1: Chesapeake regional coefficients");
1166  clo_addOption(list, "gsm_opt", CLO_TYPE_INT, "0", tmpStr);
1167 
1168  strcpy(tmpStr, "SM fit algorithm\n");
1169  strcat(tmpStr, " 0: Amoeba\n");
1170  strcat(tmpStr, " 1: Levenberg-Marquardt");
1171  clo_addOption(list, "gsm_fit", CLO_TYPE_INT, "0", tmpStr);
1172 
1173  clo_addOption(list, "gsm_adg_s", CLO_TYPE_FLOAT, "0.02061", "GSM IOP model, spectral slope for adg");
1174  clo_addOption(list, "gsm_bbp_s", CLO_TYPE_FLOAT, "1.03373", "GSM IOP model, spectral slope for bbp");
1175  clo_addOption(list, "gsm_aphw", CLO_TYPE_FLOAT, "[412.0, 443.0, 490.0, 510.0, 555.0, 670.0]", "\n GSM IOP model, wavelengths of ap* table");
1176  clo_addOption(list, "gsm_aphs", CLO_TYPE_FLOAT, "[0.00665, 0.05582, 0.02055, 0.01910, 0.01015, 0.01424]", "GSM IOP model, coefficients of ap* table");
1177 
1178  option = clo_addOption(list, "qaa_adg_s", CLO_TYPE_FLOAT, "0.015", "QAA IOP model, spectral\n slope for adg");
1179  clo_addOptionAlias(option, "qaa_S");
1180 
1181  clo_addOption(list, "qaa_wave", CLO_TYPE_INT, NULL, "sensor wavelengths for QAA algorithm");
1182  clo_addOption(list, "chloc2_wave", CLO_TYPE_INT, "[-1,-1]", "sensor wavelengths for OC2 chlorophyll\n algorithm");
1183  clo_addOption(list, "chloc2_coef", CLO_TYPE_FLOAT, "[0.0,0.0,0.0,0.0,0.0]", "coefficients for OC2\n chlorophyll algorithm");
1184  clo_addOption(list, "chloc3_wave", CLO_TYPE_INT, "[-1,-1,-1]", "sensor wavelengths for OC3\n chlorophyll algorithm");
1185  clo_addOption(list, "chloc3_coef", CLO_TYPE_FLOAT, "[0.0,0.0,0.0,0.0,0.0]", "coefficients for OC3\n chlorophyll algorithm");
1186  clo_addOption(list, "chloc4_wave", CLO_TYPE_INT, "[-1,-1,-1,-1]", "sensor wavelengths for OC4\n chlorophyll algorithm");
1187  clo_addOption(list, "chloc4_coef", CLO_TYPE_FLOAT, "[0.0,0.0,0.0,0.0,0.0]", "coefficients for OC4\n chlorophyll algorithm");
1188  clo_addOption(list, "kd2_wave", CLO_TYPE_INT, "[-1,-1]", "sensor wavelengths for polynomial Kd(490)\n algorithm");
1189  clo_addOption(list, "kd2_coef", CLO_TYPE_FLOAT, "[0.0,0.0,0.0,0.0,0.0,0.0]", "sensor wavelengths\n for polynomial Kd(490) algorithm");
1190  clo_addOption(list, "flh_offset", CLO_TYPE_FLOAT, "0.0", "bias to subtract\n from retrieved fluorescence line height");
1191  clo_addOption(list, "sstcoeffile", CLO_TYPE_IFILE, NULL, "IR sst algorithm coefficients file");
1192  clo_addOption(list, "dsdicoeffile", CLO_TYPE_IFILE, NULL, "SST dust correction algorithm coefficients file");
1193  clo_addOption(list, "sstssesfile", CLO_TYPE_IFILE, NULL, "IR sst algorithm error statistics file");
1194  clo_addOption(list, "sst4coeffile", CLO_TYPE_IFILE, NULL, "SWIR sst algorithm coefficients file");
1195  clo_addOption(list, "sst4ssesfile", CLO_TYPE_IFILE, NULL, "SWIR sst algorithm error statistics file");
1196  clo_addOption(list, "sst3coeffile", CLO_TYPE_IFILE, NULL, "Triple window sst algorithm coefficients file");
1197  clo_addOption(list, "sst3ssesfile", CLO_TYPE_IFILE, NULL, "Triple window sst algorithm error statistics file");
1198  clo_addOption(list, "vcnnfile", CLO_TYPE_IFILE, NULL, "virtual constellation neural net file");
1199  clo_addOption(list, "picfile", CLO_TYPE_IFILE, NULL, "pic table for Balch 2-band algorithm");
1200  clo_addOption(list, "owtfile", CLO_TYPE_IFILE, NULL, "optical water type file");
1201  clo_addOption(list, "owtchlerrfile", CLO_TYPE_IFILE, NULL, "chl error file associate with optical water type");
1202  clo_addOption(list, "avw_coef", CLO_TYPE_FLOAT, "[0.0,0.0,0.0,0.0,0.0,0.0]", "coefficients for AVW");
1203 
1204 
1205  clo_addOption(list, "gmpfile", CLO_TYPE_IFILE, NULL, "GMP geometric parameter file (MISR only)");
1206 
1207  strcpy(tmpStr, "[");
1208  strcat(tmpStr, defaermodels[0]);
1209  for (i = 1; i < defnaermodels; i++) {
1210  strcat(tmpStr, ",");
1211  strcat(tmpStr, defaermodels[i]);
1212  }
1213  strcat(tmpStr, "]");
1214  clo_addOption(list, "aermodels", CLO_TYPE_STRING, tmpStr, "aerosol models");
1215 
1216  clo_addOption(list, "met1", CLO_TYPE_IFILE, "$OCDATAROOT/common/met_climatology.hdf", "\n 1st meteorological ancillary data file");
1217  clo_addOption(list, "met2", CLO_TYPE_IFILE, NULL, "2nd meteorological ancillary data file");
1218  clo_addOption(list, "met3", CLO_TYPE_IFILE, NULL, "3rd meteorological ancillary data file");
1219  clo_addOption(list, "ozone1", CLO_TYPE_IFILE, "$OCDATAROOT/common/ozone_climatology.hdf", "\n 1st ozone ancillary data file");
1220  clo_addOption(list, "ozone2", CLO_TYPE_IFILE, NULL, "2nd ozone ancillary data file");
1221  clo_addOption(list, "ozone3", CLO_TYPE_IFILE, NULL, "3rd ozone ancillary data file");
1222  clo_addOption(list, "anc_profile1", CLO_TYPE_IFILE, NULL, "\n 1st ancillary profile data file");
1223  clo_addOption(list, "anc_profile2", CLO_TYPE_IFILE, NULL, "\n 2nd ancillary profile data file");
1224  clo_addOption(list, "anc_profile3", CLO_TYPE_IFILE, NULL, "\n 3rd ancillary profile data file");
1225  clo_addOption(list, "anc_aerosol1", CLO_TYPE_IFILE, NULL, "\n 1st ancillary aerosol data file");
1226  clo_addOption(list, "anc_aerosol2", CLO_TYPE_IFILE, NULL, "\n 2nd ancillary aerosol data file");
1227  clo_addOption(list, "anc_aerosol3", CLO_TYPE_IFILE, NULL, "\n 3rd ancillary aerosol data file");
1228  clo_addOption(list, "sfc_albedo", CLO_TYPE_IFILE, NULL, "\n ancillary cloud albedo data file");
1229  clo_addOption(list, "anc_cor_file", CLO_TYPE_IFILE, NULL, "ozone correction file");
1230  clo_addOption(list, "pixel_anc_file", CLO_TYPE_IFILE, NULL, "per pixel ancillary data file");
1231  clo_addOption(list, "land", CLO_TYPE_IFILE, "$OCDATAROOT/common/gebco_ocssw_v2020.nc", "land mask file");
1232  clo_addOption(list, "water", CLO_TYPE_IFILE, "$OCDATAROOT/common/gebco_ocssw_v2020.nc", "\n shallow water mask file");
1233  clo_addOption(list, "demfile", CLO_TYPE_IFILE, "$OCDATAROOT/common/gebco_ocssw_v2020.nc", "\n digital elevation map file");
1234  clo_addOption(list, "dem_auxfile", CLO_TYPE_IFILE, NULL, "auxiliary digital elevation map file");
1235  clo_addOption(list, "mldfile", CLO_TYPE_IFILE, NULL, "Multi-layer depth file");
1236  clo_addOption(list, "icefile", CLO_TYPE_IFILE, "$OCDATAROOT/common/ice_mask.hdf", "sea ice file");
1237  clo_addOption(list, "ice_threshold", CLO_TYPE_FLOAT, "0.1", "sea ice fraction above which will be\n flagged as sea ice");
1238  clo_addOption(list, "sstfile", CLO_TYPE_IFILE, "$OCDATAROOT/common/sst_climatology.hdf", "input\n SST reference file");
1239 
1240  strcpy(tmpStr, "Reference SST field source\n");
1241  strcat(tmpStr, " 0: Reynolds OI SST reference file\n");
1242  strcat(tmpStr, " 1: AMSR-E daily SST reference file\n");
1243  strcat(tmpStr, " 2: AMSR-E 3-day SST reference file\n");
1244  strcat(tmpStr, " 3: ATSR monthly SST reference file\n");
1245  strcat(tmpStr, " 4: NTEV2 monthly SST reference file\n");
1246  strcat(tmpStr, " 5: AMSR-E 3-day or night SST reference file\n");
1247  strcat(tmpStr, " 6: WindSat daily SST reference file\n");
1248  strcat(tmpStr, " 7: WindSat 3-day SST reference file\n");
1249  strcat(tmpStr, " 8: WindSat 3-day or night SST reference file\n");
1250  clo_addOption(list, "sstreftype", CLO_TYPE_INT, "0", tmpStr);
1251 
1252  clo_addOption(list, "sssfile", CLO_TYPE_IFILE, "$OCDATAROOT/common/sss_climatology_woa2009.hdf", "input\n SSS reference file");
1253  clo_addOption(list, "no2file", CLO_TYPE_IFILE, "$OCDATAROOT/common/no2_climatology.hdf", "no2\n ancillary file");
1254  clo_addOption(list, "alphafile", CLO_TYPE_IFILE, "$OCDATAROOT/common/alpha510_climatology.hdf", "\n alpha510 climatology file");
1255  clo_addOption(list, "tauafile", CLO_TYPE_IFILE, "$OCDATAROOT/common/taua865_climatology.hdf", "\n taua865 climatology file");
1256  clo_addOption(list, "fqfile", CLO_TYPE_IFILE, "$OCDATAROOT/common/morel_fq.nc", "f/Q correction file");
1257  clo_addOption(list, "parfile", CLO_TYPE_IFILE, NULL, "par climatology file for NPP calculation");
1258  clo_addOption(list, "gain_unc", CLO_TYPE_FLOAT, NULL, "calibration gain uncertainty");
1259  clo_addOption(list, "flaguse", CLO_TYPE_STRING, default_flaguse, "Flags to use");
1260  clo_addOption(list, "xcalbox", CLO_TYPE_INT, "0", "pixel size of the central box in the L1 scene\n (e.g. 5 pixels around MOBY) to be extracted into xcalfile for the\n cross-calibration, 0=whole L1");
1261  clo_addOption(list, "xcalboxcenter", CLO_TYPE_INT, "[0,0]", "Central [ipix, iscan] of the box in\n the L1 scene, [0,0] = center of the L1 scene");
1262  clo_addOption(list, "xcalpervalid", CLO_TYPE_INT, "0", "min percent of valid cross-calibration\n pixels within the box or the L1 scene, 0 = at least 1 pixel");
1263  clo_addOption(list, "xcalsubsmpl", CLO_TYPE_INT, "1", "Sub-sampling rate for the data to be used\n for the cross-calibration");
1264 
1265 
1266  strcpy(tmpStr, "max distance between L1 and L2 pixels\n");
1267  strcat(tmpStr, " in km\n");
1268  strcat(tmpStr, " -1.0: use mean res of L1 data\n");
1269  strcat(tmpStr, " 0.0: max{mean(L1 res),mean(L2 res)}");
1270  clo_addOption(list, "maxpointdist", CLO_TYPE_FLOAT, "0.0", tmpStr);
1271 
1272  sprintf(tmpStr2, "%f", CHL_MAX);
1273  sprintf(tmpStr, "threshold on L2 data chlorophyll\n (%f=CHL_MAX)",
1274  CHL_MAX);
1275  clo_addOption(list, "chlthreshold", CLO_TYPE_FLOAT, tmpStr2, tmpStr);
1276 
1277  sprintf(tmpStr2, "%f", AOT_MAX);
1278  sprintf(tmpStr, "threshold on L2 data AOTs\n (%f=AOT_MAX)", AOT_MAX);
1279  clo_addOption(list, "aotthreshold", CLO_TYPE_FLOAT, tmpStr2, tmpStr);
1280 
1281  strcpy(tmpStr, "\n coccolithophore algorithm coefs");
1282  clo_addOption(list, "coccolith", CLO_TYPE_FLOAT, "[1.1,0.9,0.75,1.85,1.0,1.65,0.6,1.15]", tmpStr);
1283 
1284  clo_addOption(list, "cirrus_thresh", CLO_TYPE_FLOAT, "[-1.0,-1.0]", "cirrus reflectance thresholds");
1285  clo_addOption(list, "taua", CLO_TYPE_FLOAT, NULL, "[taua_band1,...,taua_bandn] aerosol optical thickness of the\n calibration data point");
1286  clo_addOption(list, "absaer", CLO_TYPE_FLOAT, "0.0", "absorbing aerosol threshold on aerosol index");
1287  clo_addOption(list, "rhoamin", CLO_TYPE_FLOAT, "0.0001", "min NIR aerosol reflectance to attempt\n model lookup");
1288  clo_addOption(list, "epsmin", CLO_TYPE_FLOAT, "0.85", "minimum epsilon to trigger atmospheric\n correction failure flag");
1289  clo_addOption(list, "epsmax", CLO_TYPE_FLOAT, "1.35", "maximum epsilon to trigger atmospheric\n correction failure flag");
1290  clo_addOption(list, "tauamax", CLO_TYPE_FLOAT, "0.3", "maximum 865 aerosol optical depth to trigger\n hitau flag");
1291  clo_addOption(list, "nLwmin", CLO_TYPE_FLOAT, "0.15", "minimum nLw(555) to trigger low Lw flag");
1292  clo_addOption(list, "wsmax", CLO_TYPE_FLOAT, "8.0", "windspeed limit on white-cap correction in m/s");
1293  clo_addOption(list, "windspeed", CLO_TYPE_FLOAT, "-1000.0", "user over-ride of windspeed in m/s\n (-1000=use ancillary files)");
1294  clo_addOption(list, "windangle", CLO_TYPE_FLOAT, "-1000.0", "user over-ride of wind angle in deg\n (-1000=use ancillary files)");
1295  clo_addOption(list, "pressure", CLO_TYPE_FLOAT, "-1000.0", "user over-ride of atmospheric pressure\n in mb (-1000=use ancillary files)");
1296  clo_addOption(list, "ozone", CLO_TYPE_FLOAT, "-1000.0", "user over-ride of ozone concentration in\n cm (-1000=use ancillary files)");
1297  clo_addOption(list, "relhumid", CLO_TYPE_FLOAT, "-1000.0", "user over-ride of relative humidity in\n percent (-1000=use ancillary files)");
1298  clo_addOption(list, "watervapor", CLO_TYPE_FLOAT, "-1000.0", "user over-ride of water vapor in\n g/cm^2 (-1000=use ancillary files)");
1299  clo_addOption(list, "vcal_opt", CLO_TYPE_INT, "-1", "Vicarious calibration option");
1300  clo_addOption(list, "vcal_chl", CLO_TYPE_FLOAT, "-1.0", "Vicarious calibration chl");
1301  clo_addOption(list, "vcal_solz", CLO_TYPE_FLOAT, "-1.0", "Vicarious calibration solz");
1302  clo_addOption(list, "vcal_nLw", CLO_TYPE_FLOAT, NULL, "Vicarious calibration normalized water leaving radiances");
1303  clo_addOption(list, "vcal_Lw", CLO_TYPE_FLOAT, NULL, "Vicarious calibration water leaving radiances");
1304 
1305  strcpy(tmpStr, "depth to use to exclude data from target file\n");
1306  strcat(tmpStr, " e.g. -1000 excludes depths less than 1000m\n");
1307  clo_addOption(list, "vcal_depth", CLO_TYPE_FLOAT, "-1000.0", tmpStr);
1308 
1309  strcpy(tmpStr, "minimum # of samples in a bin for acceptance");
1310  clo_addOption(list, "vcal_min_nbin", CLO_TYPE_INT, "4", tmpStr);
1311 
1312  strcpy(tmpStr, "minimum # of scenes in a bin for acceptance");
1313  clo_addOption(list, "vcal_min_nscene", CLO_TYPE_INT, "3", tmpStr);
1314 
1315  clo_addOption(list, "owmcfile", CLO_TYPE_IFILE, "$OCDATAROOT/common/owmc_lut.hdf", "lut for OWMC\n classification");
1316 
1317  clo_addOption(list, "stype", CLO_TYPE_INT, "0", "scaling type\n 0: log\n 1: linear");
1318  clo_addOption(list, "rgb", CLO_TYPE_INT, "[1,1,1]", "bands to use for red, green and blue");
1319  clo_addOption(list, "north", CLO_TYPE_FLOAT, "-999", "north boundary");
1320  clo_addOption(list, "south", CLO_TYPE_FLOAT, "-999", "south boundary");
1321  clo_addOption(list, "east", CLO_TYPE_FLOAT, "-999", "east boundary");
1322  clo_addOption(list, "west", CLO_TYPE_FLOAT, "-999", "west boundary");
1323  clo_addOption(list, "xbox", CLO_TYPE_INT, "-1", "number of pixels on either side of the SW point");
1324  if (!strcmp(prog, "l1det2det")) {
1325  clo_addOption(list, "ybox", CLO_TYPE_INT, "-1", "number of scan lines to require for valid detector runs");
1326  } else {
1327  clo_addOption(list, "ybox", CLO_TYPE_INT, "-1", "number of scan lines on either side of the SW point");
1328 
1329  }
1330 
1331  clo_addOption(list, "width", CLO_TYPE_INT, "600", "width of output image");
1332  clo_addOption(list, "threshold", CLO_TYPE_FLOAT, "0.1", "threshold for the number of good pixels\n before an image is produced");
1333  clo_addOption(list, "datamin", CLO_TYPE_FLOAT, "0.01", "minimum reflectance for scaling");
1334  clo_addOption(list, "datamax", CLO_TYPE_FLOAT, "0.9", "maximum reflectance for scaling");
1335  clo_addOption(list, "subsamp", CLO_TYPE_INT, "1", "sub-sampling interval");
1336 
1337  clo_addOption(list, "viirsnv7", CLO_TYPE_INT, "-1", "=1 to use the VIIRSN V7 high senz latband sst and sst3 equations");
1338  clo_addOption(list, "viirsnosisaf", CLO_TYPE_INT, "0", "=1 to use the VIIRSN OSI-SAF sst and sst3 equations");
1339  clo_addOption(list, "sstrefdif", CLO_TYPE_FLOAT, "100.0", "stricter sst-ref difference threshold");
1340 
1341  clo_addOption(list, "prodxmlfile", CLO_TYPE_OFILE, NULL, "output XML file describing all possible products");
1342  clo_addOption(list, "breflectfile", CLO_TYPE_IFILE, NULL, "input NetCDF file for bottom reflectances and bottom types");
1343  clo_addOption(list, "bpar_validate_opt", CLO_TYPE_INT, "0","use solar noon(0), use sensor overpass (1)");
1344  clo_addOption(list, "bpar_elev_opt", CLO_TYPE_INT, "0","use bathymery (0), user-defined geometric depth (1) ");
1345  clo_addOption(list, "bpar_elev_value", CLO_TYPE_FLOAT, "30.0","user defined bpar geometric depth value");
1346 
1347  strcpy(tmpStr, "\nThis program produces a PPM-formatted output image rendered in a Plate Carree\n");
1348  strcat(tmpStr, "projection.\n\n");
1349  strcat(tmpStr, "The default band combination produces a \"true-color\" image. Other combinations\n");
1350  strcat(tmpStr, "may be chosen with the \"rgb=\" option. The expected argument to this option is\n");
1351  strcat(tmpStr, "a comma separated string of wavelengths that specifies the desired bands in\n");
1352  strcat(tmpStr, "red-green-blue order. For example, to produce a false color SeaWiFS output\n");
1353  strcat(tmpStr, "image using 865, 670 and 555 nm as the red, green, and blue values\n");
1354  strcat(tmpStr, "respectively, the option would be specified as \"rgb=865,670,555\".\n");
1355  clo_addOption(list, "help_true_color", CLO_TYPE_HELP, "0", tmpStr);
1356 
1357  strcpy(tmpStr, "Raman scattering Rrs correction options\n");
1358  strcat(tmpStr, " 0: no correction \n");
1359  strcat(tmpStr, " 1: Lee et al. (2013) empirical correction \n");
1360  strcat(tmpStr, " 2: Westberry et al. (2013) analytical correction \n");
1361  strcat(tmpStr, " 3: Lee et al. (1994) analytical correction \n");
1362  clo_addOption(list, "raman_opt", CLO_TYPE_INT, "0", tmpStr);
1363  clo_addOption(list, "water_spectra_file", CLO_TYPE_IFILE, NULL, "water absorption/scattering coefficient file");
1364 
1365  clo_addOption(list, "shallow_water_depth", CLO_TYPE_FLOAT, "30.0", "threshold for flagging shallow water");
1366  strcpy(tmpStr, "Cloud height and temperature file\n");
1367  strcat(tmpStr, " Currently, use the MODIS L2 cloud file (MYD06...)\n");
1368  strcat(tmpStr, " from the LAADS DAAC\n");
1369  clo_addOption(list, "cloud_hgt_file", CLO_TYPE_IFILE, NULL, tmpStr);
1370 
1372 
1373 
1374  return 0;
1375 }
1376 
1377 //-----------------------------------------------------------------------
1378 
1379 /*
1380  Read the command line option and all of the default parameter files.
1381 
1382  This is the order for loading the options:
1383  - read the command line to get the ifile and suite options
1384  - load the main program defaults file
1385  - load the l1 defaults files
1386  - load the suite file
1387  - load the command line (including specified par files)
1388  - re-load the command line so they take precedence
1389 
1390  */
1392  int argc, char* argv[], filehandle *l1file) {
1393  char *dataRoot;
1394  char tmpStr[FILENAME_MAX];
1395  char *ifile;
1396  clo_option_t* option;
1397  char localSuite[FILENAME_MAX];
1398  int i;
1399  const char* l2genProgName = "msl12";
1400  const char* otherProgName = NULL;
1401 
1402  assert(list);
1403 
1404  if ((dataRoot = getenv("OCDATAROOT")) == NULL) {
1405  printf("-E- OCDATAROOT environment variable is not defined.\n");
1406  return (-1);
1407  }
1408 
1409  // disable the dump option until we have read all of the files
1411  clo_readArgs(list, argc, argv);
1412 
1413  // see if suite param was set
1414  localSuite[0] = '\0';
1415  if (clo_isSet(list, "suite")) {
1416  strcpy(localSuite, clo_getString(list, "suite"));
1417  } // suite option was set
1418 
1419  ifile = clo_getString(list, "ifile");
1420 
1421  // load l2gen program defaults
1422  sprintf(tmpStr, "%s/common/%s_defaults.par", dataRoot, l2genProgName);
1423  if (want_verbose)
1424  printf("Loading default parameters from %s\n", tmpStr);
1425  clo_readFile(list, tmpStr);
1426 
1427  if (progName && progName[0] && strcmp(progName, l2genProgName)) {
1428  otherProgName = progName;
1429  }
1430 
1431  // load non-l2gen program defaults file
1432  if (otherProgName) {
1433  sprintf(tmpStr, "%s/common/%s_defaults.par", dataRoot, otherProgName);
1434  if (access(tmpStr, R_OK) != -1) {
1435  if (want_verbose)
1436  printf("Loading default parameters from %s\n", tmpStr);
1437  clo_readFile(list, tmpStr);
1438  }
1439  } // otherProgName
1440 
1441  // load sensor default files
1443 
1444  // load non-l2gen program sensor specific default files
1445  if (otherProgName) {
1446  sprintf(tmpStr, "%s/%s/%s_defaults.par", dataRoot,
1447  sensorId2SensorDir(l1file->sensorID), otherProgName);
1448  if (access(tmpStr, R_OK) != -1) {
1449  if (want_verbose)
1450  printf("Loading default parameters for %s from %s\n",
1451  sensorId2SensorName(l1file->sensorID), tmpStr);
1452  clo_readFile(list, tmpStr);
1453  }
1454 
1455  // load the sub-sensor specific other program defaults file
1456  if (l1file->subsensorID >= 0) {
1457  sprintf(tmpStr, "%s/%s/%s/%s_defaults.par", dataRoot,
1458  sensorId2SensorDir(l1file->sensorID),
1459  subsensorId2SubsensorDir(l1file->subsensorID), otherProgName);
1460  if (access(tmpStr, R_OK) != -1) {
1461  if (want_verbose)
1462  printf("Loading default sub-sensor parameters for %s from %s\n",
1463  sensorId2SensorName(l1file->sensorID), tmpStr);
1464  clo_readFile(list, tmpStr);
1465  }
1466  } // if sub-sensor
1467  } // otherProgName
1468 
1469  // if suite not set on command line or user's param file then use the default
1470  if (localSuite[0] == '\0')
1471  strcpy(localSuite, clo_getString(list, "suite"));
1472 
1473  // load the common suite file
1474  int suiteLoaded = 0;
1475  sprintf(tmpStr, "%s/%s/%s_defaults_%s.par", dataRoot,
1476  "common", l2genProgName, localSuite);
1477  if (access(tmpStr, R_OK) != -1) {
1478  if (want_verbose)
1479  printf("Loading parameters for suite %s from %s\n", localSuite, tmpStr);
1480  clo_readFile(list, tmpStr);
1481  suiteLoaded = 1;
1482  }
1483 
1484  // load the common suite file for other program
1485  if(otherProgName) {
1486  sprintf(tmpStr, "%s/%s/%s_defaults_%s.par", dataRoot,
1487  "common", otherProgName, localSuite);
1488  if (access(tmpStr, R_OK) != -1) {
1489  if (want_verbose)
1490  printf("Loading parameters for suite %s from %s\n", localSuite, tmpStr);
1491  clo_readFile(list, tmpStr);
1492  suiteLoaded = 1;
1493  }
1494  }
1495 
1496  // load sensor suite file
1497  sprintf(tmpStr, "%s/%s/%s_defaults_%s.par", dataRoot,
1498  sensorId2SensorDir(l1file->sensorID), l2genProgName, localSuite);
1499  if (access(tmpStr, R_OK) != -1) {
1500  if (want_verbose)
1501  printf("Loading parameters for suite %s from %s\n", localSuite, tmpStr);
1502  clo_readFile(list, tmpStr);
1503  suiteLoaded = 1;
1504  }
1505 
1506  // load sensor suite file for other program
1507  if(otherProgName) {
1508  sprintf(tmpStr, "%s/%s/%s_defaults_%s.par", dataRoot,
1509  sensorId2SensorDir(l1file->sensorID), otherProgName, localSuite);
1510  if (access(tmpStr, R_OK) != -1) {
1511  if (want_verbose)
1512  printf("Loading parameters for suite %s from %s\n", localSuite, tmpStr);
1513  clo_readFile(list, tmpStr);
1514  suiteLoaded = 1;
1515  }
1516  }
1517 
1518  // load subsensor suite file
1519  if(l1file->subsensorID >= 0) {
1520  sprintf(tmpStr, "%s/%s/%s/%s_defaults_%s.par", dataRoot,
1521  sensorId2SensorDir(l1file->sensorID),
1522  subsensorId2SubsensorDir(l1file->subsensorID), l2genProgName, localSuite);
1523  if (access(tmpStr, R_OK) != -1) {
1524  if (want_verbose)
1525  printf("Loading parameters for suite %s from %s\n", localSuite, tmpStr);
1526  clo_readFile(list, tmpStr);
1527  suiteLoaded = 1;
1528  }
1529 
1530  // load subsensor suite file for other program
1531  if(otherProgName) {
1532  sprintf(tmpStr, "%s/%s/%s/%s_defaults_%s.par", dataRoot,
1533  sensorId2SensorDir(l1file->sensorID),
1534  subsensorId2SubsensorDir(l1file->subsensorID), otherProgName, localSuite);
1535  if (access(tmpStr, R_OK) != -1) {
1536  if (want_verbose)
1537  printf("Loading parameters for suite %s from %s\n", localSuite, tmpStr);
1538  clo_readFile(list, tmpStr);
1539  suiteLoaded = 1;
1540  }
1541  }
1542  }
1543 
1544  if(!suiteLoaded) {
1545  printf("-E- Failed to load parameters for suite %s for sensor %s\n", localSuite,
1546  sensorId2SensorName(l1file->sensorID));
1547  exit(EXIT_FAILURE);
1548  }
1549 
1550  // set the default l2prod lists before the command line or par file
1551  // is loaded
1552  option = clo_findOption(list, "l2prod");
1553  if (option && clo_isOptionSet(option))
1554  strcpy(default_l2prod[0], option->valStr);
1555  for (i = 0; i < MAX_OFILES; i++) {
1556  sprintf(tmpStr, "l2prod%d", i + 1);
1557  option = clo_findOption(list, tmpStr);
1558  if (option && clo_isOptionSet(option))
1559  strcpy(default_l2prod[i], option->valStr);
1560  else
1561  default_l2prod[i][0] = '\0';
1562  }
1563 
1564  // re-load the command line and par file
1565  if (want_verbose)
1566  printf("Loading command line parameters\n\n");
1567  // enable the dump option the last time through
1569  clo_readArgs(list, argc, argv);
1570 
1571  return 0;
1572 }
1573 
1574 //-----------------------------------------------------------------------------
1575 
1577  char str_buf[FILENAME_MAX];
1578  char str_buf2[FILENAME_MAX];
1579  char tmp_file[FILENAME_MAX];
1580  char *strVal;
1581  clo_option_t *option;
1582  int numOptions;
1583  int optionId;
1584  char keyword[FILENAME_MAX];
1585  int count;
1586  char **strArray;
1587  float *fArray;
1588  int *iArray;
1589  int i, j;
1590  FILE *fp;
1591  const char* tmpStr;
1592 
1593 
1594  // first load up the default_l2prod
1595  for (i = 0; i < MAX_OFILES; i++) {
1596  if (default_l2prod[i][0]) {
1597  strcpy(input->def_l2prod[i], default_l2prod[i]);
1598  }
1599  }
1600 
1601  /* allocate and initialize dynamic arrays in input struc */
1602 
1604 
1605  numOptions = clo_getNumOptions(list);
1606  for (optionId = 0; optionId < numOptions; optionId++) {
1607  option = clo_getOption(list, optionId);
1608 
1609  // ignore options of type CLO_TYPE_HELP
1610  if (option->dataType == CLO_TYPE_HELP)
1611  continue;
1612 
1613  strcpy(keyword, option->key);
1614 
1615  /* change keyword to lower case */
1616  strVal = keyword;
1617  while (*strVal != '\0') {
1618  *strVal = tolower(*strVal);
1619  strVal++;
1620  }
1621 
1622  if (strcmp(keyword, "help") == 0)
1623  ;
1624  else if (strcmp(keyword, "version") == 0)
1625  ;
1626  else if (strncmp(keyword, "dump_options", 12) == 0)
1627  ;
1628  else if (strcmp(keyword, "par") == 0)
1629  ;
1630  else if (strcmp(keyword, "ifile") == 0) {
1631  strVal = clo_getOptionString(option);
1632  parse_file_name(strVal, tmp_file);
1633  strcpy(input->ifile[0], tmp_file);
1634 
1635  } else if (strncmp(keyword, "ifile", 5) == 0) {
1636  for (i = 1; i < MAX_IFILES; i++) {
1637  sprintf(str_buf, "ifile%d", i + 1);
1638  if (strcmp(keyword, str_buf) == 0) {
1639  if (i == 0)
1640  break;
1641  strVal = clo_getOptionString(option);
1642  parse_file_name(strVal, tmp_file);
1643  strcpy(input->ifile[i], tmp_file);
1644  break;
1645  }
1646  }
1647  if (i >= MAX_IFILES) {
1648  printf("-E- l2gen_load_input: %s bigger than MAX_IFILES(%d)\n",
1649  keyword, MAX_IFILES);
1650  return -1;
1651  }
1652 
1653  } else if (strcmp(keyword, "ilist") == 0) {
1654  if (clo_isOptionSet(option)) {
1655  strVal = clo_getOptionString(option);
1656  parse_file_name(strVal, tmp_file);
1657  if ((fp = fopen(tmp_file, "r")) == NULL) {
1658  printf("Error: Unable to open input file list %s\n", tmp_file);
1659  return -1;
1660  }
1661  tmp_file[0] = '\x0';
1662  for (i = 0; i < MAX_IFILES; i++) {
1663  if (fscanf(fp, "%s\n", tmp_file) != EOF) {
1664  strcpy((input->ifile)[i], tmp_file);
1665  sprintf(str_buf, "ifile%d", i + 1);
1666  sprintf(str_buf2, "ilist=%s", strVal);
1667  clo_setString(list, str_buf, tmp_file, str_buf2);
1668  } else
1669  break;
1670  }
1671  fclose(fp);
1672  }
1673 
1674  } else if (strcmp(keyword, "fqfile") == 0) {
1675  if (clo_isOptionSet(option)) {
1676  strVal = clo_getOptionString(option);
1677  parse_file_name(strVal, tmp_file);
1678  strcpy(input->fqfile, tmp_file);
1679  }
1680  } else if (strcmp(keyword, "parfile") == 0) {
1681  if (clo_isOptionSet(option)) {
1682  strVal = clo_getOptionString(option);
1683  parse_file_name(strVal, tmp_file);
1684  strcpy(input->parfile, tmp_file);
1685  }
1686  } else if (strcmp(keyword, "ofile") == 0) {
1687  strVal = clo_getOptionString(option);
1688  parse_file_name(strVal, tmp_file);
1689  strcpy(input->ofile[0], tmp_file);
1690 
1691  } else if (strncmp(keyword, "ofile", 5) == 0) {
1692  for (i = 1; i < MAX_OFILES; i++) {
1693  sprintf(str_buf, "ofile%d", i + 1);
1694  if (strcmp(keyword, str_buf) == 0) {
1695  strVal = clo_getOptionString(option);
1696  parse_file_name(strVal, tmp_file);
1697  strcpy(input->ofile[i], tmp_file);
1698  break;
1699  }
1700  }
1701  if (i >= MAX_OFILES) {
1702  printf("-E- l2gen_load_input: %s bigger than MAX_OFILES(%d)\n",
1703  keyword, MAX_OFILES);
1704  return -1;
1705  }
1706 
1707  } else if (strcmp(keyword, "oformat") == 0) {
1708  strVal = clo_getOptionString(option);
1709  tmpStr = getFileFormatName(strVal);
1710  if (tmpStr == NULL) {
1711  printf("-E- l2gen_load_input: oformat=%s is not a recognized file format\n",
1712  strVal);
1713  return -1;
1714  }
1715  strcpy(input->oformat, tmpStr);
1716 
1717  } else if (strcmp(keyword, "oformat_depth") == 0) {
1718  strVal = clo_getOptionString(option);
1719  if (strcasecmp(strVal, "8bit") == 0 || strcasecmp(strVal, "24bit") == 0) {
1720  strcpy(input->oformat_depth, strVal);
1721  } else {
1722  printf("-E- l2gen_load_input: oformat_depth=%s is not a valid color depth\n",
1723  strVal);
1724  return -1;
1725  }
1726 
1727  } else if (strcmp(keyword, "il2file") == 0) {
1728  if (clo_isOptionSet(option)) {
1729  strVal = clo_getOptionString(option);
1730  parse_file_name(strVal, tmp_file);
1731  strcpy(input->il2file[0], tmp_file);
1732  }
1733 
1734  } else if (strncmp(keyword, "il2file", 7) == 0) {
1735  for (i = 1; i < MAX_OFILES; i++) {
1736  sprintf(str_buf, "il2file%d", i + 1);
1737  if (strcmp(keyword, str_buf) == 0) {
1738  if (i == 0)
1739  break;
1740  strVal = clo_getOptionString(option);
1741  parse_file_name(strVal, tmp_file);
1742  strcpy(input->il2file[i], tmp_file);
1743  break;
1744  }
1745  }
1746  if (i >= MAX_OFILES) {
1747  printf("-E- l2gen_load_input: %s bigger than MAX_OFILES(%d)\n",
1748  keyword, MAX_OFILES);
1749  return -1;
1750  }
1751 
1752  } else if (strcmp(keyword, "l2prod") == 0) {
1753  strArray = clo_getOptionStrings(option, &count);
1754  input->l2prod[0][0] = '\0';
1755  for (i = 0; i < count; i++) {
1756  if (i != 0)
1757  strcat(input->l2prod[0], " ");
1758  strcat(input->l2prod[0], strArray[i]);
1759  }
1760 
1761  } else if (strncmp(keyword, "l2prod", 6) == 0) {
1762  for (i = 1; i < MAX_OFILES; i++) {
1763  sprintf(str_buf, "l2prod%d", i + 1);
1764  if (strcmp(keyword, str_buf) == 0) {
1765  if (i == 0)
1766  break;
1767  strArray = clo_getOptionStrings(option, &count);
1768  input->l2prod[i][0] = '\0';
1769  for (j = 0; j < count; j++) {
1770  if (j != 0)
1771  strcat(input->l2prod[i], " ");
1772  strcat(input->l2prod[i], strArray[j]);
1773  }
1774  break;
1775  }
1776  }
1777  if (i >= MAX_OFILES) {
1778  printf("-E- l2gen_load_input: %s bigger than MAX_OFILES(%d)\n",
1779  keyword, MAX_OFILES);
1780  return -1;
1781  }
1782 
1783  } else if (strcmp(keyword, "suite") == 0) {
1784  strcpy(input->suite, clo_getOptionString(option));
1785 
1786  } else if (strcmp(keyword, "mode") == 0) {
1787  input->mode = clo_getOptionInt(option);
1788 
1789  } else if (strcmp(keyword, "deflate") == 0) {
1790  input->deflate = clo_getOptionInt(option);
1791 
1792  } else if (strcmp(keyword, "ctl_pt_incr") == 0) {
1793  input->ctl_pt_incr = clo_getOptionInt(option);
1794 
1795  } else if (strcmp(keyword, "proc_ocean") == 0) {
1796  input->proc_ocean = clo_getOptionInt(option);
1797 
1798  } else if (strcmp(keyword, "proc_land") == 0) {
1799  input->proc_land = clo_getOptionBool(option);
1800 
1801  } else if (strcmp(keyword, "proc_cloud") == 0) {
1802  input->proc_cloud = clo_getOptionBool(option);
1803 
1804  } else if (strcmp(keyword, "proc_sst") == 0) {
1805  input->proc_sst = clo_getOptionBool(option);
1806  if(input->proc_sst) {
1807  input->fctl.nscan = MAX(input->fctl.nscan, 5);
1808  }
1809 
1810  } else if (strcmp(keyword, "atmocor") == 0) {
1811  input->atmocor = clo_getOptionBool(option);
1812 
1813  } else if (strcmp(keyword, "aer_opt") == 0) {
1814  input->aer_opt = clo_getOptionInt(option);
1815 
1816  } else if (strcmp(keyword, "aer_wave_short") == 0) {
1817  input->aer_wave_short = clo_getOptionInt(option);
1818 
1819  } else if (strcmp(keyword, "aer_wave_long") == 0) {
1820  input->aer_wave_long = clo_getOptionInt(option);
1821 
1822  } else if (strcmp(keyword, "aer_swir_short") == 0) {
1823  input->aer_swir_short = clo_getOptionInt(option);
1824 
1825  } else if (strcmp(keyword, "aer_swir_long") == 0) {
1826  input->aer_swir_long = clo_getOptionInt(option);
1827 
1828  } else if (strcmp(keyword, "aer_rrs_short") == 0) {
1829  input->aer_rrs_short = clo_getOptionFloat(option);
1830 
1831  } else if (strcmp(keyword, "aer_rrs_long") == 0) {
1832  input->aer_rrs_long = clo_getOptionFloat(option);
1833 
1834  } else if (strcmp(keyword, "aer_angstrom") == 0) {
1835  input->aer_angstrom = clo_getOptionFloat(option);
1836 
1837  } else if (strcmp(keyword, "aer_iter_max") == 0) {
1838  input->aer_iter_max = clo_getOptionInt(option);
1839 
1840  } else if (strcmp(keyword, "seawater_opt") == 0) {
1841  input->seawater_opt = clo_getOptionInt(option);
1842 
1843  } else if (strcmp(keyword, "brdf_opt") == 0) {
1844  input->brdf_opt = clo_getOptionInt(option);
1845 
1846  } else if (strcmp(keyword, "gas_opt") == 0) {
1847  input->gas_opt = clo_getOptionInt(option);
1848 
1849  } else if (strcmp(keyword, "atrem_opt") == 0) {
1850  input->atrem_opt = clo_getOptionInt(option);
1851 
1852  } else if (strcmp(keyword, "atrem_full") == 0) {
1853  input->atrem_full = clo_getOptionInt(option);
1854  if (option->count > 0) {
1855  if (input->atrem_full <= 0) input->atrem_full = 0;
1856  else input->atrem_full = 1;
1857  }
1858 
1859  } else if (strcmp(keyword, "atrem_geom") == 0) {
1860  input->atrem_geom = clo_getOptionInt(option);
1861  if (option->count > 0) {
1862  if (input->atrem_geom <= 0) input->atrem_geom = 0;
1863  else input->atrem_geom = 1;
1864  }
1865 
1866  } else if (strcmp(keyword, "atrem_model") == 0) {
1867  input->atrem_model = clo_getOptionInt(option);
1868 
1869  } else if (strcmp(keyword, "atrem_splitpaths") == 0) {
1870  input->atrem_splitpaths = clo_getOptionInt(option);
1871 
1872  } else if (strcmp(keyword, "gsm_opt") == 0) {
1873  input->gsm_opt = clo_getOptionInt(option);
1874 
1875  } else if (strcmp(keyword, "gsm_fit") == 0) {
1876  input->gsm_fit = clo_getOptionInt(option);
1877 
1878  } else if (strcmp(keyword, "gsm_adg_s") == 0) {
1879  input->gsm_adg_s = clo_getOptionFloat(option);
1880 
1881  } else if (strcmp(keyword, "gsm_bbp_s") == 0) {
1882  input->gsm_bbp_s = clo_getOptionFloat(option);
1883 
1884  } else if (strcmp(keyword, "gsm_aphs") == 0) {
1885  fArray = clo_getOptionFloats(option, &count);
1886  if (count > nbands) {
1887  printf("-E- number of gsm_aphs elements (%d) must be %d or less\n", count, nbands);
1888  exit(1);
1889  }
1890 
1891  for (i = 0; i < count; i++)
1892  input->gsm_aphs[i] = fArray[i];
1893 
1894  } else if (strcmp(keyword, "gsm_aphw") == 0) {
1895  fArray = clo_getOptionFloats(option, &count);
1896  if (count > nbands) {
1897  printf("-E- number of gsm_aphw elements (%d) must be %d or less\n", count, nbands);
1898  exit(1);
1899  }
1900 
1901  for (i = 0; i < count; i++)
1902  input->gsm_aphw[i] = fArray[i];
1903 
1904  } else if (strcmp(keyword, "qaa_adg_s") == 0) {
1905  input->qaa_adg_s = clo_getOptionFloat(option);
1906 
1907  } else if (strcmp(keyword, "qaa_wave") == 0) {
1908  if (clo_isOptionSet(option)) {
1909  iArray = clo_getOptionInts(option, &count);
1910  if (count != 5) {
1911  printf("-E- number of qaa_wave elements must be 5.\n");
1912  exit(1);
1913  }
1914 
1915  for (i = 0; i < count; i++)
1916  input->qaa_wave[i] = iArray[i];
1917  }
1918 
1919  } else if (strcmp(keyword, "giop_maxiter") == 0) {
1920  input->giop_maxiter = clo_getOptionInt(option);
1921 
1922  } else if (strcmp(keyword, "giop_fit_opt") == 0) {
1923  input->giop_fit_opt = clo_getOptionInt(option);
1924 
1925  } else if (strcmp(keyword, "giop_aph_opt") == 0) {
1926  input->giop_aph_opt = clo_getOptionInt(option);
1927 
1928  } else if (strcmp(keyword, "giop_adg_opt") == 0) {
1929  input->giop_adg_opt = clo_getOptionInt(option);
1930 
1931  } else if (strcmp(keyword, "giop_acdom_opt") == 0) {
1932  input->giop_acdom_opt = clo_getOptionInt(option);
1933 
1934  } else if (strcmp(keyword, "giop_anap_opt") == 0) {
1935  input->giop_anap_opt = clo_getOptionInt(option);
1936 
1937  } else if (strcmp(keyword, "giop_bbp_opt") == 0) {
1938  input->giop_bbp_opt = clo_getOptionInt(option);
1939 
1940  } else if (strcmp(keyword, "giop_bbph_opt") == 0) {
1941  input->giop_bbph_opt = clo_getOptionInt(option);
1942 
1943  } else if (strcmp(keyword, "giop_bbnap_opt") == 0) {
1944  input->giop_bbnap_opt = clo_getOptionInt(option);
1945 
1946  } else if (strcmp(keyword, "giop_rrs_opt") == 0) {
1947  input->giop_rrs_opt = clo_getOptionInt(option);
1948 
1949  } else if (strcmp(keyword, "giop_rrs_diff") == 0) {
1950  input->giop_rrs_diff = clo_getOptionFloat(option);
1951 
1952  } else if (strcmp(keyword, "giop_aph_file") == 0) {
1953  strVal = clo_getOptionString(option);
1954  parse_file_name(strVal, tmp_file);
1955  strcpy(input->giop_aph_file, tmp_file);
1956 
1957  } else if (strcmp(keyword, "giop_aph_s") == 0) {
1958  input->giop_aph_s = clo_getOptionFloat(option);
1959 
1960  } else if (strcmp(keyword, "giop_adg_file") == 0) {
1961  strVal = clo_getOptionString(option);
1962  parse_file_name(strVal, tmp_file);
1963  strcpy(input->giop_adg_file, tmp_file);
1964 
1965  } else if (strcmp(keyword, "giop_adg_s") == 0) {
1966  input->giop_adg_s = clo_getOptionFloat(option);
1967 
1968  } else if (strcmp(keyword, "giop_bbp_file") == 0) {
1969  strVal = clo_getOptionString(option);
1970  parse_file_name(strVal, tmp_file);
1971  strcpy(input->giop_bbp_file, tmp_file);
1972 
1973  } else if (strcmp(keyword, "giop_bbp_s") == 0) {
1974  input->giop_bbp_s = clo_getOptionFloat(option);
1975 
1976  } else if (strcmp(keyword, "giop_acdom_file") == 0) {
1977  if (clo_isOptionSet(option)) {
1978  strVal = clo_getOptionString(option);
1979  parse_file_name(strVal, tmp_file);
1980  strcpy(input->giop_acdom_file, tmp_file);
1981  }
1982 
1983  } else if (strcmp(keyword, "giop_anap_file") == 0) {
1984  if (clo_isOptionSet(option)) {
1985  strVal = clo_getOptionString(option);
1986  parse_file_name(strVal, tmp_file);
1987  strcpy(input->giop_anap_file, tmp_file);
1988  }
1989 
1990  } else if (strcmp(keyword, "giop_bbph_file") == 0) {
1991  if (clo_isOptionSet(option)) {
1992  strVal = clo_getOptionString(option);
1993  parse_file_name(strVal, tmp_file);
1994  strcpy(input->giop_bbph_file, tmp_file);
1995  }
1996 
1997  } else if (strcmp(keyword, "giop_bbnap_file") == 0) {
1998  if (clo_isOptionSet(option)) {
1999  strVal = clo_getOptionString(option);
2000  parse_file_name(strVal, tmp_file);
2001  strcpy(input->giop_bbnap_file, tmp_file);
2002  }
2003 
2004  } else if (strcmp(keyword, "giop_grd") == 0) {
2005  fArray = clo_getOptionFloats(option, &count);
2006  if (count > 2) {
2007  printf("-E- number of giop_grd elements must be 2 or less.\n");
2008  exit(1);
2009  }
2010  for (i = 0; i < count; i++)
2011  input->giop_grd[i] = fArray[i];
2012 
2013  } else if (strcmp(keyword, "giop_wave") == 0) {
2014  if (clo_isOptionSet(option)) {
2015  fArray = clo_getOptionFloats(option, &count);
2016  if (count > nbands) {
2017  printf("-E- number of giop_wave elements (%d) must be %d or less\n", count, nbands);
2018  exit(1);
2019  }
2020 
2021  for (i = 0; i < count; i++)
2022  input->giop_wave[i] = fArray[i];
2023  }
2024 
2025 
2026  } else if (strcmp(keyword, "giop_rrs_unc") == 0) {
2027  if (clo_isOptionSet(option)) {
2028  fArray = clo_getOptionFloats(option, &count);
2029  if (count > nbands) {
2030  printf("-E- number of giop_rrs_unc elements (%d) must be %d or less\n", count, nbands);
2031  exit(1);
2032  }
2033 
2034  for (i = 0; i < count; i++)
2035  input->giop_rrs_unc[i] = fArray[i];
2036  }
2037 
2038  } else if (strcmp(keyword, "iop_opt") == 0) {
2039  input->iop_opt = clo_getOptionInt(option);
2040 
2041  } else if (strcmp(keyword, "cphyt_opt") == 0) {
2042  input->cphyt_opt = clo_getOptionInt(option);
2043 
2044  }else if (strcmp(keyword, "band_shift_opt") == 0) {
2045  input->band_shift_opt = clo_getOptionInt(option);
2046  } else if (strcmp(keyword, "add_ws_noise") == 0) {
2047  input->add_ws_noise = clo_getOptionFloat(option);
2048  } else if (strcmp(keyword, "add_wd_noise") == 0) {
2049  input->add_wd_noise = clo_getOptionFloat(option);
2050  } else if (strcmp(keyword, "add_mw_noise") == 0) {
2051  input->add_mw_noise = clo_getOptionFloat(option);
2052  } else if (strcmp(keyword, "add_zw_noise") == 0) {
2053  input->add_zw_noise = clo_getOptionFloat(option);
2054  } else if (strcmp(keyword, "add_pr_noise") == 0) {
2055  input->add_pr_noise = clo_getOptionFloat(option);
2056  } else if (strcmp(keyword, "add_rh_noise") == 0) {
2057  input->add_rh_noise = clo_getOptionFloat(option);
2058  } else if (strcmp(keyword, "add_wv_noise") == 0) {
2059  input->add_wv_noise = clo_getOptionFloat(option);
2060  } else if (strcmp(keyword, "add_oz_noise") == 0) {
2061  input->add_oz_noise = clo_getOptionFloat(option);
2062  } else if (strcmp(keyword, "add_no2_strat_noise") == 0) {
2063  input->add_no2_strat_noise = clo_getOptionFloat(option);
2064  } else if (strcmp(keyword, "add_no2_tropo_noise") == 0) {
2065  input->add_no2_tropo_noise = clo_getOptionFloat(option);
2066  } else if (strcmp(keyword, "add_lt_noise") == 0) {
2067  input->add_lt_noise = clo_getOptionFloat(option);
2068  } else if (strcmp(keyword, "lt_noise_scale") == 0) {
2069  if (clo_isOptionSet(option)) {
2070  fArray = clo_getOptionFloats(option, &count);
2071  if (count > nbands) {
2072  printf("-E- number of lt_noise_scale elements (%d) must be %d or less\n", count, nbands);
2073  exit(1);
2074  }
2075  for (i = 0; i < count; i++)
2076  input->lt_noise_scale[i] = fArray[i];
2077  numNoiseScales = count;
2078  }
2079  } else if (strcmp(keyword, "bias_frac") == 0) {
2080  if (clo_isOptionSet(option)) {
2081  fArray = clo_getOptionFloats(option, &count);
2082  if (count > nbands) {
2083  printf("-E- number of bias_frac elements (%d) must be %d or less\n", count, nbands);
2084  exit(1);
2085  }
2086  for (i = 0; i < count; i++)
2087  input->bias_frac[i] = fArray[i];
2088  numBiasFracs = count;
2089  }
2090  } else if (strcmp(keyword, "aermodfile") == 0) {
2091  if (clo_isOptionSet(option)) {
2092  strVal = clo_getOptionString(option);
2093  parse_file_name(strVal, tmp_file);
2094  strcpy(input->aermodfile, tmp_file);
2095  }
2096 
2097  } else if (strcmp(keyword, "polfile") == 0) {
2098  if (clo_isOptionSet(option)) {
2099  strVal = clo_getOptionString(option);
2100  parse_file_name(strVal, tmp_file);
2101  strcpy(input->polfile, tmp_file);
2102  }
2103 
2104  } else if (strcmp(keyword, "pol_opt") == 0) {
2105  input->pol_opt = clo_getOptionInt(option);
2106 
2107  } else if (strcmp(keyword, "absaer_opt") == 0) {
2108  input->absaer_opt = clo_getOptionInt(option);
2109 
2110  } else if (strcmp(keyword, "glint_opt") == 0) {
2111  input->glint_opt = clo_getOptionInt(option);
2112 
2113  } else if (strcmp(keyword, "cirrus_opt") == 0) {
2114  input->cirrus_opt = clo_getOptionBool(option);
2115 
2116  } else if (strcmp(keyword, "oxaband_opt") == 0) {
2117  input->oxaband_opt = clo_getOptionInt(option);
2118 
2119  } else if (strcmp(keyword, "filter_opt") == 0) {
2120  if (clo_isOptionSet(option))
2121  input->filter_opt = clo_getOptionBool(option);
2122 
2123  } else if (strcmp(keyword, "filter_file") == 0) {
2124  if (clo_isOptionSet(option)) {
2125  strVal = clo_getOptionString(option);
2126  parse_file_name(strVal, tmp_file);
2127  strcpy(input->filter_file, tmp_file);
2128  }
2129 
2130  } else if (strcmp(keyword, "tgtfile") == 0) {
2131  if (clo_isOptionSet(option)) {
2132  strVal = clo_getOptionString(option);
2133  parse_file_name(strVal, tmp_file);
2134  strcpy(input->tgtfile, tmp_file);
2135  }
2136 
2137  } else if (strcmp(keyword, "aerfile") == 0) {
2138  if (clo_isOptionSet(option)) {
2139  strVal = clo_getOptionString(option);
2140  parse_file_name(strVal, tmp_file);
2141  strcpy(input->aerfile, tmp_file);
2142  }
2143 
2144  } else if (strcmp(keyword, "sstcoeffile") == 0) {
2145  if (clo_isOptionSet(option)) {
2146  strVal = clo_getOptionString(option);
2147  parse_file_name(strVal, tmp_file);
2148  strcpy(input->sstcoeffile, tmp_file);
2149  }
2150 
2151  } else if (strcmp(keyword, "dsdicoeffile") == 0) {
2152  if (clo_isOptionSet(option)) {
2153  strVal = clo_getOptionString(option);
2154  parse_file_name(strVal, tmp_file);
2155  strcpy(input->dsdicoeffile, tmp_file);
2156  }
2157 
2158  } else if (strcmp(keyword, "sstssesfile") == 0) {
2159  if (clo_isOptionSet(option)) {
2160  strVal = clo_getOptionString(option);
2161  parse_file_name(strVal, tmp_file);
2162  strcpy(input->sstssesfile, tmp_file);
2163  }
2164 
2165  } else if (strcmp(keyword, "sst4coeffile") == 0) {
2166  if (clo_isOptionSet(option)) {
2167  strVal = clo_getOptionString(option);
2168  parse_file_name(strVal, tmp_file);
2169  strcpy(input->sst4coeffile, tmp_file);
2170  }
2171 
2172  } else if (strcmp(keyword, "sst4ssesfile") == 0) {
2173  if (clo_isOptionSet(option)) {
2174  strVal = clo_getOptionString(option);
2175  parse_file_name(strVal, tmp_file);
2176  strcpy(input->sst4ssesfile, tmp_file);
2177  }
2178 
2179  } else if (strcmp(keyword, "vcnnfile") == 0) {
2180  if (clo_isOptionSet(option)) {
2181  strVal = clo_getOptionString(option);
2182  parse_file_name(strVal, tmp_file);
2183  strcpy(input->vcnnfile, tmp_file);
2184  }
2185 
2186  } else if (strcmp(keyword, "picfile") == 0) {
2187  if (clo_isOptionSet(option)) {
2188  strVal = clo_getOptionString(option);
2189  parse_file_name(strVal, tmp_file);
2190  strcpy(input->picfile, tmp_file);
2191  }
2192 
2193  } else if (strcmp(keyword, "sst3coeffile") == 0) {
2194  if (clo_isOptionSet(option)) {
2195  strVal = clo_getOptionString(option);
2196  parse_file_name(strVal, tmp_file);
2197  strcpy(input->sst3coeffile, tmp_file);
2198  }
2199 
2200  } else if (strcmp(keyword, "sst3ssesfile") == 0) {
2201  if (clo_isOptionSet(option)) {
2202  strVal = clo_getOptionString(option);
2203  parse_file_name(strVal, tmp_file);
2204  strcpy(input->sst3ssesfile, tmp_file);
2205  }
2206 
2207  } else if (strcmp(keyword, "owtfile") == 0) {
2208  if (clo_isOptionSet(option)) {
2209  strVal = clo_getOptionString(option);
2210  parse_file_name(strVal, tmp_file);
2211  strcpy(input->owtfile, tmp_file);
2212  }
2213 
2214  } else if (strcmp(keyword, "owtchlerrfile") == 0) {
2215  if (clo_isOptionSet(option)) {
2216  strVal = clo_getOptionString(option);
2217  parse_file_name(strVal, tmp_file);
2218  strcpy(input->owtchlerrfile, tmp_file);
2219  }
2220 
2221  } else if (strcmp(keyword, "metafile") == 0) {
2222  if (clo_isOptionSet(option)) {
2223  strVal = clo_getOptionString(option);
2224  parse_file_name(strVal, tmp_file);
2225  strcpy(input->metafile, tmp_file);
2226  }
2227 
2228  } else if (strcmp(keyword, "aerbinfile") == 0) {
2229  if (clo_isOptionSet(option)) {
2230  strVal = clo_getOptionString(option);
2231  parse_file_name(strVal, tmp_file);
2232  strcpy(input->aerbinfile, tmp_file);
2233  }
2234 
2235  } else if (strcmp(keyword, "met1") == 0) {
2236  strVal = clo_getOptionString(option);
2237  parse_file_name(strVal, tmp_file);
2238  strcpy(input->met1, tmp_file);
2239 
2240  } else if (strcmp(keyword, "met2") == 0) {
2241  if (clo_isOptionSet(option)) {
2242  strVal = clo_getOptionString(option);
2243  parse_file_name(strVal, tmp_file);
2244  strcpy(input->met2, tmp_file);
2245  }
2246 
2247  } else if (strcmp(keyword, "met3") == 0) {
2248  if (clo_isOptionSet(option)) {
2249  strVal = clo_getOptionString(option);
2250  parse_file_name(strVal, tmp_file);
2251  strcpy(input->met3, tmp_file);
2252  }
2253 
2254  } else if (strcmp(keyword, "ozone1") == 0) {
2255  strVal = clo_getOptionString(option);
2256  parse_file_name(strVal, tmp_file);
2257  strcpy(input->ozone1, tmp_file);
2258 
2259  } else if (strcmp(keyword, "ozone2") == 0) {
2260  if (clo_isOptionSet(option)) {
2261  strVal = clo_getOptionString(option);
2262  parse_file_name(strVal, tmp_file);
2263  strcpy(input->ozone2, tmp_file);
2264  }
2265 
2266  } else if (strcmp(keyword, "ozone3") == 0) {
2267  if (clo_isOptionSet(option)) {
2268  strVal = clo_getOptionString(option);
2269  parse_file_name(strVal, tmp_file);
2270  strcpy(input->ozone3, tmp_file);
2271  }
2272 
2273  } else if (strcmp(keyword, "anc_profile1") == 0) {
2274  if (clo_isOptionSet(option)) {
2275  strVal = clo_getOptionString(option);
2276  parse_file_name(strVal, tmp_file);
2277  strcpy(input->anc_profile1, tmp_file);
2278  }
2279 
2280  } else if (strcmp(keyword, "anc_profile2") == 0) {
2281  if (clo_isOptionSet(option)) {
2282  strVal = clo_getOptionString(option);
2283  parse_file_name(strVal, tmp_file);
2284  strcpy(input->anc_profile2, tmp_file);
2285  }
2286 
2287  } else if (strcmp(keyword, "anc_profile3") == 0) {
2288  if (clo_isOptionSet(option)) {
2289  strVal = clo_getOptionString(option);
2290  parse_file_name(strVal, tmp_file);
2291  strcpy(input->anc_profile3, tmp_file);
2292  }
2293 
2294  } else if (strcmp(keyword, "anc_aerosol1") == 0) {
2295  if (clo_isOptionSet(option)) {
2296  strVal = clo_getOptionString(option);
2297  parse_file_name(strVal, tmp_file);
2298  strcpy(input->anc_aerosol1, tmp_file);
2299  }
2300 
2301  } else if (strcmp(keyword, "anc_aerosol2") == 0) {
2302  if (clo_isOptionSet(option)) {
2303  strVal = clo_getOptionString(option);
2304  parse_file_name(strVal, tmp_file);
2305  strcpy(input->anc_aerosol2, tmp_file);
2306  }
2307 
2308  } else if (strcmp(keyword, "anc_aerosol3") == 0) {
2309  if (clo_isOptionSet(option)) {
2310  strVal = clo_getOptionString(option);
2311  parse_file_name(strVal, tmp_file);
2312  strcpy(input->anc_aerosol3, tmp_file);
2313  }
2314 
2315  } else if (strcmp(keyword, "sfc_albedo") == 0) {
2316  if (clo_isOptionSet(option)) {
2317  strVal = clo_getOptionString(option);
2318  parse_file_name(strVal, tmp_file);
2319  strcpy(input->sfc_albedo, tmp_file);
2320  }
2321 
2322  } else if (strcmp(keyword, "anc_cor_file") == 0) {
2323  if (clo_isOptionSet(option)) {
2324  strVal = clo_getOptionString(option);
2325  parse_file_name(strVal, tmp_file);
2326  strcpy(input->anc_cor_file, tmp_file);
2327  }
2328 
2329  } else if (strcmp(keyword, "pixel_anc_file") == 0) {
2330  if (clo_isOptionSet(option)) {
2331  strVal = clo_getOptionString(option);
2332  parse_file_name(strVal, tmp_file);
2333  strcpy(input->pixel_anc_file, tmp_file);
2334  }
2335 
2336  } else if (strcmp(keyword, "land") == 0) {
2337  strVal = clo_getOptionString(option);
2338  parse_file_name(strVal, tmp_file);
2339  strcpy(input->land, tmp_file);
2340 
2341  } else if (strcmp(keyword, "water") == 0) {
2342  strVal = clo_getOptionString(option);
2343  parse_file_name(strVal, tmp_file);
2344  strcpy(input->water, tmp_file);
2345 
2346  } else if (strcmp(keyword, "demfile") == 0) {
2347  strVal = clo_getOptionString(option);
2348  parse_file_name(strVal, tmp_file);
2349  strcpy(input->demfile, tmp_file);
2350 
2351  } else if (strcmp(keyword, "dem_auxfile") == 0) {
2352  if (clo_isOptionSet(option)) {
2353  strVal = clo_getOptionString(option);
2354  parse_file_name(strVal, tmp_file);
2355  strcpy(input->dem_auxfile, tmp_file);
2356  }
2357 
2358  } else if (strcmp(keyword, "mldfile") == 0) {
2359  if (clo_isOptionSet(option)) {
2360  strVal = clo_getOptionString(option);
2361  parse_file_name(strVal, tmp_file);
2362  strcpy(input->mldfile, tmp_file);
2363  }
2364 
2365  } else if (strcmp(keyword, "icefile") == 0) {
2366  strVal = clo_getOptionString(option);
2367  parse_file_name(strVal, tmp_file);
2368  strcpy(input->icefile, tmp_file);
2369 
2370  } else if (strcmp(keyword, "sstfile") == 0) {
2371  strVal = clo_getOptionString(option);
2372  parse_file_name(strVal, tmp_file);
2373  strcpy(input->sstfile, tmp_file);
2374  } else if (strcmp(keyword, "sstreftype") == 0) {
2375  input->sstreftype = clo_getOptionInt(option);
2376 
2377  } else if (strcmp(keyword, "sssfile") == 0) {
2378  strVal = clo_getOptionString(option);
2379  parse_file_name(strVal, tmp_file);
2380  strcpy(input->sssfile, tmp_file);
2381 
2382  } else if (strcmp(keyword, "no2file") == 0) {
2383  strVal = clo_getOptionString(option);
2384  parse_file_name(strVal, tmp_file);
2385  strcpy(input->no2file, tmp_file);
2386 
2387  } else if (strcmp(keyword, "alphafile") == 0) {
2388  strVal = clo_getOptionString(option);
2389  parse_file_name(strVal, tmp_file);
2390  strcpy(input->alphafile, tmp_file);
2391 
2392  } else if (strcmp(keyword, "tauafile") == 0) {
2393  strVal = clo_getOptionString(option);
2394  parse_file_name(strVal, tmp_file);
2395  strcpy(input->tauafile, tmp_file);
2396 
2397  } else if (strcmp(keyword, "geofile") == 0) {
2398  if (clo_isOptionSet(option)) {
2399  strVal = clo_getOptionString(option);
2400  parse_file_name(strVal, tmp_file);
2401  strcpy(input->geofile, tmp_file);
2402  }
2403 
2404  } else if (strcmp(keyword, "owmcfile") == 0) {
2405  strVal = clo_getOptionString(option);
2406  parse_file_name(strVal, tmp_file);
2407  strcpy(input->owmcfile, tmp_file);
2408 
2409  } else if (strcmp(keyword, "prodxmlfile") == 0) {
2410  if (clo_isOptionSet(option)) {
2411  strVal = clo_getOptionString(option);
2412  parse_file_name(strVal, tmp_file);
2413  strcpy(input->prodXMLfile, tmp_file);
2414  }
2415 
2416  } else if (strcmp(keyword, "breflectfile") == 0) {
2417  if (clo_isOptionSet(option)) {
2418  strVal = clo_getOptionString(option);
2419  parse_file_name(strVal, tmp_file);
2420  strcpy(input->breflectfile, tmp_file);
2421  }
2422 
2423  } else if (strcmp(keyword, "gmpfile") == 0) {
2424  if (clo_isOptionSet(option)) {
2425  strVal = clo_getOptionString(option);
2426  parse_file_name(strVal, tmp_file);
2427  strcpy(input->gmpfile, tmp_file);
2428  }
2429 
2430  } else if (strcmp(keyword, "gain_unc") == 0) {
2431  if (clo_isOptionSet(option)) {
2432  fArray = clo_getOptionFloats(option, &count);
2433  if (count > nbands) {
2434  printf("-E- number of gain_unc elements (%d) must be %d or less\n", count, nbands);
2435  exit(1);
2436  }
2437 
2438 
2439  for (i = 0; i < count; i++)
2440  input->gain_unc[i] = fArray[i];
2441  numGainUncs = count;
2442  }
2443 
2444  } else if (strcmp(keyword, "flaguse") == 0) {
2445  strArray = clo_getOptionStrings(option, &count);
2446  input->flaguse[0] = '\0';
2447  for (i = 0; i < count; i++) {
2448  if (i != 0)
2449  strcat(input->flaguse, ",");
2450  strcat(input->flaguse, strArray[i]);
2451  }
2452 
2453  } else if (strcmp(keyword, "xcalbox") == 0) {
2454  input->xcalbox = clo_getOptionInt(option);
2455 
2456  } else if (strcmp(keyword, "xcalboxcenter") == 0) {
2457  iArray = clo_getOptionInts(option, &count);
2458  if (count > 2) {
2459  printf("-E- number of xcalboxcenter elements must be 2 or less\n");
2460  exit(1);
2461  }
2462  for (i = 0; i < count; i++)
2463  input->xcalboxcenter[i] = iArray[i];
2464 
2465  } else if (strcmp(keyword, "xcalpervalid") == 0) {
2466  input->xcalpervalid = clo_getOptionInt(option);
2467 
2468  } else if (strcmp(keyword, "xcalsubsmpl") == 0) {
2469  input->xcalsubsmpl = clo_getOptionInt(option);
2470 
2471  } else if (strcmp(keyword, "maxpointdist") == 0) {
2472  input->maxpointdist = clo_getOptionFloat(option);
2473 
2474  } else if (strcmp(keyword, "chlthreshold") == 0) {
2475  input->chlthreshold = clo_getOptionFloat(option);
2476 
2477  } else if (strcmp(keyword, "aotthreshold") == 0) {
2478  input->aotthreshold = clo_getOptionFloat(option);
2479 
2480  } else if (strcmp(keyword, "coccolith") == 0) {
2481  fArray = clo_getOptionFloats(option, &count);
2482  if (count > 8) {
2483  printf("-E- number of coccolith elements must be 8 or less\n");
2484  exit(1);
2485  }
2486  for (i = 0; i < count; i++)
2487  input->coccolith[i] = fArray[i];
2488 
2489  } else if (strcmp(keyword, "cirrus_thresh") == 0) {
2490  fArray = clo_getOptionFloats(option, &count);
2491  if (count > 2) {
2492  printf("-E- number of cirrus_thresh elements must be 2 or less\n");
2493  exit(1);
2494  }
2495  for (i = 0; i < count; i++)
2496  input->cirrus_thresh[i] = fArray[i];
2497 
2498  } else if (strcmp(keyword, "chloc2_wave") == 0) {
2499  iArray = clo_getOptionInts(option, &count);
2500  if (count > 2) {
2501  printf("-E- number of chloc2_wave elements must be 2 or less\n");
2502  exit(1);
2503  }
2504  for (i = 0; i < count; i++)
2505  input->chloc2w[i] = iArray[i];
2506 
2507  } else if (strcmp(keyword, "chloc2_coef") == 0) {
2508  fArray = clo_getOptionFloats(option, &count);
2509  if (count > 5) {
2510  printf("-E- number of chloc2_coef elements must be 5 or less\n");
2511  exit(1);
2512  }
2513  for (i = 0; i < count; i++)
2514  input->chloc2c[i] = fArray[i];
2515 
2516  } else if (strcmp(keyword, "chloc3_wave") == 0) {
2517  iArray = clo_getOptionInts(option, &count);
2518  if (count > 3) {
2519  printf("-E- number of chloc3_wave elements must be 3 or less\n");
2520  exit(1);
2521  }
2522  for (i = 0; i < count; i++)
2523  input->chloc3w[i] = iArray[i];
2524 
2525  } else if (strcmp(keyword, "chloc3_coef") == 0) {
2526  fArray = clo_getOptionFloats(option, &count);
2527  if (count > 5) {
2528  printf("-E- number of chloc3_coef elements must be 5 or less\n");
2529  exit(1);
2530  }
2531  for (i = 0; i < count; i++)
2532  input->chloc3c[i] = fArray[i];
2533 
2534  } else if (strcmp(keyword, "avw_coef") == 0) {
2535  fArray = clo_getOptionFloats(option, &count);
2536  if (count > 6) {
2537  printf("-E- number of avw_coef elements must be 6 or less\n");
2538  exit(1);
2539  }
2540  for (i = 0; i < count; i++)
2541  input->avw_coef[i] = fArray[i];
2542 
2543  } else if (strcmp(keyword, "chloc4_wave") == 0) {
2544  iArray = clo_getOptionInts(option, &count);
2545  if (count > 4) {
2546  printf("-E- number of chloc4_wave elements must be 4 or less\n");
2547  exit(1);
2548  }
2549  for (i = 0; i < count; i++)
2550  input->chloc4w[i] = iArray[i];
2551 
2552  } else if (strcmp(keyword, "chloc4_coef") == 0) {
2553  fArray = clo_getOptionFloats(option, &count);
2554  if (count > 5) {
2555  printf("-E- number of chloc4_coef elements must be 5 or less\n");
2556  exit(1);
2557  }
2558  for (i = 0; i < count; i++)
2559  input->chloc4c[i] = fArray[i];
2560 
2561  } else if (strcmp(keyword, "kd2_wave") == 0) {
2562  iArray = clo_getOptionInts(option, &count);
2563  if (count > 2) {
2564  printf("-E- number of kd2_wave elements must be 2 or less\n");
2565  exit(1);
2566  }
2567  for (i = 0; i < count; i++)
2568  input->kd2w[i] = iArray[i];
2569 
2570  } else if (strcmp(keyword, "kd2_coef") == 0) {
2571  fArray = clo_getOptionFloats(option, &count);
2572  if (count > 6) {
2573  printf("-E- number of kd2_coef elements must be 6 or less\n");
2574  exit(1);
2575  }
2576  for (i = 0; i < count; i++)
2577  input->kd2c[i] = fArray[i];
2578 
2579  } else if (strcmp(keyword, "flh_offset") == 0) {
2580  input->flh_offset = clo_getOptionFloat(option);
2581 
2582  } else if (strcmp(keyword, "aermodels") == 0) {
2583  strArray = clo_getOptionStrings(option, &count);
2584  if (count > MAXAERMOD) {
2585  printf("-E- number of aermodels must be %d or less\n",
2586  MAXAERMOD);
2587  exit(1);
2588  }
2589  for (i = 0; i < count; i++)
2590  strcpy(input->aermodels[i], strArray[i]);
2591  for (; i < MAXAERMOD; i++)
2592  input->aermodels[i][0] = '\0';
2593  input->naermodels = count;
2594 
2595  } else if (strcmp(keyword, "taua") == 0) {
2596  if (clo_isOptionSet(option)) {
2597  fArray = clo_getOptionFloats(option, &count);
2598  if (count > nbands) {
2599  printf("-E- number of taua elements (%d) must be %d or less\n", count, nbands);
2600  exit(1);
2601  }
2602 
2603  for (i = 0; i < count; i++)
2604  input->taua[i] = fArray[i];
2605  numTauas = count;
2606  }
2607 
2608  } else if (strcmp(keyword, "aermodrat") == 0) {
2609  input->aermodrat = clo_getOptionFloat(option);
2610 
2611  } else if (strcmp(keyword, "aermodmin") == 0) {
2612  input->aermodmin = clo_getOptionInt(option);
2613 
2614  } else if (strcmp(keyword, "aermodmax") == 0) {
2615  input->aermodmax = clo_getOptionInt(option);
2616 
2617  } else if (strcmp(keyword, "absaer") == 0) {
2618  input->absaer = clo_getOptionFloat(option);
2619 
2620  } else if (strcmp(keyword, "rhoamin") == 0) {
2621  input->rhoamin = clo_getOptionFloat(option);
2622 
2623  } else if (strcmp(keyword, "epsmin") == 0) {
2624  input->epsmin = clo_getOptionFloat(option);
2625 
2626  } else if (strcmp(keyword, "epsmax") == 0) {
2627  input->epsmax = clo_getOptionFloat(option);
2628 
2629  } else if (strcmp(keyword, "tauamax") == 0) {
2630  input->tauamax = clo_getOptionFloat(option);
2631 
2632  } else if (strcmp(keyword, "nlwmin") == 0) {
2633  input->nlwmin = clo_getOptionFloat(option);
2634 
2635  } else if (strcmp(keyword, "wsmax") == 0) {
2636  input->wsmax = clo_getOptionFloat(option);
2637 
2638  } else if (strcmp(keyword, "windspeed") == 0) {
2639  input->windspeed = clo_getOptionFloat(option);
2640 
2641  } else if (strcmp(keyword, "windangle") == 0) {
2642  input->windangle = clo_getOptionFloat(option);
2643 
2644  } else if (strcmp(keyword, "pressure") == 0) {
2645  input->pressure = clo_getOptionFloat(option);
2646 
2647  } else if (strcmp(keyword, "ozone") == 0) {
2648  input->ozone = clo_getOptionFloat(option);
2649 
2650  } else if (strcmp(keyword, "relhumid") == 0) {
2651  input->relhumid = clo_getOptionFloat(option);
2652 
2653  } else if (strcmp(keyword, "watervapor") == 0) {
2654  input->watervapor = clo_getOptionFloat(option);
2655 
2656  } else if (strcmp(keyword, "ice_threshold") == 0) {
2657  input->ice_threshold = clo_getOptionFloat(option);
2658 
2659  } else if (strcmp(keyword, "mumm_alpha") == 0) {
2660  input->mumm_alpha = clo_getOptionFloat(option);
2661 
2662  } else if (strcmp(keyword, "mumm_gamma") == 0) {
2663  input->mumm_gamma = clo_getOptionFloat(option);
2664 
2665  } else if (strcmp(keyword, "mumm_epsilon") == 0) {
2666  input->mumm_epsilon = clo_getOptionFloat(option);
2667 
2668 
2669  } else if (strcmp(keyword, "viirsnv7") == 0) {
2670  input->viirsnv7 = clo_getOptionInt(option);
2671 
2672  } else if (strcmp(keyword, "viirsnosisaf") == 0) {
2673  input->viirsnosisaf = clo_getOptionInt(option);
2674 
2675  } else if (strcmp(keyword, "sstrefdif") == 0) {
2676  input->sstrefdif = clo_getOptionFloat(option);
2677 
2678  } else if (strcmp(keyword, "vcal_opt") == 0) {
2679  input->vcal_opt = clo_getOptionInt(option);
2680 
2681  } else if (strcmp(keyword, "vcal_nlw") == 0) {
2682  if (clo_isOptionSet(option)) {
2683  fArray = clo_getOptionFloats(option, &count);
2684  if (count > nbands) {
2685  printf("-E- number of vcal_nlw elements (%d) must be %d or less\n", count, nbands);
2686  exit(1);
2687  }
2688 
2689  for (i = 0; i < count; i++)
2690  input->vcal_nLw[i] = fArray[i];
2691  if (input->vcal_opt < 0)
2692  input->vcal_opt = INVERSE_NLW;
2693  }
2694 
2695  } else if (strcmp(keyword, "vcal_lw") == 0) {
2696  if (clo_isOptionSet(option)) {
2697  fArray = clo_getOptionFloats(option, &count);
2698  if (count > nbands) {
2699  printf("-E- number of vcal_lw elements (%d) must be %d or less\n", count, nbands);
2700  exit(1);
2701  }
2702 
2703 
2704  for (i = 0; i < count; i++)
2705  input->vcal_Lw[i] = fArray[i];
2706  if (input->vcal_opt < 0)
2707  input->vcal_opt = INVERSE_LW;
2708  }
2709 
2710  } else if (strcmp(keyword, "vcal_chl") == 0) {
2711  input->vcal_chl = clo_getOptionFloat(option);
2712 
2713  } else if (strcmp(keyword, "vcal_solz") == 0) {
2714  input->vcal_solz = clo_getOptionFloat(option);
2715 
2716  } else if (strcmp(keyword, "vcal_depth") == 0) {
2717  input->vcal_depth = clo_getOptionFloat(option);
2718 
2719  } else if (strcmp(keyword, "vcal_min_nbin") == 0) {
2720  input->vcal_min_nbin = clo_getOptionInt(option);
2721 
2722  } else if (strcmp(keyword, "vcal_min_nscene") == 0) {
2723  input->vcal_min_nscene = clo_getOptionInt(option);
2724 
2725  } else if (strcmp(keyword, "stype") == 0) {
2726  input->stype = clo_getOptionInt(option);
2727 
2728  } else if (strcmp(keyword, "datamin") == 0) {
2729  input->datamin = clo_getOptionFloat(option);
2730 
2731  } else if (strcmp(keyword, "datamax") == 0) {
2732  input->datamax = clo_getOptionFloat(option);
2733 
2734  } else if (strcmp(keyword, "west") == 0) {
2735  input->west = clo_getOptionFloat(option);
2736 
2737  } else if (strcmp(keyword, "east") == 0) {
2738  input->east = clo_getOptionFloat(option);
2739 
2740  } else if (strcmp(keyword, "north") == 0) {
2741  input->north = clo_getOptionFloat(option);
2742 
2743  } else if (strcmp(keyword, "south") == 0) {
2744  input->south = clo_getOptionFloat(option);
2745 
2746  } else if (strcmp(keyword, "width") == 0) {
2747  input->width = clo_getOptionInt(option);
2748 
2749  } else if (strcmp(keyword, "threshold") == 0) {
2750  input->threshold = clo_getOptionFloat(option);
2751 
2752  } else if (strcmp(keyword, "rgb") == 0) {
2753  if (clo_isOptionSet(option)) {
2754  iArray = clo_getOptionInts(option, &count);
2755  if (count != 3) {
2756  printf("-E- number of rgb elements must be 3\n");
2757  exit(1);
2758  }
2759  for (i = 0; i < count; i++)
2760  input->rgb[i] = iArray[i];
2761  }
2762 
2763  } else if (strcmp(keyword, "subsamp") == 0) {
2764  input->subsamp = clo_getOptionInt(option);
2765 
2766  } else if (strcmp(keyword, "xbox") == 0) {
2767  input->xbox = clo_getOptionInt(option);
2768 
2769  } else if (strcmp(keyword, "ybox") == 0) {
2770  input->ybox = clo_getOptionInt(option);
2771 
2772  } else if (strcmp(keyword, "raman_opt") == 0) {
2773  input->raman_opt = clo_getOptionInt(option);
2774  } else if (strcmp(keyword, "water_spectra_file") == 0) {
2775  strVal = clo_getOptionString(option);
2776  parse_file_name(strVal, tmp_file);
2777  strcpy(input->water_spectra_file, tmp_file);
2778 
2779  } else if (strcmp(keyword, "bpar_validate_opt") == 0) {
2780  input->bpar_validate_opt = clo_getOptionInt(option);
2781 
2782  } else if (strcmp(keyword, "bpar_elev_opt") == 0) {
2783  input->bpar_elev_opt = clo_getOptionInt(option);
2784 
2785  } else if (strcmp(keyword, "bpar_elev_value") == 0) {
2786  input->bpar_elev_value = clo_getOptionFloat(option);
2787 
2788  } else if (strcmp(keyword, "cloud_hgt_file") == 0) {
2789  if (clo_isOptionSet(option)) {
2790  strVal = clo_getOptionString(option);
2791  parse_file_name(strVal, tmp_file);
2792  strcpy(input->cloud_hgt_file, tmp_file);
2793  }
2794  } else if (strcmp(keyword, "shallow_water_depth") == 0) {
2795  input->shallow_water_depth = clo_getOptionFloat(option);
2796 
2797  // silence errors for libl1 parameters
2798  } else if (strcmp(keyword, "pversion") == 0) {
2799  } else if (strcmp(keyword, "rad_opt") == 0) {
2800  } else if (strcmp(keyword, "viirscalparfile") == 0) {
2801  } else if (strcmp(keyword, "calfile") == 0) {
2802  } else if (strcmp(keyword, "geom_per_band") == 0) {
2803  } else if (strcmp(keyword, "xcalfile") == 0) {
2804  } else if (strcmp(keyword, "xcal_opt") == 0) {
2805  } else if (strcmp(keyword, "xcal_wave") == 0) {
2806  } else if (strcmp(keyword, "btfile") == 0) {
2807  } else if (strcmp(keyword, "resolution") == 0) {
2808  } else if (strcmp(keyword, "newavhrrcal") == 0) {
2809  } else if (strcmp(keyword, "ch22detcor") == 0) {
2810  } else if (strcmp(keyword, "ch23detcor") == 0) {
2811  } else if (strcmp(keyword, "sl_pixl") == 0) {
2812  } else if (strcmp(keyword, "sl_frac") == 0) {
2813  } else if (strcmp(keyword, "outband_opt") == 0) {
2814  } else if (strcmp(keyword, "eval") == 0) {
2815  } else if (strcmp(keyword, "maskland") == 0) {
2816  } else if (strcmp(keyword, "maskbath") == 0) {
2817  } else if (strcmp(keyword, "maskcloud") == 0) {
2818  } else if (strcmp(keyword, "maskglint") == 0) {
2819  } else if (strcmp(keyword, "masksunzen") == 0) {
2820  } else if (strcmp(keyword, "masksatzen") == 0) {
2821  } else if (strcmp(keyword, "maskhilt") == 0) {
2822  } else if (strcmp(keyword, "maskstlight") == 0) {
2823  } else if (strcmp(keyword, "sunzen") == 0) {
2824  } else if (strcmp(keyword, "satzen") == 0) {
2825  } else if (strcmp(keyword, "hipol") == 0) {
2826  } else if (strcmp(keyword, "glint_thresh") == 0) {
2827  } else if (strcmp(keyword, "cloud_thresh") == 0) {
2828  } else if (strcmp(keyword, "cloud_wave") == 0) {
2829  } else if (strcmp(keyword, "cloud_eps") == 0) {
2830  } else if (strcmp(keyword, "cloud_mask_file") == 0) {
2831  } else if (strcmp(keyword, "gain") == 0) {
2832  } else if (strcmp(keyword, "offset") == 0) {
2833  } else if (strcmp(keyword, "spixl") == 0) {
2834  } else if (strcmp(keyword, "epixl") == 0) {
2835  } else if (strcmp(keyword, "dpixl") == 0) {
2836  } else if (strcmp(keyword, "sline") == 0) {
2837  } else if (strcmp(keyword, "eline") == 0) {
2838  } else if (strcmp(keyword, "dline") == 0) {
2839  } else {
2840  printf("-E- Invalid argument \"%s\"\n", keyword);
2841  clo_dumpOption(option);
2842  exit(1);
2843  }
2844 
2845  } // for optionIDs
2846 
2847  return 0;
2848 }
2849 
2850 int msl12_option_input(int argc, char **argv, clo_optionList_t* list,
2851  char *progName, filehandle *l1file) {
2852  int i;
2853  char *tmp_str;
2854  char str_buf[FILENAME_MAX] = "";
2855 
2856  /* For reading sensor table */
2857  int32_t numBands;
2858 
2859  /* read the command line options, default, sensor, sub-sensor
2860  and suite par files. set elements of l1file */
2861  if (l2gen_read_options(list, progName, argc, argv, l1file) != 0) {
2862  printf("-E- %s: Error reading program options.\n", __FILE__);
2863  return (-1);
2864  }
2865 
2866  if (want_verbose)
2867  printf("Loading user parameters for %s\n\n", sensorId2SensorName(l1file->sensorID));
2868 
2869  /* */
2870  /* Now, loop through command arguments again and update input struct*/
2871  /* */
2872  strcpy(input->pro_control, basename(argv[0]));
2873  for (i = 1; i < argc; i++) {
2874  strcat(input->pro_control, " ");
2875  strcat(input->pro_control, argv[i]);
2876  }
2877 
2878 
2879  /* Make sure band-dependent inputs have values for all bands */
2880  numBands = rdsensorinfo(l1file->sensorID, 0, "Nbands", NULL);
2881 
2882  if (l2gen_load_input(list, input, numBands) != 0) {
2883  printf("-E- %s: Error loading options into input structure.\n", __FILE__);
2884  return (-1);
2885  }
2886 
2888 
2889  l1file->geofile = input->geofile;
2890  l1file->gmpfile = input->gmpfile;
2891 
2892  if ((tmp_str = getenv("OCDATAROOT")) == NULL) {
2893  printf("OCDATAROOT environment variable is not defined.\n");
2894  return (1);
2895  }
2896 
2897  if (want_verbose && (input->deflate > 0))
2898  printf("Internal data compression requested at compression level: %d\n", input->deflate);
2899 
2900  /* Load filter list, if filtering requested */
2901  if (input->filter_opt == 1) {
2902  if (input->filter_file[0] == '\0') {
2903  sprintf(input->filter_file, "%s/%s/%s_filter.dat", tmp_str,
2904  sensorId2SensorDir(l1file->sensorID), sensorId2SensorDir(l1file->sensorID));
2905  }
2906  rdfilter(input->filter_file, &(input->fctl), numBands);
2907  }
2908 
2909  if (numNoiseScales > 0 && numNoiseScales != numBands) {
2910  fprintf(stderr, "Parameter input error: Number of input gain uncertainties must equal %d.\n",
2911  numBands);
2912  return (-1);
2913  }
2914  if (numBiasFracs > 0 && numBiasFracs != numBands) {
2915  fprintf(stderr, "Parameter input error: Number of bias fractions must equal %d.\n",
2916  numBands);
2917  return (-1);
2918  }
2919  if (numGainUncs > 0 && numGainUncs != numBands) {
2920  fprintf(stderr, "Parameter input error: Number of input gain uncertainties must equal %d.\n",
2921  numBands);
2922  return (-1);
2923  }
2924  if (numTauas > 0 && numTauas != numBands) {
2925  fprintf(stderr, "Parameter input error: Number of input taua values must equal %d.\n",
2926  numBands);
2927  return (-1);
2928  }
2929 
2930 
2931  /* */
2932  /* Build string of input parameters for meta-data documentation */
2933  /* */
2934 
2935  strcat(l1_input->input_parms, "\n");
2936  for (i = 0; i < MAX_IFILES; i++) {
2937 
2938  if (input->ifile[i][0] != '\0') {
2939  if (i == 0)
2940  sprintf(str_buf, "ifile = %s ", input->ifile[i]);
2941  else
2942  sprintf(str_buf, "ifile%d = %s ", i + 1, input->ifile[i]);
2943  strcat(l1_input->input_parms, str_buf);
2944  strcat(l1_input->input_parms, "\n");
2945  } else break;
2946  }
2947 
2948  for (i = 0; i < MAX_OFILES; i++) {
2949 
2950  if (input->ofile[i][0] != '\0') {
2951  if (i == 0)
2952  sprintf(str_buf, "ofile = %s", input->ofile[i]);
2953  else
2954  sprintf(str_buf, "ofile%d = %s", i + 1, input->ofile[i]);
2955  strcat(l1_input->input_parms, str_buf);
2956  strcat(l1_input->input_parms, "\n");
2957  }
2958 
2959  if (input->l2prod[i][0] != '\0') {
2960  if (i == 0)
2961  sprintf(str_buf, "l2prod = %s", input->l2prod[i]);
2962  else
2963  sprintf(str_buf, "l2prod%d = %s", i + 1, input->l2prod[i]);
2964  strcat(l1_input->input_parms, str_buf);
2965  strcat(l1_input->input_parms, "\n");
2966  }
2967 
2968  if (input->mode != FORWARD && input->il2file[i][0] != '\0') {
2969  sprintf(str_buf, "il2file%d = %s", i + 1, input->il2file[i]);
2970  strcat(l1_input->input_parms, str_buf);
2971  strcat(l1_input->input_parms, "\n");
2972  }
2973 
2974  }
2975 
2976  sprintf(str_buf, "oformat = %s", input->oformat);
2977  strcat(l1_input->input_parms, str_buf);
2978  strcat(l1_input->input_parms, "\n");
2979 
2980  sprintf(str_buf, "oformat_depth = %s", input->oformat_depth);
2981  strcat(l1_input->input_parms, str_buf);
2982  strcat(l1_input->input_parms, "\n");
2983 
2984  sprintf(str_buf, "fqfile = %s", input->fqfile);
2985  strcat(l1_input->input_parms, str_buf);
2986  strcat(l1_input->input_parms, "\n");
2987 
2988  sprintf(str_buf, "parfile = %s", input->parfile);
2989  strcat(l1_input->input_parms, str_buf);
2990  strcat(l1_input->input_parms, "\n");
2991 
2992  sprintf(str_buf, "geofile = %s", input->geofile);
2993  strcat(l1_input->input_parms, str_buf);
2994  strcat(l1_input->input_parms, "\n");
2995 
2996  sprintf(str_buf, "gmpfile = %s", input->gmpfile);
2997  strcat(l1_input->input_parms, str_buf);
2998  strcat(l1_input->input_parms, "\n");
2999 
3000  sprintf(str_buf, "metafile = %s", input->metafile);
3001  strcat(l1_input->input_parms, str_buf);
3002  strcat(l1_input->input_parms, "\n");
3003 
3004  if (input->mode != FORWARD) {
3005 
3006  sprintf(str_buf, "flaguse = %s", input->flaguse);
3007  strcat(l1_input->input_parms, str_buf);
3008  strcat(l1_input->input_parms, "\n");
3009 
3010  sprintf(str_buf, "maxpointdist = %8.3f", input->maxpointdist);
3011  strcat(l1_input->input_parms, str_buf);
3012  strcat(l1_input->input_parms, "\n");
3013 
3014  sprintf(str_buf, "chlthreshold = %8.3f", input->chlthreshold);
3015  strcat(l1_input->input_parms, str_buf);
3016  strcat(l1_input->input_parms, "\n");
3017 
3018  sprintf(str_buf, "aotthreshold = %8.3f", input->aotthreshold);
3019  strcat(l1_input->input_parms, str_buf);
3020  strcat(l1_input->input_parms, "\n");
3021 
3022  sprintf(str_buf, "xcalbox = %d", (int) input->xcalbox);
3023  strcat(l1_input->input_parms, str_buf);
3024  strcat(l1_input->input_parms, "\n");
3025 
3026  sprintf(str_buf, "xcalboxcenter = %d, %d",
3027  (int) input->xcalboxcenter[0], (int) input->xcalboxcenter[1]);
3028  strcat(l1_input->input_parms, str_buf);
3029  strcat(l1_input->input_parms, "\n");
3030 
3031  sprintf(str_buf, "xcalpervalid = %d", (int) input->xcalpervalid);
3032  strcat(l1_input->input_parms, str_buf);
3033  strcat(l1_input->input_parms, "\n");
3034 
3035  sprintf(str_buf, "xcalsubsmpl = %d", (int) input->xcalsubsmpl);
3036  strcat(l1_input->input_parms, str_buf);
3037  strcat(l1_input->input_parms, "\n");
3038 
3039  }
3040 
3041  sprintf(str_buf, "suite = %s", input->suite);
3042  strcat(l1_input->input_parms, str_buf);
3043  strcat(l1_input->input_parms, "\n");
3044 
3045  sprintf(str_buf, "mode = %5d", input->mode);
3046  strcat(l1_input->input_parms, str_buf);
3047  strcat(l1_input->input_parms, "\n");
3048 
3049  sprintf(str_buf, "deflate = %5d", input->deflate);
3050  strcat(l1_input->input_parms, str_buf);
3051  strcat(l1_input->input_parms, "\n");
3052 
3053  sprintf(str_buf, "ctl_pt_incr = %5d", input->ctl_pt_incr);
3054  strcat(l1_input->input_parms, str_buf);
3055  strcat(l1_input->input_parms, "\n");
3056 
3057  sprintf(str_buf, "proc_ocean = %3d", input->proc_ocean);
3058  strcat(l1_input->input_parms, str_buf);
3059  strcat(l1_input->input_parms, "\n");
3060 
3061  sprintf(str_buf, "proc_land = %3d", input->proc_land);
3062  strcat(l1_input->input_parms, str_buf);
3063  strcat(l1_input->input_parms, "\n");
3064 
3065  sprintf(str_buf, "proc_cloud = %3d", input->proc_cloud);
3066  strcat(l1_input->input_parms, str_buf);
3067  strcat(l1_input->input_parms, "\n");
3068 
3069  sprintf(str_buf, "proc_sst = %3d", input->proc_sst);
3070  strcat(l1_input->input_parms, str_buf);
3071  strcat(l1_input->input_parms, "\n");
3072 
3073  sprintf(str_buf, "atmocor = %3d", input->atmocor);
3074  strcat(l1_input->input_parms, str_buf);
3075  strcat(l1_input->input_parms, "\n");
3076 
3077  sprintf(str_buf, "seawater_opt = %3d", input->seawater_opt);
3078  strcat(l1_input->input_parms, str_buf);
3079  strcat(l1_input->input_parms, "\n");
3080 
3081  sprintf(str_buf, "aermodfile = %s", input->aermodfile);
3082  strcat(l1_input->input_parms, str_buf);
3083  strcat(l1_input->input_parms, "\n");
3084 
3085  sprintf(str_buf, "aer_opt = %3d", input->aer_opt);
3086  strcat(l1_input->input_parms, str_buf);
3087  strcat(l1_input->input_parms, "\n");
3088 
3089  sprintf(str_buf, "aer_wave_short = %3d", input->aer_wave_short);
3090  strcat(l1_input->input_parms, str_buf);
3091  strcat(l1_input->input_parms, "\n");
3092 
3093  sprintf(str_buf, "aer_wave_long = %3d", input->aer_wave_long);
3094  strcat(l1_input->input_parms, str_buf);
3095  strcat(l1_input->input_parms, "\n");
3096 
3097  sprintf(str_buf, "aer_swir_short = %3d", input->aer_swir_short);
3098  strcat(l1_input->input_parms, str_buf);
3099  strcat(l1_input->input_parms, "\n");
3100 
3101  sprintf(str_buf, "aer_swir_long = %3d", input->aer_swir_long);
3102  strcat(l1_input->input_parms, str_buf);
3103  strcat(l1_input->input_parms, "\n");
3104 
3105  sprintf(str_buf, "aer_rrs_short = %8.5f", input->aer_rrs_short);
3106  strcat(l1_input->input_parms, str_buf);
3107  strcat(l1_input->input_parms, "\n");
3108 
3109  sprintf(str_buf, "aer_rrs_long = %8.5f", input->aer_rrs_long);
3110  strcat(l1_input->input_parms, str_buf);
3111  strcat(l1_input->input_parms, "\n");
3112 
3113  sprintf(str_buf, "aer_angstrom = %8.5f", input->aer_angstrom);
3114  strcat(l1_input->input_parms, str_buf);
3115  strcat(l1_input->input_parms, "\n");
3116 
3117  sprintf(str_buf, "aer_iter_max = %3d", input->aer_iter_max);
3118  strcat(l1_input->input_parms, str_buf);
3119  strcat(l1_input->input_parms, "\n");
3120 
3121  sprintf(str_buf, "brdf_opt = %3d", input->brdf_opt);
3122  strcat(l1_input->input_parms, str_buf);
3123  strcat(l1_input->input_parms, "\n");
3124 
3125  sprintf(str_buf, "gas_opt = %3d", input->gas_opt);
3126  strcat(l1_input->input_parms, str_buf);
3127  strcat(l1_input->input_parms, "\n");
3128 
3129  sprintf(str_buf, "atrem_opt = %3d", input->atrem_opt);
3130  strcat(l1_input->input_parms, str_buf);
3131  strcat(l1_input->input_parms, "\n");
3132 
3133  sprintf(str_buf, "atrem_full = %3d", input->atrem_full);
3134  strcat(l1_input->input_parms, str_buf);
3135  strcat(l1_input->input_parms, "\n");
3136 
3137  sprintf(str_buf, "atrem_geom = %3d", input->atrem_geom);
3138  strcat(l1_input->input_parms, str_buf);
3139  strcat(l1_input->input_parms, "\n");
3140 
3141  sprintf(str_buf, "atrem_model = %3d", input->atrem_model);
3142  strcat(l1_input->input_parms, str_buf);
3143  strcat(l1_input->input_parms, "\n");
3144 
3145  sprintf(str_buf, "atrem_splitpaths = %3d", input->atrem_splitpaths);
3146  strcat(l1_input->input_parms, str_buf);
3147  strcat(l1_input->input_parms, "\n");
3148 
3149  sprintf(str_buf, "iop_opt = %3d", input->iop_opt);
3150  strcat(l1_input->input_parms, str_buf);
3151  strcat(l1_input->input_parms, "\n");
3152 
3153  sprintf(str_buf, "cphyt_opt = %3d", input->cphyt_opt);
3154  strcat(l1_input->input_parms, str_buf);
3155  strcat(l1_input->input_parms, "\n");
3156 
3157  sprintf(str_buf, "gsm_opt = %3d", input->gsm_opt);
3158  strcat(l1_input->input_parms, str_buf);
3159  strcat(l1_input->input_parms, "\n");
3160 
3161  sprintf(str_buf, "gsm_fit = %3d", input->gsm_fit);
3162  strcat(l1_input->input_parms, str_buf);
3163  strcat(l1_input->input_parms, "\n");
3164 
3165  sprintf(str_buf, "gsm_adg_s = %8.5f", input->gsm_adg_s);
3166  strcat(l1_input->input_parms, str_buf);
3167  strcat(l1_input->input_parms, "\n");
3168 
3169  sprintf(str_buf, "gsm_bbp_s = %8.5f", input->gsm_bbp_s);
3170  strcat(l1_input->input_parms, str_buf);
3171  strcat(l1_input->input_parms, "\n");
3172 
3173  sprintf(str_buf, "gsm_aphw = %8.5f", input->gsm_aphw[0]);
3174  strcat(l1_input->input_parms, str_buf);
3175  for (i = 1; i < numBands; i++) {
3176  sprintf(str_buf, ", %8.5f", input->gsm_aphw[i]);
3177  strcat(l1_input->input_parms, str_buf);
3178  }
3179  strcat(l1_input->input_parms, "\n");
3180 
3181  sprintf(str_buf, "gsm_aphs = %8.5f", input->gsm_aphs[0]);
3182  strcat(l1_input->input_parms, str_buf);
3183  for (i = 1; i < numBands; i++) {
3184  sprintf(str_buf, ", %8.5f", input->gsm_aphs[i]);
3185  strcat(l1_input->input_parms, str_buf);
3186  }
3187  strcat(l1_input->input_parms, "\n");
3188  sprintf(str_buf, "qaa_adg_s = %8.5f", input->qaa_adg_s);
3189  strcat(l1_input->input_parms, str_buf);
3190  strcat(l1_input->input_parms, "\n");
3191 
3192  sprintf(str_buf, "qaa_wave = %4d", input->qaa_wave[0]);
3193  strcat(l1_input->input_parms, str_buf);
3194  for (i = 1; i < 5; i++) {
3195  sprintf(str_buf, ", %4d", input->qaa_wave[i]);
3196  strcat(l1_input->input_parms, str_buf);
3197  }
3198  strcat(l1_input->input_parms, "\n");
3199  sprintf(str_buf, "giop_maxiter = %3d", input->giop_maxiter);
3200  strcat(l1_input->input_parms, str_buf);
3201  strcat(l1_input->input_parms, "\n");
3202 
3203  sprintf(str_buf, "giop_fit_opt = %3d", input->giop_fit_opt);
3204  strcat(l1_input->input_parms, str_buf);
3205  strcat(l1_input->input_parms, "\n");
3206 
3207  sprintf(str_buf, "giop_aph_opt = %3d", input->giop_aph_opt);
3208  strcat(l1_input->input_parms, str_buf);
3209  strcat(l1_input->input_parms, "\n");
3210 
3211  sprintf(str_buf, "giop_acdom_opt = %3d", input->giop_acdom_opt);
3212  strcat(l1_input->input_parms, str_buf);
3213  strcat(l1_input->input_parms, "\n");
3214 
3215  sprintf(str_buf, "giop_anap_opt = %3d", input->giop_anap_opt);
3216  strcat(l1_input->input_parms, str_buf);
3217  strcat(l1_input->input_parms, "\n");
3218 
3219  sprintf(str_buf, "giop_adg_opt = %3d", input->giop_adg_opt);
3220  strcat(l1_input->input_parms, str_buf);
3221  strcat(l1_input->input_parms, "\n");
3222 
3223  sprintf(str_buf, "giop_bbp_opt = %3d", input->giop_bbp_opt);
3224  strcat(l1_input->input_parms, str_buf);
3225  strcat(l1_input->input_parms, "\n");
3226 
3227  sprintf(str_buf, "giop_bbnap_opt = %3d", input->giop_bbnap_opt);
3228  strcat(l1_input->input_parms, str_buf);
3229  strcat(l1_input->input_parms, "\n");
3230 
3231  sprintf(str_buf, "giop_bbph_opt = %3d", input->giop_bbph_opt);
3232  strcat(l1_input->input_parms, str_buf);
3233  strcat(l1_input->input_parms, "\n");
3234 
3235  sprintf(str_buf, "giop_rrs_opt = %3d", input->giop_rrs_opt);
3236  strcat(l1_input->input_parms, str_buf);
3237  strcat(l1_input->input_parms, "\n");
3238 
3239  sprintf(str_buf, "giop_rrs_diff = %8.5f", input->giop_rrs_diff);
3240  strcat(l1_input->input_parms, str_buf);
3241  strcat(l1_input->input_parms, "\n");
3242 
3243  sprintf(str_buf, "giop_aph_file = %s", input->giop_aph_file);
3244  strcat(l1_input->input_parms, str_buf);
3245  strcat(l1_input->input_parms, "\n");
3246 
3247  sprintf(str_buf, "giop_aph_s = %8.5f", input->giop_aph_s);
3248  strcat(l1_input->input_parms, str_buf);
3249  strcat(l1_input->input_parms, "\n");
3250 
3251  sprintf(str_buf, "giop_adg_file = %s", input->giop_adg_file);
3252  strcat(l1_input->input_parms, str_buf);
3253  strcat(l1_input->input_parms, "\n");
3254 
3255  sprintf(str_buf, "giop_adg_s = %8.5f", input->giop_adg_s);
3256  strcat(l1_input->input_parms, str_buf);
3257  strcat(l1_input->input_parms, "\n");
3258 
3259  sprintf(str_buf, "giop_bbp_file = %s", input->giop_bbp_file);
3260  strcat(l1_input->input_parms, str_buf);
3261  strcat(l1_input->input_parms, "\n");
3262 
3263  sprintf(str_buf, "giop_bbp_s = %8.5f", input->giop_bbp_s);
3264  strcat(l1_input->input_parms, str_buf);
3265  strcat(l1_input->input_parms, "\n");
3266 
3267  sprintf(str_buf, "giop_acdom_file = %s", input->giop_acdom_file);
3268  strcat(l1_input->input_parms, str_buf);
3269  strcat(l1_input->input_parms, "\n");
3270 
3271  sprintf(str_buf, "giop_anap_file = %s", input->giop_anap_file);
3272  strcat(l1_input->input_parms, str_buf);
3273  strcat(l1_input->input_parms, "\n");
3274 
3275  sprintf(str_buf, "giop_bbph_file = %s", input->giop_bbph_file);
3276  strcat(l1_input->input_parms, str_buf);
3277  strcat(l1_input->input_parms, "\n");
3278 
3279  sprintf(str_buf, "giop_bbnap_file = %s", input->giop_bbnap_file);
3280  strcat(l1_input->input_parms, str_buf);
3281  strcat(l1_input->input_parms, "\n");
3282 
3283  sprintf(str_buf, "giop_grd = %8.5f", input->giop_grd[0]);
3284  strcat(l1_input->input_parms, str_buf);
3285  for (i = 1; i < 2; i++) {
3286  sprintf(str_buf, ", %8.5f", input->giop_grd[i]);
3287  strcat(l1_input->input_parms, str_buf);
3288  }
3289  strcat(l1_input->input_parms, "\n");
3290 
3291  sprintf(str_buf, "giop_wave = %6.1f", input->giop_wave[0]);
3292  strcat(l1_input->input_parms, str_buf);
3293  for (i = 1; i < numBands; i++) {
3294  sprintf(str_buf, ", %6.1f", input->giop_wave[i]);
3295  strcat(l1_input->input_parms, str_buf);
3296  }
3297  strcat(l1_input->input_parms, "\n");
3298 
3299  sprintf(str_buf, "giop_rrs_unc = %6.1f", input->giop_rrs_unc[0]);
3300  strcat(l1_input->input_parms, str_buf);
3301  for (i = 1; i < numBands; i++) {
3302  sprintf(str_buf, ", %6.1f", input->giop_rrs_unc[i]);
3303  strcat(l1_input->input_parms, str_buf);
3304  }
3305  strcat(l1_input->input_parms, "\n");
3306 
3307  sprintf(str_buf, "polfile = %s", input->polfile);
3308  strcat(l1_input->input_parms, str_buf);
3309  strcat(l1_input->input_parms, "\n");
3310 
3311  sprintf(str_buf, "pol_opt = %3d", input->pol_opt);
3312  strcat(l1_input->input_parms, str_buf);
3313  strcat(l1_input->input_parms, "\n");
3314 
3315  sprintf(str_buf, "vcnnfile = %s", input->vcnnfile);
3316  strcat(l1_input->input_parms, str_buf);
3317  strcat(l1_input->input_parms, "\n");
3318 
3319  sprintf(str_buf, "absaer_opt = %3d", input->absaer_opt);
3320  strcat(l1_input->input_parms, str_buf);
3321  strcat(l1_input->input_parms, "\n");
3322 
3323  sprintf(str_buf, "glint_opt = %3d", input->glint_opt);
3324  strcat(l1_input->input_parms, str_buf);
3325  strcat(l1_input->input_parms, "\n");
3326 
3327  sprintf(str_buf, "cirrus_opt = %3d", input->cirrus_opt);
3328  strcat(l1_input->input_parms, str_buf);
3329  strcat(l1_input->input_parms, "\n");
3330 
3331  sprintf(str_buf, "oxaband_opt = %3d", input->oxaband_opt);
3332  strcat(l1_input->input_parms, str_buf);
3333  strcat(l1_input->input_parms, "\n");
3334 
3335  sprintf(str_buf, "filter_opt = %3d", input->filter_opt);
3336  strcat(l1_input->input_parms, str_buf);
3337  strcat(l1_input->input_parms, "\n");
3338  if (input->filter_opt == 1) {
3339  sprintf(str_buf, "filter_file = %s", input->filter_file);
3340  strcat(l1_input->input_parms, str_buf);
3341  strcat(l1_input->input_parms, "\n");
3342  for (i = 0; i < input->fctl.nfilt; i++) {
3343  sprintf(str_buf, "# filter_%d = %d x %d (%d) %s %d ",
3344  i + 1,
3345  input->fctl.f[i].nx,
3346  input->fctl.f[i].ny,
3347  input->fctl.f[i].minfill,
3348  filter_names[input->fctl.f[i].func],
3349  input->fctl.f[i].band + 1);
3350  strcat(l1_input->input_parms, str_buf);
3351  strcat(l1_input->input_parms, "\n");
3352  }
3353  }
3354 
3355  sprintf(str_buf, "aerfile = %s", input->aerfile);
3356  strcat(l1_input->input_parms, str_buf);
3357  strcat(l1_input->input_parms, "\n");
3358 
3359  sprintf(str_buf, "tgtfile = %s", input->tgtfile);
3360  strcat(l1_input->input_parms, str_buf);
3361  strcat(l1_input->input_parms, "\n");
3362 
3363  sprintf(str_buf, "met1 = %s", input->met1);
3364  strcat(l1_input->input_parms, str_buf);
3365  strcat(l1_input->input_parms, "\n");
3366 
3367  sprintf(str_buf, "met2 = %s", input->met2);
3368  strcat(l1_input->input_parms, str_buf);
3369  strcat(l1_input->input_parms, "\n");
3370 
3371  sprintf(str_buf, "met3 = %s", input->met3);
3372  strcat(l1_input->input_parms, str_buf);
3373  strcat(l1_input->input_parms, "\n");
3374 
3375  sprintf(str_buf, "ozone1 = %s", input->ozone1);
3376  strcat(l1_input->input_parms, str_buf);
3377  strcat(l1_input->input_parms, "\n");
3378 
3379  sprintf(str_buf, "ozone2 = %s", input->ozone2);
3380  strcat(l1_input->input_parms, str_buf);
3381  strcat(l1_input->input_parms, "\n");
3382 
3383  sprintf(str_buf, "ozone3 = %s", input->ozone3);
3384  strcat(l1_input->input_parms, str_buf);
3385  strcat(l1_input->input_parms, "\n");
3386 
3387  sprintf(str_buf, "anc_profile1 = %s", input->anc_profile1);
3388  strcat(l1_input->input_parms, str_buf);
3389  strcat(l1_input->input_parms, "\n");
3390 
3391  sprintf(str_buf, "anc_profile2 = %s", input->anc_profile2);
3392  strcat(l1_input->input_parms, str_buf);
3393  strcat(l1_input->input_parms, "\n");
3394 
3395  sprintf(str_buf, "anc_profile3 = %s", input->anc_profile3);
3396  strcat(l1_input->input_parms, str_buf);
3397  strcat(l1_input->input_parms, "\n");
3398 
3399  sprintf(str_buf, "anc_aerosol1 = %s", input->anc_aerosol1);
3400  strcat(l1_input->input_parms, str_buf);
3401  strcat(l1_input->input_parms, "\n");
3402 
3403  sprintf(str_buf, "anc_aerosol2 = %s", input->anc_aerosol2);
3404  strcat(l1_input->input_parms, str_buf);
3405  strcat(l1_input->input_parms, "\n");
3406 
3407  sprintf(str_buf, "anc_aerosol3 = %s", input->anc_aerosol3);
3408  strcat(l1_input->input_parms, str_buf);
3409  strcat(l1_input->input_parms, "\n");
3410 
3411  sprintf(str_buf, "sfc_albedo= %s", input->sfc_albedo);
3412  strcat(l1_input->input_parms, str_buf);
3413  strcat(l1_input->input_parms, "\n");
3414 
3415  sprintf(str_buf, "anc_cor_file = %s", input->anc_cor_file);
3416  strcat(l1_input->input_parms, str_buf);
3417  strcat(l1_input->input_parms, "\n");
3418 
3419  sprintf(str_buf, "pixel_anc_file = %s", input->pixel_anc_file);
3420  strcat(l1_input->input_parms, str_buf);
3421  strcat(l1_input->input_parms, "\n");
3422 
3423  sprintf(str_buf, "land = %s", input->land);
3424  strcat(l1_input->input_parms, str_buf);
3425  strcat(l1_input->input_parms, "\n");
3426 
3427  sprintf(str_buf, "water = %s", input->water);
3428  strcat(l1_input->input_parms, str_buf);
3429  strcat(l1_input->input_parms, "\n");
3430 
3431  sprintf(str_buf, "shallow_water_depth = %6.2f", input->shallow_water_depth);
3432  strcat(l1_input->input_parms, str_buf);
3433  strcat(l1_input->input_parms, "\n");
3434 
3435  sprintf(str_buf, "demfile = %s", input->demfile);
3436  strcat(l1_input->input_parms, str_buf);
3437  strcat(l1_input->input_parms, "\n");
3438 
3439  sprintf(str_buf, "dem_auxfile = %s", input->dem_auxfile);
3440  strcat(l1_input->input_parms, str_buf);
3441  strcat(l1_input->input_parms, "\n");
3442 
3443  sprintf(str_buf, "mldfile = %s", input->mldfile);
3444  strcat(l1_input->input_parms, str_buf);
3445  strcat(l1_input->input_parms, "\n");
3446 
3447  sprintf(str_buf, "icefile = %s", input->icefile);
3448  strcat(l1_input->input_parms, str_buf);
3449  strcat(l1_input->input_parms, "\n");
3450 
3451  sprintf(str_buf, "sstfile = %s", input->sstfile);
3452  strcat(l1_input->input_parms, str_buf);
3453  strcat(l1_input->input_parms, "\n");
3454 
3455  sprintf(str_buf, "sstreftype = %d", input->sstreftype);
3456  strcat(l1_input->input_parms, str_buf);
3457  strcat(l1_input->input_parms, "\n");
3458 
3459  sprintf(str_buf, "sssfile = %s", input->sssfile);
3460  strcat(l1_input->input_parms, str_buf);
3461  strcat(l1_input->input_parms, "\n");
3462 
3463  sprintf(str_buf, "no2file = %s", input->no2file);
3464  strcat(l1_input->input_parms, str_buf);
3465  strcat(l1_input->input_parms, "\n");
3466 
3467  sprintf(str_buf, "alphafile = %s", input->alphafile);
3468  strcat(l1_input->input_parms, str_buf);
3469  strcat(l1_input->input_parms, "\n");
3470 
3471  sprintf(str_buf, "tauafile = %s", input->tauafile);
3472  strcat(l1_input->input_parms, str_buf);
3473  strcat(l1_input->input_parms, "\n");
3474 
3475  sprintf(str_buf, "picfile = %s", input->picfile);
3476  strcat(l1_input->input_parms, str_buf);
3477  strcat(l1_input->input_parms, "\n");
3478 
3479  sprintf(str_buf, "owmcfile = %s", input->owmcfile);
3480  strcat(l1_input->input_parms, str_buf);
3481  strcat(l1_input->input_parms, "\n");
3482 
3483  sprintf(str_buf, "prodxmlfile = %s", input->prodXMLfile);
3484  strcat(l1_input->input_parms, str_buf);
3485  strcat(l1_input->input_parms, "\n");
3486 
3487  sprintf(str_buf, "breflectfile = %s", input->breflectfile);
3488  strcat(l1_input->input_parms, str_buf);
3489  strcat(l1_input->input_parms, "\n");
3490 
3491  sprintf(str_buf, "aerbinfile = %s", input->aerbinfile);
3492  strcat(l1_input->input_parms, str_buf);
3493  strcat(l1_input->input_parms, "\n");
3494 
3495  sprintf(str_buf, "gain_unc = %8.4f", input->gain_unc[0]);
3496  strcat(l1_input->input_parms, str_buf);
3497  for (i = 1; i < numBands; i++) {
3498  sprintf(str_buf, ", %8.6f", input->gain_unc[i]);
3499  strcat(l1_input->input_parms, str_buf);
3500  }
3501  strcat(l1_input->input_parms, "\n");
3502 
3503  sprintf(str_buf, "naermodels = %d", input->naermodels);
3504  strcat(l1_input->input_parms, str_buf);
3505  strcat(l1_input->input_parms, "\n");
3506 
3507  sprintf(str_buf, "aermodels = %3s", input->aermodels[0]);
3508  strcat(l1_input->input_parms, str_buf);
3509  for (i = 1; i < input->naermodels; i++) {
3510  sprintf(str_buf, ", %3s", input->aermodels[i]);
3511  strcat(l1_input->input_parms, str_buf);
3512  }
3513  strcat(l1_input->input_parms, "\n");
3514 
3515  sprintf(str_buf, "taua = %8.4f", input->taua[0]);
3516  strcat(l1_input->input_parms, str_buf);
3517  for (i = 1; i < numBands; i++) {
3518  sprintf(str_buf, ", %8.4f", input->taua[i]);
3519  strcat(l1_input->input_parms, str_buf);
3520  }
3521  strcat(l1_input->input_parms, "\n");
3522 
3523  sprintf(str_buf, "aermodrat = %8.5f", input->aermodrat);
3524  strcat(l1_input->input_parms, str_buf);
3525  strcat(l1_input->input_parms, "\n");
3526 
3527  sprintf(str_buf, "aermodmin = %3d", input->aermodmin);
3528  strcat(l1_input->input_parms, str_buf);
3529  strcat(l1_input->input_parms, "\n");
3530 
3531  sprintf(str_buf, "aermodmax = %3d", input->aermodmax);
3532  strcat(l1_input->input_parms, str_buf);
3533  strcat(l1_input->input_parms, "\n");
3534 
3535  sprintf(str_buf, "cirrus_thresh = %8.5f, %8.5f", input->cirrus_thresh[0], input->cirrus_thresh[1]);
3536  strcat(l1_input->input_parms, str_buf);
3537  strcat(l1_input->input_parms, "\n");
3538 
3539  sprintf(str_buf, "absaer = %8.3f", input->absaer);
3540  strcat(l1_input->input_parms, str_buf);
3541  strcat(l1_input->input_parms, "\n");
3542 
3543  sprintf(str_buf, "rhoamin = %8.5f", input->rhoamin);
3544  strcat(l1_input->input_parms, str_buf);
3545  strcat(l1_input->input_parms, "\n");
3546 
3547  sprintf(str_buf, "nlwmin = %8.3f", input->nlwmin);
3548  strcat(l1_input->input_parms, str_buf);
3549  strcat(l1_input->input_parms, "\n");
3550 
3551  sprintf(str_buf, "wsmax = %8.3f", input->wsmax);
3552  strcat(l1_input->input_parms, str_buf);
3553  strcat(l1_input->input_parms, "\n");
3554 
3555  sprintf(str_buf, "coccolith = %8.4f", input->coccolith[0]);
3556  strcat(l1_input->input_parms, str_buf);
3557  for (i = 1; i < 8; i++) {
3558  sprintf(str_buf, ", %8.4f", input->coccolith[i]);
3559  strcat(l1_input->input_parms, str_buf);
3560  }
3561  strcat(l1_input->input_parms, "\n");
3562 
3563  sprintf(str_buf, "tauamax = %8.3f", input->tauamax);
3564  strcat(l1_input->input_parms, str_buf);
3565  strcat(l1_input->input_parms, "\n");
3566 
3567  sprintf(str_buf, "epsmin = %8.3f", input->epsmin);
3568  strcat(l1_input->input_parms, str_buf);
3569  strcat(l1_input->input_parms, "\n");
3570 
3571  sprintf(str_buf, "epsmax = %8.3f", input->epsmax);
3572  strcat(l1_input->input_parms, str_buf);
3573  strcat(l1_input->input_parms, "\n");
3574 
3575  sprintf(str_buf, "windspeed = %8.3f", input->windspeed);
3576  strcat(l1_input->input_parms, str_buf);
3577  strcat(l1_input->input_parms, "\n");
3578 
3579  sprintf(str_buf, "windangle = %8.3f", input->windangle);
3580  strcat(l1_input->input_parms, str_buf);
3581  strcat(l1_input->input_parms, "\n");
3582 
3583  sprintf(str_buf, "pressure = %8.3f", input->pressure);
3584  strcat(l1_input->input_parms, str_buf);
3585  strcat(l1_input->input_parms, "\n");
3586 
3587  sprintf(str_buf, "ozone = %8.3f", input->ozone);
3588  strcat(l1_input->input_parms, str_buf);
3589  strcat(l1_input->input_parms, "\n");
3590 
3591  sprintf(str_buf, "watervapor = %8.3f", input->watervapor);
3592  strcat(l1_input->input_parms, str_buf);
3593  strcat(l1_input->input_parms, "\n");
3594 
3595  sprintf(str_buf, "relhumid = %8.3f", input->relhumid);
3596  strcat(l1_input->input_parms, str_buf);
3597  strcat(l1_input->input_parms, "\n");
3598 
3599  sprintf(str_buf, "ice_threshold = %8.3f", input->ice_threshold);
3600  strcat(l1_input->input_parms, str_buf);
3601  strcat(l1_input->input_parms, "\n");
3602 
3603  sprintf(str_buf, "mumm_alpha = %8.3f", input->mumm_alpha);
3604  strcat(l1_input->input_parms, str_buf);
3605  strcat(l1_input->input_parms, "\n");
3606 
3607  sprintf(str_buf, "mumm_gamma = %8.3f", input->mumm_gamma);
3608  strcat(l1_input->input_parms, str_buf);
3609  strcat(l1_input->input_parms, "\n");
3610 
3611  sprintf(str_buf, "mumm_epsilon = %8.3f", input->mumm_epsilon);
3612  strcat(l1_input->input_parms, str_buf);
3613  strcat(l1_input->input_parms, "\n");
3614 
3615  sprintf(str_buf, "chloc2_wave = %4d", input->chloc2w[0]);
3616  strcat(l1_input->input_parms, str_buf);
3617  for (i = 1; i < 2; i++) {
3618  sprintf(str_buf, ", %4d", input->chloc2w[i]);
3619  strcat(l1_input->input_parms, str_buf);
3620  }
3621  strcat(l1_input->input_parms, "\n");
3622 
3623  sprintf(str_buf, "chloc2_coef = %8.5f", input->chloc2c[0]);
3624  strcat(l1_input->input_parms, str_buf);
3625  for (i = 1; i < 5; i++) {
3626  sprintf(str_buf, ", %8.5f", input->chloc2c[i]);
3627  strcat(l1_input->input_parms, str_buf);
3628  }
3629  strcat(l1_input->input_parms, "\n");
3630 
3631  sprintf(str_buf, "chloc3_wave = %4d", input->chloc3w[0]);
3632  strcat(l1_input->input_parms, str_buf);
3633  for (i = 1; i < 3; i++) {
3634  sprintf(str_buf, ", %4d", input->chloc3w[i]);
3635  strcat(l1_input->input_parms, str_buf);
3636  }
3637  strcat(l1_input->input_parms, "\n");
3638 
3639  sprintf(str_buf, "chloc3_coef = %8.5f", input->chloc3c[0]);
3640  strcat(l1_input->input_parms, str_buf);
3641  for (i = 1; i < 5; i++) {
3642  sprintf(str_buf, ", %8.5f", input->chloc3c[i]);
3643  strcat(l1_input->input_parms, str_buf);
3644  }
3645  strcat(l1_input->input_parms, "\n");
3646 
3647  sprintf(str_buf, "chloc4_wave = %4d", input->chloc4w[0]);
3648  strcat(l1_input->input_parms, str_buf);
3649  for (i = 1; i < 4; i++) {
3650  sprintf(str_buf, ", %4d", input->chloc4w[i]);
3651  strcat(l1_input->input_parms, str_buf);
3652  }
3653  strcat(l1_input->input_parms, "\n");
3654 
3655  sprintf(str_buf, "chloc4_coef = %8.5f", input->chloc4c[0]);
3656  strcat(l1_input->input_parms, str_buf);
3657  for (i = 1; i < 5; i++) {
3658  sprintf(str_buf, ", %8.5f", input->chloc4c[i]);
3659  strcat(l1_input->input_parms, str_buf);
3660  }
3661  strcat(l1_input->input_parms, "\n");
3662 
3663  sprintf(str_buf, "avw_coef = %.5E", input->avw_coef[0]);
3664  strcat(l1_input->input_parms, str_buf);
3665  for (i = 1; i < 6; i++) {
3666  sprintf(str_buf, ", %.5E", input->avw_coef[i]);
3667  strcat(l1_input->input_parms, str_buf);
3668  }
3669  strcat(l1_input->input_parms, "\n");
3670 
3671  sprintf(str_buf, "kd2_wave = %4d", input->kd2w[0]);
3672  strcat(l1_input->input_parms, str_buf);
3673  for (i = 1; i < 2; i++) {
3674  sprintf(str_buf, ", %4d", input->kd2w[i]);
3675  strcat(l1_input->input_parms, str_buf);
3676  }
3677  strcat(l1_input->input_parms, "\n");
3678 
3679  sprintf(str_buf, "kd2_coef = %8.5f", input->kd2c[0]);
3680  strcat(l1_input->input_parms, str_buf);
3681  for (i = 1; i < 6; i++) {
3682  sprintf(str_buf, ", %8.5f", input->kd2c[i]);
3683  strcat(l1_input->input_parms, str_buf);
3684  }
3685  strcat(l1_input->input_parms, "\n");
3686 
3687  sprintf(str_buf, "flh_offset = %8.5f", input->flh_offset);
3688  strcat(l1_input->input_parms, str_buf);
3689  strcat(l1_input->input_parms, "\n");
3690 
3691  sprintf(str_buf, "sstcoeffile = %s", input->sstcoeffile);
3692  strcat(l1_input->input_parms, str_buf);
3693  strcat(l1_input->input_parms, "\n");
3694 
3695  sprintf(str_buf, "dsdicoeffile = %s", input->dsdicoeffile);
3696  strcat(l1_input->input_parms, str_buf);
3697  strcat(l1_input->input_parms, "\n");
3698 
3699  sprintf(str_buf, "sstssesfile = %s", input->sstssesfile);
3700  strcat(l1_input->input_parms, str_buf);
3701  strcat(l1_input->input_parms, "\n");
3702 
3703  sprintf(str_buf, "sst4coeffile = %s", input->sst4coeffile);
3704  strcat(l1_input->input_parms, str_buf);
3705  strcat(l1_input->input_parms, "\n");
3706 
3707  sprintf(str_buf, "sst4ssesfile = %s", input->sst4ssesfile);
3708  strcat(l1_input->input_parms, str_buf);
3709  strcat(l1_input->input_parms, "\n");
3710 
3711  sprintf(str_buf, "sst3coeffile = %s", input->sst3coeffile);
3712  strcat(l1_input->input_parms, str_buf);
3713  strcat(l1_input->input_parms, "\n");
3714 
3715  sprintf(str_buf, "sst3ssesfile = %s", input->sst3ssesfile);
3716  strcat(l1_input->input_parms, str_buf);
3717  strcat(l1_input->input_parms, "\n");
3718 
3719  sprintf(str_buf, "vcal_opt = %3d", input->vcal_opt);
3720  strcat(l1_input->input_parms, str_buf);
3721  strcat(l1_input->input_parms, "\n");
3722 
3723  sprintf(str_buf, "vcal_nlw = %8.4f", input->vcal_nLw[0]);
3724  strcat(l1_input->input_parms, str_buf);
3725  for (i = 1; i < numBands; i++) {
3726  sprintf(str_buf, ", %8.4f", input->vcal_nLw[i]);
3727  strcat(l1_input->input_parms, str_buf);
3728  }
3729  strcat(l1_input->input_parms, "\n");
3730 
3731  sprintf(str_buf, "vcal_lw = %8.4f", input->vcal_Lw[0]);
3732  strcat(l1_input->input_parms, str_buf);
3733  for (i = 1; i < numBands; i++) {
3734  sprintf(str_buf, ", %8.4f", input->vcal_Lw[i]);
3735  strcat(l1_input->input_parms, str_buf);
3736  }
3737  strcat(l1_input->input_parms, "\n");
3738 
3739  sprintf(str_buf, "vcal_chl = %8.4f", input->vcal_chl);
3740  strcat(l1_input->input_parms, str_buf);
3741  strcat(l1_input->input_parms, "\n");
3742 
3743  sprintf(str_buf, "vcal_solz = %8.4f", input->vcal_solz);
3744  strcat(l1_input->input_parms, str_buf);
3745  strcat(l1_input->input_parms, "\n");
3746 
3747  sprintf(str_buf, "vcal_depth = %8.4f", input->vcal_depth);
3748  strcat(l1_input->input_parms, str_buf);
3749  strcat(l1_input->input_parms, "\n");
3750 
3751  sprintf(str_buf, "vcal_min_nbin = %d", input->vcal_min_nbin);
3752  strcat(l1_input->input_parms, str_buf);
3753  strcat(l1_input->input_parms, "\n");
3754 
3755  sprintf(str_buf, "vcal_min_nscene = %d", input->vcal_min_nscene);
3756  strcat(l1_input->input_parms, str_buf);
3757  strcat(l1_input->input_parms, "\n");
3758 
3759  sprintf(str_buf, "band_shift_opt = %3d", input->band_shift_opt);
3760  strcat(l1_input->input_parms, str_buf);
3761  strcat(l1_input->input_parms, "\n");
3762 
3763  sprintf(str_buf, "add_ws_noise = %2.4f", input->add_ws_noise);
3764  strcat(l1_input->input_parms, str_buf);
3765  strcat(l1_input->input_parms, "\n");
3766 
3767  sprintf(str_buf, "add_wd_noise = %2.4f", input->add_wd_noise);
3768  strcat(l1_input->input_parms, str_buf);
3769  strcat(l1_input->input_parms, "\n");
3770 
3771  sprintf(str_buf, "add_mw_noise = %2.4f", input->add_mw_noise);
3772  strcat(l1_input->input_parms, str_buf);
3773  strcat(l1_input->input_parms, "\n");
3774 
3775  sprintf(str_buf, "add_zw_noise = %2.4f", input->add_zw_noise);
3776  strcat(l1_input->input_parms, str_buf);
3777  strcat(l1_input->input_parms, "\n");
3778 
3779  sprintf(str_buf, "add_rh_noise = %2.4f", input->add_rh_noise);
3780  strcat(l1_input->input_parms, str_buf);
3781  strcat(l1_input->input_parms, "\n");
3782 
3783  sprintf(str_buf, "add_pr_noise = %2.4f", input->add_pr_noise);
3784  strcat(l1_input->input_parms, str_buf);
3785  strcat(l1_input->input_parms, "\n");
3786 
3787  sprintf(str_buf, "add_wv_noise = %2.4f", input->add_wv_noise);
3788  strcat(l1_input->input_parms, str_buf);
3789  strcat(l1_input->input_parms, "\n");
3790 
3791  sprintf(str_buf, "add_oz_noise = %2.4f", input->add_oz_noise);
3792  strcat(l1_input->input_parms, str_buf);
3793  strcat(l1_input->input_parms, "\n");
3794 
3795  sprintf(str_buf, "add_no2_strat_noise = %2.4f", input->add_no2_strat_noise);
3796  strcat(l1_input->input_parms, str_buf);
3797  strcat(l1_input->input_parms, "\n");
3798 
3799  sprintf(str_buf, "add_no2_tropo_noise = %2.4f", input->add_no2_tropo_noise);
3800  strcat(l1_input->input_parms, str_buf);
3801  strcat(l1_input->input_parms, "\n");
3802 
3803  sprintf(str_buf, "add_lt_noise = %2.4f", input->add_lt_noise);
3804  strcat(l1_input->input_parms, str_buf);
3805  strcat(l1_input->input_parms, "\n");
3806 
3807  sprintf(str_buf, "lt_noise_scale = %2.4f", input->lt_noise_scale[0]);
3808  strcat(l1_input->input_parms, str_buf);
3809  for (i = 1; i < numBands; i++) {
3810  sprintf(str_buf, ", %2.4f", input->lt_noise_scale[i]);
3811  strcat(l1_input->input_parms, str_buf);
3812  }
3813  strcat(l1_input->input_parms, "\n");
3814 
3815  sprintf(str_buf, "bias_frac = %2.4f", input->bias_frac[0]);
3816  strcat(l1_input->input_parms, str_buf);
3817  for (i = 1; i < numBands; i++) {
3818  sprintf(str_buf, ", %2.4f", input->bias_frac[i]);
3819  strcat(l1_input->input_parms, str_buf);
3820  }
3821  strcat(l1_input->input_parms, "\n");
3822 
3823  sprintf(str_buf, "stype = %d", input->stype);
3824  strcat(l1_input->input_parms, str_buf);
3825  strcat(l1_input->input_parms, "\n");
3826 
3827  sprintf(str_buf, "datamin = %8.4f", input->datamin);
3828  strcat(l1_input->input_parms, str_buf);
3829  strcat(l1_input->input_parms, "\n");
3830 
3831  sprintf(str_buf, "datamax = %8.4f", input->datamax);
3832  strcat(l1_input->input_parms, str_buf);
3833  strcat(l1_input->input_parms, "\n");
3834 
3835  sprintf(str_buf, "north = %8.4f", input->north);
3836  strcat(l1_input->input_parms, str_buf);
3837  strcat(l1_input->input_parms, "\n");
3838 
3839  sprintf(str_buf, "south = %8.4f", input->south);
3840  strcat(l1_input->input_parms, str_buf);
3841  strcat(l1_input->input_parms, "\n");
3842 
3843  sprintf(str_buf, "east = %8.4f", input->east);
3844  strcat(l1_input->input_parms, str_buf);
3845  strcat(l1_input->input_parms, "\n");
3846 
3847  sprintf(str_buf, "west = %8.4f", input->west);
3848  strcat(l1_input->input_parms, str_buf);
3849  strcat(l1_input->input_parms, "\n");
3850 
3851  sprintf(str_buf, "xbox = %d", input->xbox);
3852  strcat(l1_input->input_parms, str_buf);
3853  strcat(l1_input->input_parms, "\n");
3854 
3855  sprintf(str_buf, "ybox = %d", input->ybox);
3856  strcat(l1_input->input_parms, str_buf);
3857  strcat(l1_input->input_parms, "\n");
3858 
3859  //new Raman test
3860  sprintf(str_buf, "raman_opt = %d", input->raman_opt);
3861  strcat(l1_input->input_parms, str_buf);
3862  strcat(l1_input->input_parms, "\n");
3863 
3864  sprintf(str_buf, "width = %d", input->width);
3865  strcat(l1_input->input_parms, str_buf);
3866  strcat(l1_input->input_parms, "\n");
3867 
3868  sprintf(str_buf, "threshold = %8.4f", input->threshold);
3869  strcat(l1_input->input_parms, str_buf);
3870  strcat(l1_input->input_parms, "\n");
3871 
3872  sprintf(str_buf, "rgb = %d", input->rgb[0]);
3873  strcat(l1_input->input_parms, str_buf);
3874  for (i = 1; i < 3; i++) {
3875  sprintf(str_buf, ", %d", input->rgb[i]);
3876  strcat(l1_input->input_parms, str_buf);
3877  }
3878  strcat(l1_input->input_parms, "\n");
3879 
3880  sprintf(str_buf, "subsamp = %d", input->subsamp);
3881  strcat(l1_input->input_parms, str_buf);
3882  strcat(l1_input->input_parms, "\n");
3883 
3884  sprintf(str_buf, "viirsnv7 = %d", input->viirsnv7);
3885  strcat(l1_input->input_parms, str_buf);
3886  strcat(l1_input->input_parms, "\n");
3887 
3888  sprintf(str_buf, "viirsnosisaf = %d", input->viirsnosisaf);
3889  strcat(l1_input->input_parms, str_buf);
3890  strcat(l1_input->input_parms, "\n");
3891 
3892  sprintf(str_buf, "sstrefdif = %8.4f", input->sstrefdif);
3893  strcat(l1_input->input_parms, str_buf);
3894  strcat(l1_input->input_parms, "\n");
3895 
3896  sprintf(str_buf, "water_spectra_file = %s", input->water_spectra_file);
3897  strcat(l1_input->input_parms, str_buf);
3898  strcat(l1_input->input_parms, "\n");
3899 
3900  sprintf(str_buf, "sstreftype = %d", input->sstreftype);
3901  strcat(l1_input->input_parms, str_buf);
3902  strcat(l1_input->input_parms, "\n");
3903 
3904  sprintf(str_buf, "bpar_validate_opt = %d", input->bpar_validate_opt);
3905  strcat(l1_input->input_parms, str_buf);
3906  strcat(l1_input->input_parms, "\n");
3907 
3908  sprintf(str_buf, "bpar_elev_opt = %d", input->bpar_elev_opt);
3909  strcat(l1_input->input_parms, str_buf);
3910  strcat(l1_input->input_parms, "\n");
3911 
3912  sprintf(str_buf, "bpar_elev_value = %8.5f", input->bpar_elev_value);
3913  strcat(l1_input->input_parms, str_buf);
3914  strcat(l1_input->input_parms, "\n");
3915 
3916  sprintf(str_buf, "cloud_hgt_file = %s", input->cloud_hgt_file);
3917  strcat(l1_input->input_parms, str_buf);
3918  strcat(l1_input->input_parms, "\n");
3919 
3920  l1_get_input_params(l1file, l1_input->input_parms);
3921 
3922  /* */
3923  /* Build string of input files for meta-data documentation */
3924  /* */
3925  l1_input->input_files[0] = '\0';
3926  for (i = 0; i < MAX_IFILES; i++) {
3927  if (input->ifile[i][0] != '\0') {
3928  tmp_str = strrchr(input->ifile[i], '/');
3929  tmp_str = (tmp_str == 0x0) ? input->ifile[i] : tmp_str + 1;
3930  if (i == 0) sprintf(l1_input->input_files, "%s", tmp_str);
3931  else {
3932  sprintf(str_buf, ",%s", tmp_str);
3933  strcat(l1_input->input_files, str_buf);
3934  }
3935  } else break;
3936  }
3937  if (strlen(input->geofile)) {
3938  tmp_str = strrchr(input->geofile, '/');
3939  tmp_str = (tmp_str == 0x0) ? input->geofile : tmp_str + 1;
3940  sprintf(str_buf, ",%s", tmp_str);
3941  strcat(l1_input->input_files, str_buf);
3942  }
3943  if (strlen(input->gmpfile)) {
3944  tmp_str = strrchr(input->gmpfile, '/');
3945  tmp_str = (tmp_str == 0x0) ? input->gmpfile : tmp_str + 1;
3946  sprintf(str_buf, ",%s", tmp_str);
3947  strcat(l1_input->input_files, str_buf);
3948  }
3949  if (strlen(input->met1)) {
3950  tmp_str = strrchr(input->met1, '/');
3951  tmp_str = (tmp_str == 0x0) ? input->met1 : tmp_str + 1;
3952  sprintf(str_buf, ",%s", tmp_str);
3953  strcat(l1_input->input_files, str_buf);
3954  }
3955  if (strlen(input->met2)) {
3956  tmp_str = strrchr(input->met2, '/');
3957  tmp_str = (tmp_str == 0x0) ? input->met2 : tmp_str + 1;
3958  sprintf(str_buf, ",%s", tmp_str);
3959  strcat(l1_input->input_files, str_buf);
3960  }
3961  if (strlen(input->met3)) {
3962  tmp_str = strrchr(input->met3, '/');
3963  tmp_str = (tmp_str == 0x0) ? input->met3 : tmp_str + 1;
3964  sprintf(str_buf, ",%s", tmp_str);
3965  strcat(l1_input->input_files, str_buf);
3966  }
3967  if (strlen(input->ozone1)) {
3968  tmp_str = strrchr(input->ozone1, '/');
3969  tmp_str = (tmp_str == 0x0) ? input->ozone1 : tmp_str + 1;
3970  sprintf(str_buf, ",%s", tmp_str);
3971  strcat(l1_input->input_files, str_buf);
3972  }
3973  if (strlen(input->ozone2)) {
3974  tmp_str = strrchr(input->ozone2, '/');
3975  tmp_str = (tmp_str == 0x0) ? input->ozone2 : tmp_str + 1;
3976  sprintf(str_buf, ",%s", tmp_str);
3977  strcat(l1_input->input_files, str_buf);
3978  }
3979  if (strlen(input->ozone3)) {
3980  tmp_str = strrchr(input->ozone3, '/');
3981  tmp_str = (tmp_str == 0x0) ? input->ozone3 : tmp_str + 1;
3982  sprintf(str_buf, ",%s", tmp_str);
3983  strcat(l1_input->input_files, str_buf);
3984  }
3985  if (strlen(input->anc_profile1)) {
3986  tmp_str = strrchr(input->anc_profile1, '/');
3987  tmp_str = (tmp_str == 0x0) ? input->anc_profile1 : tmp_str + 1;
3988  sprintf(str_buf, ",%s", tmp_str);
3989  strcat(l1_input->input_files, str_buf);
3990  }
3991  if (strlen(input->anc_profile2)) {
3992  tmp_str = strrchr(input->anc_profile2, '/');
3993  tmp_str = (tmp_str == 0x0) ? input->anc_profile2 : tmp_str + 1;
3994  sprintf(str_buf, ",%s", tmp_str);
3995  strcat(l1_input->input_files, str_buf);
3996  }
3997  if (strlen(input->anc_profile3)) {
3998  tmp_str = strrchr(input->anc_profile3, '/');
3999  tmp_str = (tmp_str == 0x0) ? input->anc_profile3 : tmp_str + 1;
4000  sprintf(str_buf, ",%s", tmp_str);
4001  strcat(l1_input->input_files, str_buf);
4002  }
4003  if (strlen(input->anc_aerosol1)) {
4004  tmp_str = strrchr(input->anc_aerosol1, '/');
4005  tmp_str = (tmp_str == 0x0) ? input->anc_aerosol1 : tmp_str + 1;
4006  sprintf(str_buf, ",%s", tmp_str);
4007  strcat(l1_input->input_files, str_buf);
4008  }
4009  if (strlen(input->anc_aerosol2)) {
4010  tmp_str = strrchr(input->anc_aerosol2, '/');
4011  tmp_str = (tmp_str == 0x0) ? input->anc_aerosol2 : tmp_str + 1;
4012  sprintf(str_buf, ",%s", tmp_str);
4013  strcat(l1_input->input_files, str_buf);
4014  }
4015  if (strlen(input->anc_aerosol3)) {
4016  tmp_str = strrchr(input->anc_aerosol3, '/');
4017  tmp_str = (tmp_str == 0x0) ? input->anc_aerosol3 : tmp_str + 1;
4018  sprintf(str_buf, ",%s", tmp_str);
4019  strcat(l1_input->input_files, str_buf);
4020  }
4021  if (strlen(input->sfc_albedo)) {
4022  tmp_str = strrchr(input->sfc_albedo, '/');
4023  tmp_str = (tmp_str == 0x0) ? input->sfc_albedo: tmp_str + 1;
4024  sprintf(str_buf, ",%s", tmp_str);
4025  strcat(l1_input->input_files, str_buf);
4026  }
4027  if (strlen(input->anc_cor_file)) {
4028  tmp_str = strrchr(input->anc_cor_file, '/');
4029  tmp_str = (tmp_str == 0x0) ? input->anc_cor_file : tmp_str + 1;
4030  sprintf(str_buf, ",%s", tmp_str);
4031  strcat(l1_input->input_files, str_buf);
4032  }
4033  if (strlen(input->pixel_anc_file)) {
4034  tmp_str = strrchr(input->pixel_anc_file, '/');
4035  tmp_str = (tmp_str == 0x0) ? input->pixel_anc_file : tmp_str + 1;
4036  sprintf(str_buf, ",%s", tmp_str);
4037  strcat(l1_input->input_files, str_buf);
4038  }
4039  if (strlen(input->fqfile)) {
4040  tmp_str = strrchr(input->fqfile, '/');
4041  tmp_str = (tmp_str == 0x0) ? input->fqfile : tmp_str + 1;
4042  sprintf(str_buf, ",%s", tmp_str);
4043  strcat(l1_input->input_files, str_buf);
4044  }
4045  if (strlen(input->parfile)) {
4046  tmp_str = strrchr(input->parfile, '/');
4047  tmp_str = (tmp_str == 0x0) ? input->parfile : tmp_str + 1;
4048  sprintf(str_buf, ",%s", tmp_str);
4049  strcat(l1_input->input_files, str_buf);
4050  }
4051  if (strlen(input->polfile)) {
4052  tmp_str = strrchr(input->polfile, '/');
4053  tmp_str = (tmp_str == 0x0) ? input->polfile : tmp_str + 1;
4054  sprintf(str_buf, ",%s", tmp_str);
4055  strcat(l1_input->input_files, str_buf);
4056  }
4057  if (strlen(input->aermodfile)) {
4058  tmp_str = strrchr(input->aermodfile, '/');
4059  tmp_str = (tmp_str == 0x0) ? input->aermodfile : tmp_str + 1;
4060  sprintf(str_buf, ",%s", tmp_str);
4061  strcat(l1_input->input_files, str_buf);
4062  }
4063  if (strlen(input->vcnnfile)) {
4064  tmp_str = strrchr(input->vcnnfile, '/');
4065  tmp_str = (tmp_str == 0x0) ? input->vcnnfile : tmp_str + 1;
4066  sprintf(str_buf, ",%s", tmp_str);
4067  strcat(l1_input->input_files, str_buf);
4068  }
4069  if (strlen(input->land)) {
4070  tmp_str = strrchr(input->land, '/');
4071  tmp_str = (tmp_str == 0x0) ? input->land : tmp_str + 1;
4072  sprintf(str_buf, ",%s", tmp_str);
4073  strcat(l1_input->input_files, str_buf);
4074  }
4075  if (strlen(input->water)) {
4076  tmp_str = strrchr(input->water, '/');
4077  tmp_str = (tmp_str == 0x0) ? input->water : tmp_str + 1;
4078  sprintf(str_buf, ",%s", tmp_str);
4079  strcat(l1_input->input_files, str_buf);
4080  }
4081  if (strlen(input->demfile)) {
4082  tmp_str = strrchr(input->demfile, '/');
4083  tmp_str = (tmp_str == 0x0) ? input->demfile : tmp_str + 1;
4084  sprintf(str_buf, ",%s", tmp_str);
4085  strcat(l1_input->input_files, str_buf);
4086  }
4087 
4088  if (strlen(input->dem_auxfile)) {
4089  tmp_str = strrchr(input->dem_auxfile, '/');
4090  tmp_str = (tmp_str == 0x0) ? input->dem_auxfile : tmp_str + 1;
4091  sprintf(str_buf, ",%s", tmp_str);
4092  strcat(l1_input->input_files, str_buf);
4093  }
4094  if (strlen(input->mldfile)) {
4095  tmp_str = strrchr(input->mldfile, '/');
4096  tmp_str = (tmp_str == 0x0) ? input->mldfile : tmp_str + 1;
4097  sprintf(str_buf, ",%s", tmp_str);
4098  strcat(l1_input->input_files, str_buf);
4099  }
4100  if (strlen(input->icefile)) {
4101  tmp_str = strrchr(input->icefile, '/');
4102  tmp_str = (tmp_str == 0x0) ? input->icefile : tmp_str + 1;
4103  sprintf(str_buf, ",%s", tmp_str);
4104  strcat(l1_input->input_files, str_buf);
4105  }
4106  if (strlen(input->sstfile)) {
4107  tmp_str = strrchr(input->sstfile, '/');
4108  tmp_str = (tmp_str == 0x0) ? input->sstfile : tmp_str + 1;
4109  sprintf(str_buf, ",%s", tmp_str);
4110  strcat(l1_input->input_files, str_buf);
4111  }
4112 
4113  if (strlen(input->sssfile)) {
4114  tmp_str = strrchr(input->sssfile, '/');
4115  tmp_str = (tmp_str == 0x0) ? input->sssfile : tmp_str + 1;
4116  sprintf(str_buf, ",%s", tmp_str);
4117  strcat(l1_input->input_files, str_buf);
4118  }
4119  if (strlen(input->no2file)) {
4120  tmp_str = strrchr(input->no2file, '/');
4121  tmp_str = (tmp_str == 0x0) ? input->no2file : tmp_str + 1;
4122  sprintf(str_buf, ",%s", tmp_str);
4123  strcat(l1_input->input_files, str_buf);
4124  }
4125  if (strlen(input->alphafile)) {
4126  tmp_str = strrchr(input->alphafile, '/');
4127  tmp_str = (tmp_str == 0x0) ? input->alphafile : tmp_str + 1;
4128  sprintf(str_buf, ",%s", tmp_str);
4129  strcat(l1_input->input_files, str_buf);
4130  }
4131  if (strlen(input->tauafile)) {
4132  tmp_str = strrchr(input->tauafile, '/');
4133  tmp_str = (tmp_str == 0x0) ? input->tauafile : tmp_str + 1;
4134  sprintf(str_buf, ",%s", tmp_str);
4135  strcat(l1_input->input_files, str_buf);
4136  }
4137 
4138  if (strlen(input->picfile)) {
4139  tmp_str = strrchr(input->picfile, '/');
4140  tmp_str = (tmp_str == 0x0) ? input->picfile : tmp_str + 1;
4141  sprintf(str_buf, ",%s", tmp_str);
4142  strcat(l1_input->input_files, str_buf);
4143  }
4144  if (strlen(input->owmcfile)) {
4145  tmp_str = strrchr(input->owmcfile, '/');
4146  tmp_str = (tmp_str == 0x0) ? input->owmcfile : tmp_str + 1;
4147  sprintf(str_buf, ",%s", tmp_str);
4148  strcat(l1_input->input_files, str_buf);
4149  }
4150  if (strlen(input->water_spectra_file)) {
4151  tmp_str = strrchr(input->water_spectra_file, '/');
4152  tmp_str = (tmp_str == 0x0) ? input->water_spectra_file : tmp_str + 1;
4153  sprintf(str_buf, ",%s", tmp_str);
4154  strcat(l1_input->input_files, str_buf);
4155  }
4156 
4157  if (strlen(input->cloud_hgt_file)) {
4158  tmp_str = strrchr(input->cloud_hgt_file, '/');
4159  tmp_str = (tmp_str == 0x0) ? input->cloud_hgt_file : tmp_str + 1;
4160  sprintf(str_buf, ",%s", tmp_str);
4161  strcat(l1_input->input_files, str_buf);
4162  }
4163 
4164  l1_get_input_files(l1file, l1_input->input_files);
4165 
4166  /* */
4167  /* Build string of mask names for meta-data documentation */
4168  /* */
4169  strcpy(input->mask_names, "ATMFAIL");
4170  if (l1_input->landmask == 1) strcat(input->mask_names, ",LAND");
4171  if (l1_input->bathmask == 1) strcat(input->mask_names, ",COASTZ");
4172  if (l1_input->cloudmask == 1) strcat(input->mask_names, ",CLDICE");
4173  if (l1_input->glintmask == 1) strcat(input->mask_names, ",HIGLINT");
4174  if (l1_input->sunzenmask == 1) strcat(input->mask_names, ",HISOLZEN");
4175  if (l1_input->satzenmask == 1) strcat(input->mask_names, ",HISATZEN");
4176  if (l1_input->hiltmask == 1) strcat(input->mask_names, ",HILT");
4177  if (l1_input->stlightmask == 1) strcat(input->mask_names, ",STRAYLIGHT");
4178 
4179  return 0;
4180 }
4181 
4182 /*-----------------------------------------------------------------------------
4183  Function: msl12_input
4184 
4185  Returns: int (status)
4186  The return code is a negative value if any error occurs, otherwise,
4187  returns 0.
4188 
4189  Description:
4190  Convert the arguments from the command line into a structure input
4191  variable.
4192 
4193  Parameters: (in calling order)
4194  Type Name I/O Description
4195  ---- ---- --- -----------
4196  int argc I number of arguments
4197  char **argv I list of arguments
4198  instr input O structure variable for inputs
4199 
4200 ----------------------------------------------------------------------------*/
4201 int msl12_input(int argc, char *argv[], const char* progName, filehandle *l1file) {
4202  /* hold all of the command line options */
4204  int result;
4205 
4206  list = clo_createList();
4207 
4208  /* initialize the option list with descriptions and default values */
4209  l2gen_init_options(list, progName);
4210 
4211  // setup CLO so ofile2,ofile3... will work
4213 
4214  result = msl12_option_input(argc, argv, list, (char*) progName, l1file);
4215 
4217 
4218  return result;
4219 }
4220 
4221 
4222 /* This function takes a predefined L1 file handle and loads all defaults */
4223 
4224 /* It's used by MSl1info, MSll2snpx, etc which don't use standard par files. */
4225 int msl12_input_defaults(filehandle *l1file) {
4226  int argc = 0;
4227  char *argv[10];
4228  static char resolutionStr[FILENAME_MAX];
4229  static char ifileStr[FILENAME_MAX];
4230  static char geofileStr[FILENAME_MAX];
4231 
4232  argv[argc++] = "msl12";
4233 
4234  sprintf(ifileStr, "ifile=%s", l1file->name);
4235  argv[argc++] = ifileStr;
4236 
4237  if (l1file->geofile) {
4238  sprintf(geofileStr, "geofile=%s", l1file->geofile);
4239  argv[argc++] = geofileStr;
4240  argc = 3;
4241  }
4242 
4243  if (l1_input->resolution != -1) {
4244  sprintf(resolutionStr, "resolution=%d", l1_input->resolution);
4245  argv[argc++] = resolutionStr;
4246  }
4247 
4248  if (msl12_input(argc, argv, "msl12", l1file))
4249  return (-1);
4250 
4251  return 0;
4252 }
4253 
4254 int l2gen_usage(const char *prog) {
4256 
4257  list = clo_createList();
4258  l2gen_init_options(list, prog);
4260 
4261  return 0;
4262 }
int32 l1file(int32 sdfid, int32 *nsamp, int32 *nscans, int16 *dtynum)
Definition: l1stat_chk.c:586
void l1_input_init()
Definition: l1_options.c:11
#define MAX(A, B)
Definition: swl0_utils.h:26
clo_option_t * clo_addOption(clo_optionList_t *list, const char *key, enum clo_dataType_t dataType, const char *defaultVal, const char *desc)
Definition: clo.c:684
const char * sensorId2SensorDir(int sensorId)
Definition: sensorInfo.c:240
void msl12_input_init()
Definition: msl12_input.c:485
float clo_getOptionFloat(clo_option_t *option)
Definition: clo.c:1167
int j
Definition: decode_rs.h:73
#define INVERSE_NLW
Definition: filehandle.h:13
char * clo_getString(clo_optionList_t *list, const char *key)
Definition: clo.c:1357
void clo_readArgs(clo_optionList_t *list, int argc, char *argv[])
Definition: clo.c:2103
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
Definition: CMakeLists.txt:7
#define FIXMODPAIRNIR
Definition: l12_parms.h:27
int l2gen_init_options(clo_optionList_t *list, const char *prog)
Definition: msl12_input.c:667
#define AERRHSM
Definition: l12_parms.h:37
void * allocateMemory(size_t numBytes, const char *name)
Definition: allocateMemory.c:7
int rdfilter(char *file, fctlstr *fctl, int32_t nbands)
Definition: filter.c:300
#define VERSION_MINOR
Definition: version.h:2
#define NULL
Definition: decode_rs.h:63
char * key
Definition: clo.h:104
#define FIXANGSTROMNIR
Definition: l12_parms.h:29
char ** clo_getOptionStrings(clo_option_t *option, int *count)
Definition: clo.c:1226
int l2gen_read_options(clo_optionList_t *list, char *progName, int argc, char *argv[], filehandle *l1file)
Definition: msl12_input.c:1391
int clo_isSet(clo_optionList_t *list, const char *key)
Definition: clo.c:2270
#define GITSHA
Definition: version.h:4
clo_option_t * clo_findOption(clo_optionList_t *list, const char *key)
Definition: clo.c:967
int msl12_option_input(int argc, char **argv, clo_optionList_t *list, char *progName, filehandle *l1file)
Definition: msl12_input.c:2850
#define VERSION_PATCH
Definition: version.h:3
int clo_getOptionInt(clo_option_t *option)
Definition: clo.c:1113
@ CLO_TYPE_FLOAT
Definition: clo.h:81
int clo_setString(clo_optionList_t *list, const char *key, const char *val, const char *source)
Definition: clo.c:1667
#define AERWHITE
Definition: l12_parms.h:22
#define IOPNONE
Definition: l12_parms.h:67
int clo_isOptionSet(clo_option_t *option)
Definition: clo.c:2257
#define AERRHNIR
Definition: l12_parms.h:24
@ CLO_TYPE_BOOL
Definition: clo.h:78
#define VERSION_MAJOR
Definition: version.h:1
#define FORWARD
Definition: regen_attr.h:12
character(len=1000) if
Definition: names.f90:13
void l1_get_input_params(filehandle *l1file, char *input_parms)
Definition: l1_options.c:444
void clo_setSelectOptionKeys(char **keys)
Definition: clo.c:514
void msl12_input_nbands_init(instr *input, int32_t nbands)
Definition: msl12_input.c:452
#define FIXMODPAIR
Definition: l12_parms.h:26
float * calloc_nbandsf(int32_t nbands, float *nbarray, float init_val)
void clo_setEnableDumpOptions(int val)
Definition: clo.c:410
clo_optionList_t * clo_createList()
Definition: clo.c:532
#define AERWANG
Definition: l12_parms.h:23
void clo_addXmlProgramMetadata(const char *tag, const char *value)
Definition: clo.c:2345
#define AOT_MAX
Definition: l12_parms.h:45
void clo_setHelpStr(const char *str)
Definition: clo.c:487
const char * getFileFormatName(const char *str)
int l2gen_load_input(clo_optionList_t *list, instr *input, int32_t nbands)
Definition: msl12_input.c:1576
char * valStr
Definition: clo.h:108
@ CLO_TYPE_INT
Definition: clo.h:79
void l1_add_options(clo_optionList_t *list)
Definition: l1_options.c:76
char * clo_getOptionString(clo_option_t *option)
Definition: clo.c:1050
void fctl_init(fctlstr *fctl)
Definition: filter.c:19
void l1_get_input_files(filehandle *l1file, char *input_files)
Definition: l1_options.c:644
float * clo_getOptionFloats(clo_option_t *option, int *count)
Definition: clo.c:1295
int * clo_getOptionInts(clo_option_t *option, int *count)
Definition: clo.c:1273
void clo_printUsage(clo_optionList_t *list)
Definition: clo.c:1988
l1_input_t * l1_input
Definition: l1_options.c:9
#define MAXAERMOD
Definition: l12_parms.h:21
#define L1_PRODSTRLEN
Definition: filehandle.h:19
int want_verbose
int msl12_input_defaults(filehandle *l1file)
Definition: msl12_input.c:4225
@ CLO_TYPE_IFILE
Definition: clo.h:84
@ CLO_TYPE_OFILE
Definition: clo.h:85
#define AERMUMM
Definition: l12_parms.h:32
clo_option_t * clo_getOption(clo_optionList_t *list, int i)
Definition: clo.c:908
void clo_addOptionAlias(clo_option_t *option, const char *alias)
Definition: clo.c:632
void clo_readFile(clo_optionList_t *list, const char *fileName)
Definition: clo.c:2210
int clo_getNumOptions(clo_optionList_t *list)
Definition: clo.c:1017
void parse_file_name(const char *inpath, char *outpath)
#define AERRHMSEPS
Definition: l12_parms.h:36
#define basename(s)
Definition: l0chunk_modis.c:29
#define FIXANGSTROM
Definition: l12_parms.h:28
int count
Definition: clo.h:115
@ CLO_TYPE_HELP
Definition: clo.h:86
int32_t nbands
char defaermodels[][32]
Definition: msl12_input.c:21
const char * sensorId2SensorName(int sensorId)
Definition: sensorInfo.c:198
void clo_setEnableExtraOptions(int val)
Definition: clo.c:429
void clo_setVersion(const char *str)
Definition: clo.c:448
#define MAX_OFILES
Definition: l12_parms.h:14
#define MAX_IFILES
Definition: l12_parms.h:15
void l1_load_options(clo_optionList_t *list, filehandle *l1file)
Definition: l1_options.c:247
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 and prod_ix set to PARAM_TYPE_INT name_prefix is compared with the beginning of the product name If name_suffix is not empty the it must match the end of the product name The characters right after the prefix are read as an integer and prod_ix is set to that number strncpy(l2prod->name_prefix, "myprod", UNITLEN)
void l1_read_default_files(clo_optionList_t *list, filehandle *l1file, const char *ifile)
Definition: l1_options.c:192
instr * input
Definition: msl12_input.c:18
void clo_deleteList(clo_optionList_t *list)
Definition: clo.c:875
void clo_dumpOption(clo_option_t *option)
Definition: clo.c:1896
int32_t rdsensorinfo(int32_t, int32_t, const char *, void **)
Definition: rdsensorinfo.c:69
for(i=0;i< NROOTS;i++) s[i]
Definition: decode_rs.h:85
int l2gen_usage(const char *prog)
Definition: msl12_input.c:4254
const char * subsensorId2SubsensorDir(int subsensorId)
Definition: sensorInfo.c:254
#define AERRHMSEPS_lin
Definition: l12_parms.h:38
#define AERWANGNIR
Definition: l12_parms.h:25
int msl12_input(int argc, char *argv[], const char *progName, filehandle *l1file)
Definition: msl12_input.c:4201
enum clo_dataType_t dataType
Definition: clo.h:105
#define INVERSE_LW
Definition: filehandle.h:14
#define CHL_MAX
Definition: l12_parms.h:43
int i
Definition: decode_rs.h:71
@ CLO_TYPE_STRING
Definition: clo.h:83
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define FIXAOT
Definition: l12_parms.h:30
#define AERWANGSWIR
Definition: l12_parms.h:31
int clo_getOptionBool(clo_option_t *option)
Definition: clo.c:1087
#define AERNULL
Definition: l12_parms.h:39
int defnaermodels
Definition: msl12_input.c:20
int count
Definition: decode_rs.h:79