Go to the documentation of this file.
12 input_str->ifile[0] =
'\0';
13 input_str->ofile[0] =
'\0';
14 input_str->palfile[0] =
'\0';
15 input_str->palette_dir[0] =
'\0';
16 input_str->product_table[0] =
'\0';
17 input_str->flaguse[0] =
'\0';
18 input_str->parms[0] =
'\0';
20 input_str->prod [0] =
'\0';
22 input_str->datamin = 0.0;
23 input_str->datamax = 0.0;
25 input_str->west = 0.0;
26 input_str->east = 0.0;
27 input_str->south = 0.0;
28 input_str->north = 0.0;
29 input_str->width = 800;
30 input_str->threshold = 5.;
32 input_str->quality = 2;
33 input_str->apply_pal = 0;
34 input_str->outmode = 1;
45 sprintf(tmpStr,
"l2mapgen %s (%s %s)",
VERSION, __DATE__, __TIME__);
48 sprintf(tmpStr,
"Usage: l2mapgen argument-list\n\n");
50 strcat(tmpStr,
" This program takes a product from a L2 file, maps it using a Plate\n");
51 strcat(tmpStr,
" Carree cylindrical projection, and produces a gray scale PGM or\n");
52 strcat(tmpStr,
" color PPM file.\n\n");
54 strcat(tmpStr,
" The argument-list is a set of keyword=value pairs. The arguments can\n");
55 strcat(tmpStr,
" be specified on the commandline, or put into a parameter file, or the\n");
56 strcat(tmpStr,
" two methods can be used together, with commandline over-riding.\n\n");
57 strcat(tmpStr,
"The list of valid keywords follows:\n");
68 clo_addOption(
list,
"quality",
CLO_TYPE_INT,
"2",
"minimum allowable quality level for SST. Valid\n only for SST and only if qual_sst or qual_sst4 SDS exist");
78 clo_addOption(
list,
"threshold",
CLO_TYPE_FLOAT,
"5",
"minimum percentage of the area of interest\n that must receive valid pixel data before an image is generated");
79 strcpy(tmpStr,
"format of the output file\n");
80 strcat(tmpStr,
" ppm: PPM or PGM image file (alias 1)\n");
81 strcat(tmpStr,
" png: PNG color or grayscale image file (alias 2)\n");
82 strcat(tmpStr,
" tiff: TIFF color or grayscale geo tiff image file (alias 3)\n");
85 strcpy(tmpStr,
"\n If the \"mask\" option is set, the output PGM image will be masked for\n");
86 strcat(tmpStr,
" flags defined in the flaguse parameter. The \"no data\" pixel value will\n");
87 strcat(tmpStr,
" change from 0 to 255, and pixel values 252, 253, and 254 will represent the\n");
88 strcat(tmpStr,
" sunglint, land, and all other (e.g. clouds/ice,hilt,atmfail,navfail,chlfail)\n");
89 strcat(tmpStr,
" masks, respectively. NOTE: sunglint is NOT masked by default, but if it is\n");
90 strcat(tmpStr,
" added to the flaguse parameter, it will be distinguished in the masking as\n");
91 strcat(tmpStr,
" medium gray. If a palette is applied and the mask option is set, the\n");
92 strcat(tmpStr,
" palette values will be modified:\n");
93 strcat(tmpStr,
" Value R G B\n");
94 strcat(tmpStr,
" 252 128 128 128\n");
95 strcat(tmpStr,
" 253 160 82 45\n");
96 strcat(tmpStr,
" 254 255 255 255\n");
97 strcat(tmpStr,
" 255 0 0 0\n\n");
98 strcat(tmpStr,
" By default, this program sends its results to standard output as a\n");
99 strcat(tmpStr,
" PGM-formatted binary data stream. Save it to a file via \">\" or pipe it\n");
100 strcat(tmpStr,
" to your favorite image display program. The output image is rendered in\n");
101 strcat(tmpStr,
" a Plate Carree projection.");
121 char tmpStr[FILENAME_MAX];
125 if ((dataRoot = getenv(
"OCDATAROOT")) ==
NULL) {
126 fprintf(
stderr,
"-E- OCDATAROOT environment variable is not defined.\n");
131 sprintf(tmpStr,
"%s/common/l2mapgen_defaults.par", dataRoot);
133 fprintf(
stderr,
"Loading default parameters from %s\n", tmpStr);
144 char tmp_file[FILENAME_MAX];
149 char keyword[FILENAME_MAX];
155 for (optionId = 0; optionId < numOptions; optionId++) {
161 while (*strVal !=
'\0') {
162 *strVal = tolower(*strVal);
166 if (strcmp(keyword,
"help") == 0)
168 else if (strcmp(keyword,
"version") == 0)
170 else if (strcmp(keyword,
"dump_options") == 0)
172 else if (strcmp(keyword,
"dump_options_paramfile") == 0)
174 else if (strcmp(keyword,
"dump_options_xmlfile") == 0)
176 else if (strcmp(keyword,
"help1") == 0)
178 else if (strcmp(keyword,
"par") == 0)
180 else if (strcmp(keyword,
"ifile") == 0) {
185 }
else if (strcmp(keyword,
"ofile") == 0) {
192 }
else if (strcmp(keyword,
"palfile") == 0) {
197 }
else if (strcmp(keyword,
"palette_dir") == 0) {
202 }
else if (strcmp(keyword,
"product_table") == 0) {
207 }
else if (strcmp(keyword,
"flaguse") == 0) {
210 input->flaguse[0] =
'\0';
212 if (strcasecmp(
"default", strArray[
i]) == 0) {
213 if (
input->flaguse[0] !=
'\0')
214 strcat(
input->flaguse,
",");
217 if (
input->flaguse[0] !=
'\0')
218 strcat(
input->flaguse,
",");
219 strcat(
input->flaguse, strArray[
i]);
225 }
else if (strcmp(keyword,
"prod") == 0) {
230 }
else if (strcmp(keyword,
"stype") == 0) {
233 }
else if (strcmp(keyword,
"width") == 0) {
236 }
else if (strcmp(keyword,
"threshold") == 0) {
239 }
else if (strcmp(keyword,
"apply_pal") == 0) {
242 }
else if (strcmp(keyword,
"mask") == 0) {
245 }
else if (strcmp(keyword,
"quality") == 0) {
248 }
else if (strcmp(keyword,
"datamin") == 0) {
251 }
else if (strcmp(keyword,
"datamax") == 0) {
254 }
else if (strcmp(keyword,
"west") == 0) {
257 }
else if (strcmp(keyword,
"east") == 0) {
260 }
else if (strcmp(keyword,
"south") == 0) {
263 }
else if (strcmp(keyword,
"north") == 0) {
266 }
else if (strcmp(keyword,
"outmode") == 0) {
268 if (strcmp(
"1",
str) == 0) {
270 }
else if (strcasecmp(
"ppm",
str) == 0) {
272 }
else if (strcmp(
"2",
str) == 0) {
274 }
else if (strcasecmp(
"png",
str) == 0) {
276 }
else if (strcmp(
"3",
str) == 0) {
278 }
else if (strcasecmp(
"tiff",
str) == 0) {
281 fprintf(
stderr,
"Invalid value for outmode \"%s\"\n",
str);
286 fprintf(
stderr,
"Invalid argument \"%s\"\n", keyword);
325 fprintf(
stderr,
"-E- %s: Error initializing input structure.\n", __FILE__);
331 fprintf(
stderr,
"-E- %s: Error reading program options.\n", __FILE__);
337 fprintf(
stderr,
"-E- %s: Error loading options into input structure.\n", __FILE__);
344 sprintf(str_buf,
"IFILE=%s|",
input->ifile);
345 strcat(
input->parms, str_buf);
346 sprintf(str_buf,
"OFILE=%s|",
input->ofile);
347 strcat(
input->parms, str_buf);
348 sprintf(str_buf,
"PALFILE=%s|",
input->palfile);
349 strcat(
input->parms, str_buf);
350 sprintf(str_buf,
"PALETTE_DIR=%s|",
input->palette_dir);
351 strcat(
input->parms, str_buf);
352 sprintf(str_buf,
"PRODUCT_TABLE=%s|",
input->product_table);
353 strcat(
input->parms, str_buf);
354 sprintf(str_buf,
"FLAGUSE=%s|",
input->flaguse);
355 strcat(
input->parms, str_buf);
356 sprintf(str_buf,
"PROD=%s|",
input->prod);
357 strcat(
input->parms, str_buf);
358 sprintf(str_buf,
"STYPE=%d|",
input->stype);
359 strcat(
input->parms, str_buf);
360 sprintf(str_buf,
"DATAMIN=%f|",
input->datamin);
361 strcat(
input->parms, str_buf);
362 sprintf(str_buf,
"DATAMAX=%f|",
input->datamax);
363 strcat(
input->parms, str_buf);
364 sprintf(str_buf,
"WEST=%f|",
input->west);
365 strcat(
input->parms, str_buf);
366 sprintf(str_buf,
"EAST=%f|",
input->east);
367 strcat(
input->parms, str_buf);
368 sprintf(str_buf,
"SOUTH=%f|",
input->south);
369 strcat(
input->parms, str_buf);
370 sprintf(str_buf,
"NORTH=%f|",
input->north);
371 strcat(
input->parms, str_buf);
372 sprintf(str_buf,
"WIDTH=%d|",
input->width);
373 strcat(
input->parms, str_buf);
374 sprintf(str_buf,
"THRESHOLD=%f|",
input->threshold);
375 strcat(
input->parms, str_buf);
376 sprintf(str_buf,
"MASK=%d|",
input->mask);
377 strcat(
input->parms, str_buf);
378 sprintf(str_buf,
"QUALITY=%d|",
input->quality);
379 strcat(
input->parms, str_buf);
380 sprintf(str_buf,
"APPLY_PAL=%d|",
input->apply_pal);
381 strcat(
input->parms, str_buf);
clo_option_t * clo_addOption(clo_optionList_t *list, const char *key, enum clo_dataType_t dataType, const char *defaultVal, const char *desc)
float clo_getOptionFloat(clo_option_t *option)
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 $
char ** clo_getOptionStrings(clo_option_t *option, int *count)
int clo_getOptionInt(clo_option_t *option)
int clo_isOptionSet(clo_option_t *option)
void clo_setHelpStr(const char *str)
char * clo_getOptionString(clo_option_t *option)
clo_option_t * clo_getOption(clo_optionList_t *list, int i)
void clo_readFile(clo_optionList_t *list, const char *fileName)
int clo_getNumOptions(clo_optionList_t *list)
void parse_file_name(const char *inpath, char *outpath)
void clo_setVersion(const char *str)
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
int clo_getOptionBool(clo_option_t *option)