Go to the documentation of this file.
27 int errflg, opt_count, opt_count2, verr;
28 char tmpstr[FILENAME_MAX], filetmp[FILENAME_MAX];
29 int i,
nbands, ar_count, orb_geo_use = 0, out_loc_use = 0;
32 char localsuite[FILENAME_MAX];
33 char prog_name[] =
"viirs_sim_sdr", sensor_id[] =
"viirsn", *dataroot;
35 if ((dataroot = getenv(
"OCDATAROOT")) ==
NULL) {
36 printf(
"%s, %d -E- OCDATAROOT environment variable is not defined.\n",
43 sprintf(tmpstr,
"viirs_sim_sdr version 1.0 (%s %s)", __DATE__, __TIME__);
60 strcpy(tmpstr,
"Input VIIRS geolocation file (required)");
63 strcpy(tmpstr,
"path to place output SDR files (required)");
67 strcpy(tmpstr,
"level-2 file containing TOA radiances");
71 strcpy(tmpstr,
"Land reflectance data file");
75 strcpy(tmpstr,
"reflectance replacement options:\n");
77 "\t0: fill only where there are no valid TOA values\n");
78 strcat(tmpstr,
"\t1: replace all points with reflectance taken to TOA");
81 strcpy(tmpstr,
"output scan format, resultant format is\n");
82 strcat(tmpstr,
"\tminimum of input format and oscn_fmt_opt:\n");
83 strcat(tmpstr,
"\t0 - make aggregated\n");
84 strcat(tmpstr,
"\t1 - make unaggregated\n");
85 strcat(tmpstr,
"\t2 - same as input format");
88 strcpy(tmpstr,
"M-band create option:\n");
89 strcat(tmpstr,
"\t0 - make the Vis, NIR bands (M1 - 7)\n");
90 strcat(tmpstr,
"\t1 - make all M bands (M1 - 16)");
93 strcpy(tmpstr,
"optical crosstalk option:\n");
94 strcat(tmpstr,
"\t0 - no added cross talk\n");
95 strcat(tmpstr,
"\t1 - add optical crosstalk (OXT) artifact");
98 strcpy(filetmp,
"$VIIRS_SIM_DATA/oxt_coeff_default.h5\n");
99 sprintf(tmpstr,
"optical crosstalk influence coefficients");
102 strcpy(filetmp,
"$VIIRS_SIM_DATA/inter_band_default.dat");
103 sprintf(tmpstr,
"Inter-band data table\n");
106 strcpy(tmpstr,
"metadata output file (not implemented yet)");
110 "bow tie deletion option (default, on to do bow tie delete)");
113 strcpy(tmpstr,
"Calibration gains to remove from TOA radiances");
116 strcpy(tmpstr,
"Calibration offsets to remove from TOA radiances");
119 strcpy(tmpstr,
"optional create time in form YYYYMMDD/HHMMSS.FFFFFF\n");
120 strcat(tmpstr,
"\tif not specified, the time the program ran");
123 strcpy(tmpstr,
"SDR file name create option:\n");
124 strcat(tmpstr,
"\t0 - make standard VIIRS format\n");
125 strcat(tmpstr,
"\t1 - omit the create time part (_cYYYY...)\n");
128 strcpy(tmpstr,
"SDR overwrite option:\n");
129 strcat(tmpstr,
"\t0 - do not permit overwrite\n");
130 strcat(tmpstr,
"\t1 - allow overwrite to happen\n");
136 ctl->count_cal_opt = 0;
137 strcpy(tmpstr,
"count calibration option:\n");
138 strcat(tmpstr,
"\t0 - no count calibration done\n");
139 strcat(tmpstr,
"\t1 - perform de-cal and cal (mandatory for exect X-talk\n");
140 strcat(tmpstr,
"\t2 - (1), but also integerize counts");
143 strcpy(tmpstr,
"Count calibration gain file");
144 strcat(tmpstr,
"\t(if omitted, an internal TVAC general set is used)");
148 strcpy(tmpstr,
"Count calibration rvs file leader (pre-lambda)");
149 strcat(tmpstr,
"\t(if omitted, unity rvs is used)");
153 strcpy(tmpstr,
"Count de-calibration gain file\n");
154 strcat(tmpstr,
"\t(if omitted, an internal TVAC general set is used)");
158 strcpy(tmpstr,
"Count de-calibration rvs file (pre-lambda)\n");
159 strcat(tmpstr,
"\t(if omitted, unity rvs is used)");
163 ctl->count_dark_opt = 0;
164 strcpy(tmpstr,
"count calibration dark subtract option:\n");
166 "\t0 - do not perform dark subtract in decal / cal process\n");
167 strcat(tmpstr,
"\t1 - do the dark subtract in decal / cal process\n");
170 strcpy(tmpstr,
"product suite string for loading\n");
171 strcat(tmpstr,
" suite-specific defaults");
175 strcpy(tmpstr,
"Electronic crosstalk processing option:\n");
176 strcat(tmpstr,
"\t0 - no crosstalk applied\n");
177 strcat(tmpstr,
"\t1 - Apply electronic crosstalk\n");
180 strcpy(tmpstr,
"Electronic crosstalk coefficient file\n");
182 "\t(if omitted, a trivial crosstalk, zero influence, is applied)\n");
186 strcpy(tmpstr,
"SDR origin designation\n");
188 "\t(will appear in attributes and file name origin location)\n");
191 strcpy(tmpstr,
"SDR domain designation\n");
193 "\t(will appear in attributes and file name domain location)\n");
200 strcpy(tmpstr,
"Noise addition option: 0 to not use 1 to apply\n");
203 strcpy(tmpstr,
"Noise coefficient file name\n");
204 strcat(tmpstr,
"\t(if omitted or Unspecified, no noise will be added\n");
210 strcpy(tmpstr,
"Stray light addition option: 0 to not use 1 to apply\n");
213 strcpy(tmpstr,
"Stray light coefficient file name\n");
214 strcat(tmpstr,
"\t(if omitted or Unspecified, no stray light is added\n");
231 localsuite[0] =
'\0';
235 sprintf(tmpstr,
"%s/%s/%s_defaults.par", dataroot, sensor_id, prog_name);
238 if (localsuite[0] ==
'\0')
240 sprintf(tmpstr,
"%s/%s/%s_defaults_%s.par", dataroot, sensor_id, prog_name,
250 if (opt_count != opt_count2) {
251 printf(
"\n\nError: initial # options: %d, final # options: %d\n",
252 opt_count, opt_count2);
253 printf(
"%s, %d: Error, a mis-spelled or non-existant option has\n",
255 printf(
"\tbeen entered. The extra options should be at the end of\n");
256 printf(
"\tthe following option list:\n");
287 if ((ctl->rhos_opt < 0) || (ctl->rhos_opt > 1)) {
288 printf(
"refl_fil_opt must be 0 or 1\n");
293 if ((ctl->out_scn_fmt < 0) || (ctl->out_scn_fmt > 2)) {
294 printf(
"out_scn_fmt must be 0 to 2\n");
299 if ((ctl->make_m < 0) || (ctl->make_m > 1)) {
300 printf(
"make_m must be 0 or 1\n");
303 if (ctl->make_m == 0)
309 if ((ctl->oxt_mode < 0) || (ctl->oxt_mode > 1)) {
310 printf(
"oxt_mode must be 0 to 1\n");
324 if ((ctl->sdr_overwrite != 0) && (ctl->sdr_overwrite != 1)) {
325 printf(
"sdr_overwrite must be 0 or 1\n");
330 if ((ctl->fname_opt != 0) && (ctl->fname_opt != 1)) {
331 printf(
"fname_opt must be 0 or 1\n");
336 ctl->vic_cal_chg = 1;
339 printf(
"%s, %d: Error, number of gain elements must be %d\n",
340 __FILE__, __LINE__,
nbands);
344 ctl->gain[
i] = fArray[
i];
349 ctl->vic_cal_chg = 1;
352 printf(
"%s, %d: Error, number of offset elements must be %d\n",
353 __FILE__, __LINE__,
nbands);
357 ctl->offset[
i] = fArray[
i];
362 if (strcmp(ctl->cre_time,
"Unspecified") != 0) {
364 for (
i = 0;
i < 8;
i++)
365 if (!
isdigit(ctl->cre_time[
i])) verr = 1;
366 if (ctl->cre_time[8] !=
'/') verr = 1;
367 for (
i = 9;
i < 15;
i++)
368 if (!
isdigit(ctl->cre_time[
i])) verr = 1;
369 if (ctl->cre_time[15] !=
'.') verr = 1;
370 for (
i = 16;
i < 22;
i++)
371 if (!
isdigit(ctl->cre_time[
i])) verr = 1;
374 printf(
"%s, %d: Error, cre_time has improper format\n",
380 if ((ctl->count_cal_opt < 0) || (ctl->count_cal_opt > 2)) {
381 printf(
"count_cal_opt must be 0, 1 or 2\n");
386 "count_cal_gain_file"));
388 "count_cal_rvs_file"));
390 "count_decal_gain_file"));
392 "count_decal_rvs_file"));
395 if ((ctl->ext_opt < 0) || (ctl->ext_opt > 1)) {
396 printf(
"ext_opt must be 0 or 1\n");
407 if (strcmp(ctl->noise_coef,
"Unspecified") == 0)
412 if (strcmp(ctl->stray_tbl,
"Unspecified") == 0)
415 ctl->any_artifact = 0;
421 if ((orb_geo_use == 0) || (out_loc_use == 0)) {
422 printf(
"Both geofile and opath must be set\n");
428 if ((ctl->ext_opt != 0) && (ctl->count_cal_opt == 0))
429 ctl->count_cal_opt = 1;
433 if ((ctl->oxt_mode != 0) || (ctl->count_cal_opt > 0) ||
434 (ctl->noise_mode != 0) || (ctl->stray_opt != 0))
435 ctl->any_artifact = 1;
clo_option_t * clo_addOption(clo_optionList_t *list, const char *key, enum clo_dataType_t dataType, const char *defaultVal, const char *desc)
char * clo_getString(clo_optionList_t *list, const char *key)
void clo_readArgs(clo_optionList_t *list, int argc, char *argv[])
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
int clo_isSet(clo_optionList_t *list, const char *key)
int clo_getInt(clo_optionList_t *list, const char *key)
void clo_setEnableDumpOptions(int val)
clo_optionList_t * clo_createList()
void clo_printUsage(clo_optionList_t *list)
float * clo_getFloats(clo_optionList_t *list, const char *key, int *count)
void clo_readFile(clo_optionList_t *list, const char *fileName)
int clo_getNumOptions(clo_optionList_t *list)
void clo_setVersion(const char *str)
int clo_getBool(clo_optionList_t *list, const char *key)
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")