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