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