OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
main_l2brsgen.c
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------------
2  Function: main (MSl2brsgen)
3 
4  Returns: int32 (status)
5  Returns a status code of 0 when successful. Otherwise returns
6  -1 - to indicate get_l2_open/close error
7  -2 - to indicate get_l2_record error
8  -3 - to indicate insufficient memory error
9 
10  Description:
11  The function MSl2brsgen calls level-2 data read routines to access
12  chlorophil data from the level 2 file. After subsampling the data
13  calls level-2 browse data write routine to ouput the level-2 browse
14  product.
15 
16  Arguments: (in calling order)
17  Type Name I/O Description
18  ---- ---- --- -----------
19  char * l2_path I directory path and filename for the
20  level-2 product
21  char * l2brs_path I directory path and filename for the
22  level-2 browse product
23  char * xsub I Pixel subsampling rate
24  char * ysub I Scan subsampling rate
25  char * browse_prod I Browse product name
26  char * rflag I Replacement Flag
27 
28  Notes:
29 
30  Modification history:
31  Programmer Organization Date Description of change
32  -------------- ------------ -------- ---------------------
33  Norman Kuring GSFC (902.3) Original development
34  Lakshmi Kumar Hughes STX 07/14/94 Modified according I/O
35  specs.
36  Lakshmi Kumar Hughes STX 12/10/94 Removed l2_scale and l2_
37  offset fr get_l2_open call
38  (see I/O specs. v4.1)
39  Lakshmi Kumar HITC 05/18/95 Added Tilt and Navigation
40  Vgroups and nav datasets
41  Lakshmi Kumar Hughes STX 07/25/95 Added code to subsample
42  l2_flags and pass it to
43  put_l2brs routine
44  Lakshmi Kumar Hughes STX 11/01/95 Added output arguments
45  "orbit" & "mskflg" to
46  get_l2_open call
47  Added input arguments
48  flag_names & mskflg to
49  put_l2brs call
50  Lakshmi Kumar Hughes STX 01/11/96 Missing data pixels are
51  marked by setting its
52  value = -9E6 .
53  Lat/Lon for pixels with
54  nav_flag set are reset to
55  NAVERR_VAL = -999.0
56  Norman Kuring GSFC (902) 02/10/98 nav_flag no longer affects
57  outline coordinates.
58  Robert Lindsay SAIC GSC 08/17/00 modified to exit if file
59  file has no chlor_a SDS
60 
61  Joel Gales Futuretech 03/01/01 Added support for other
62  sensors
63 
64  Joel Gales Futuretech 09/05/06 Added support for sst
65  qual check
66 
67  Joel Gales Futuretech 09/20/06 Added support for sst4
68  qual check
69 
70  Joel Gales SAIC 04/22/21 Added support for
71  multiple bands per pixel
72 ----------------------------------------------------------------------------*/
73 
74 #include "l2brsgen.h"
75 
76 #include <unistd.h>
77 #include <strings.h>
78 
79 #include <timeutils.h>
80 #include <genutils.h>
81 #include <get_product_table.h>
82 
83 // the real bad lat lon value is -999, but we don't want to do an exact check on
84 // a float, so value bigger than -900 is a good check
85 #define BAD_LAT_LON -900.0
86 
87 char ERR_MSG[1024];
88 
89 static float initialLonVal = -180.0;
90 
91 /* this function is used when comparing lons to see if the lon is. The lons
92  * are rotated such that the first lon in the range is zero then normalized
93  * from 0 to 360 */
94 static float normalizeLon(float lon) {
95  lon -= initialLonVal;
96  while (lon < 0.0)
97  lon += 360.0;
98  while (lon >= 360.0)
99  lon -= 360.0;
100  return lon;
101 }
102 
108 static void setMaxLon(float *max, float val) {
109  if (val > BAD_LAT_LON) {
110  if (normalizeLon(val) > normalizeLon(*max))
111  *max = val;
112  }
113 }
114 
120 static void setMinLon(float *min, float val) {
121  if (val > BAD_LAT_LON) {
122  if (normalizeLon(val) < normalizeLon(*min))
123  *min = val;
124  }
125 }
126 
132 static void setMaxLat(float *max, float val) {
133  if (val > BAD_LAT_LON) {
134  if (val > *max)
135  *max = val;
136  }
137 }
138 
144 static void setMinLat(float *min, float val) {
145  if (val > BAD_LAT_LON) {
146  if (val < *min)
147  *min = val;
148  }
149 }
150 
156 static void setGoodLL(float *good, float val) {
157  if (val > BAD_LAT_LON) {
158  *good = val;
159  }
160 }
161 
162 int main(int32 argc, char *argv[]) {
163  int status;
164  char l2_path[FILENAME_MAX];
165  char ofile[FILENAME_MAX];
166  short syear, sday, eyear, eday;
167  int smsec, emsec;
168  char dtype[8], *flag_names = NULL;
169  int nrec, nsamp;
170  int32_t brs_nrec, brs_nsamp;
171  int32_t brs_crec;
172  int32_t max_rec_used, max_samp_used;
173  int ntilts;
174  short *tilt_ranges;
175 
176  static meta_l2Type meta_l2;
177  int i;
178  int32 *l2brs_flags, *flags;
179  float32 *pix, *qual_pix;
180  int rec, samp, brs_rec, brs_samp;
181  int start_samp, start_rec, xsub = 2, ysub = 2, qual = 999;
182  int end_samp, end_rec;
183  int center_samp;
184  int spixl, epixl, sline, eline;
185  float32 *l2brs_data, *data;
186  float *px_ll_first, *px_ll_last, *sc_ll_first, *sc_ll_last;
187  float *top, *bottom, *left, *right;
188  int16 *lat, *lon;
189  char infiles[MAXVAL], *sp;
190  char proc_con[4096];
191  char replaces[MAXVAL], ptime[17];
192  int32 apply_pal = 0;
193  char palfile[MAXVAL];
194  char palette_dir[FILENAME_MAX];
195  char product_table[FILENAME_MAX];
196  const char* oformat;
197  int firstLoop;
198 
199  int16 *brs_lat = NULL, *brs_lon = NULL;
200  char *flaguse, *chl_flags, *sst_flags;
201 
202  const float MISSING_DATAFLAG = -9.1E6;
203  char browse_prod[128] = "chlor_a";
204  char qual_prod1[128] = "qual_sst";
205  char qual_prod2[128] = "qual_sst4";
206  unsigned char palette[256 * 3];
207  short r[256], g[256], b[256];
208 
209  static l2_prod l2_str;
210  int32 prod_index;
211  int32 qual_index;
212 
213  char* timePtr;
214 
215  product_table_t *ptable = NULL;
216  int32_t ptable_size = 0;
217  int32_t ptable_index = -1;
218  product_table_t *ptable_rec;
219  product_table_t tmp_ptable;
220 
222 
223  /* hold all of the command line options */
227 
228  /* make it print help if no options supplied */
229  if (argc == 1) {
231  exit(1);
232  }
233 
234  /* make it print version if -version or --version */
235  if (strcmp(argv[1], "-version") == 0 || strcmp(argv[1], "--version") == 0) {
237  exit(1);
238  }
239 
240  if (l2brsgen_read_options(list, argc, argv, &l2_str, &meta_l2) != 0) {
242  exit(1);
243  }
244 
245  proc_con[0] = 0;
246  for (i = 0; i < argc; i++) {
247  strcat(proc_con, argv[i]);
248  strcat(proc_con, " ");
249  }
250 
251  parse_file_name(clo_getString(list, "ifile"), l2_path);
253  strcpy(browse_prod, clo_getString(list, "prod"));
254  qual = clo_getInt(list, "quality");
255  strcpy(replaces, clo_getString(list, "rflag"));
256  spixl = clo_getInt(list, "spixl");
257  epixl = clo_getInt(list, "epixl");
258  xsub = clo_getInt(list, "dpixl");
259  sline = clo_getInt(list, "sline");
260  eline = clo_getInt(list, "eline");
261  ysub = clo_getInt(list, "dline");
262  apply_pal = clo_getBool(list, "apply_pal");
263  if (clo_isSet(list, "palfile")) {
264  apply_pal = 1;
265  }
266  strcpy(palfile, clo_getString(list, "palfile"));
267  parse_file_name(clo_getString(list, "palette_dir"), palette_dir);
268  parse_file_name(clo_getString(list, "product_table"), product_table);
269 
270  /* Read product table */
271  ptable = get_product_table(product_table, &ptable_size);
272  if (ptable == NULL) {
273  fprintf(stderr, "l2brsgen - error reading product table \"%s\"\n", product_table);
274  exit(1);
275  }
276 
277  ptable_index = search_product_table(ptable, ptable_size, browse_prod);
278  if (ptable_index == -1) {
279  if (clo_isSet(list, "datamin") &&
280  clo_isSet(list, "datamax") &&
281  clo_isSet(list, "stype")) {
282  tmp_ptable.description = strdup(browse_prod);
283  tmp_ptable.min = clo_getFloat(list, "datamin");
284  tmp_ptable.max = clo_getFloat(list, "datamax");
285  tmp_ptable.name = strdup(browse_prod);
286  tmp_ptable.palette = strdup(palfile);
287  tmp_ptable.precision = strdup("F");
288  if (clo_getInt(list, "stype") == 2)
289  tmp_ptable.scaling = strdup("logarithmic");
290  else
291  tmp_ptable.scaling = strdup("linear");
292 
293  tmp_ptable.units = strdup("unknown");
294  ptable_rec = &tmp_ptable;
295  } else {
296  fprintf(stderr, "l2brsgen - error finding \"%s\" in product table \"%s\" and datamin, datamax, stype not set.\n",
297  browse_prod, product_table);
298  exit(1);
299  }
300  } else {
301  ptable_rec = ptable + ptable_index;
302  }
303 
304  /* over ride values in the product table */
305  if (strcasecmp(palfile, "default") != 0) {
306  free(ptable_rec->palette);
307  ptable_rec->palette = strdup(palfile);
308  }
309  if (clo_isSet(list, "datamin"))
310  ptable_rec->min = clo_getFloat(list, "datamin");
311 
312  if (clo_isSet(list, "datamax"))
313  ptable_rec->max = clo_getFloat(list, "datamax");
314 
315  if (clo_isSet(list, "stype")) {
316  free(ptable_rec->scaling);
317  if (clo_getInt(list, "stype") == 2)
318  ptable_rec->scaling = strdup("logarithmic");
319  else
320  ptable_rec->scaling = strdup("linear");
321  }
322 
323  flaguse = NULL;
324  if (clo_isSet(list, "flaguse")) {
325  flaguse = clo_getRawString(list, "flaguse");
326  }
327  chl_flags = clo_getRawString(list, "chl_flags");
328  sst_flags = clo_getRawString(list, "sst_flags");
329 
330  oformat = getFileFormatName(clo_getString(list, "oformat"));
331 
332  /* print out some useful information */
333  if (clo_isSet(list, "par")) {
334  fprintf(stderr, "par=%s\n", clo_getString(list, "par"));
335  }
336  fprintf(stderr, "ifile=%s\n", l2_path);
337  fprintf(stderr, "ofile=%s\n", ofile);
338  fprintf(stderr, "prod=%s\n", browse_prod);
339  fprintf(stderr, "oformat=%s\n", oformat);
340 
341  /* Read palette file */
342  strcpy(palfile, palette_dir);
343  strcat(palfile, "/");
344  strcat(palfile, ptable_rec->palette);
345  strcat(palfile, ".pal");
346 
347  if (getlut_file(palfile, r, g, b)) {
348  fprintf(stderr, "l2brsgen: Error reading palette file %s\n", palfile);
349  exit(1);
350  }
351  for (i = 0; i < 256; i++) {
352  palette[i * 3] = r[i];
353  palette[i * 3 + 1] = g[i];
354  palette[i * 3 + 2] = b[i];
355  }
356 
357  // already opened by l2brsgen_read_options
358  //status = openL2(l2_path, 0x0, &l2_str);
359 
360  syear = l2_str.syear;
361  sday = l2_str.sday;
362  smsec = l2_str.smsec;
363  eyear = l2_str.eyear;
364  eday = l2_str.eday;
365  emsec = l2_str.emsec;
366  nrec = l2_str.nrec;
367  nsamp = l2_str.nsamp;
368 
369  flag_names = (char *) calloc(strlen(l2_str.flagnames) + 1, sizeof (char));
370  strcpy(flag_names, l2_str.flagnames);
371 
372  ntilts = l2_str.ntilts;
373  tilt_ranges = (short *) calloc(20 * 2, sizeof (short));
374  for (i = 0; i < ntilts; i++) {
375  tilt_ranges[2 * i] = l2_str.tilt_ranges[0][i];
376  tilt_ranges[2 * i + 1] = l2_str.tilt_ranges[1][i];
377  }
378 
379  strcpy(dtype, l2_str.dtype);
380 
381  // already loaded by l2brsgen_read_options
382  //status = readL2meta(&meta_l2, 0);
383 
384  /* Get the current time and represent it in the format yyyydddhhmmssfff */
385  get_time(ptime);
386 
387  /* Set starting (X,Y) position of browse data */
388  start_samp = spixl - 1;
389  if (start_samp < 0)
390  start_samp = 0;
391  end_samp = epixl - 1;
392  if (end_samp < 0)
393  end_samp = nsamp - 1;
394  if (start_samp >= end_samp) {
395  fprintf(stderr, "l2brsgen: spixel (%d) needs to be less than epixl (%d)",
396  start_samp + 1, end_samp + 1);
397  fprintf(stderr, " cntl_pt_cols ");
398  exit(1);
399  }
400 
401  start_rec = sline - 1;
402  if (start_rec < 0)
403  start_rec = 0;
404  end_rec = eline - 1;
405  if (end_rec < 0)
406  end_rec = nrec - 1;
407  if (start_rec >= end_rec) {
408  fprintf(stderr, "l2brsgen: sline (%d) needs to be less than eline (%d)",
409  start_rec + 1, end_rec + 1);
410  fprintf(stderr, " cntl_pt_cols ");
411  exit(1);
412  }
413 
414  /* Compute browse image dimensions */
415  brs_nrec = (end_rec - start_rec) / ysub + 1;
416  brs_nsamp = (end_samp - start_samp) / xsub + 1;
417 
418  /* Compute the maximum record and sample numbers used to make the subsampled
419  browse output. */
420  max_rec_used = (brs_nrec - 1) * ysub + start_rec;
421  max_samp_used = (brs_nsamp - 1) * xsub + start_samp;
422 
423  /* compute the center coodinates */
424  brs_crec = brs_nrec / 2;
425  center_samp = ((max_samp_used - start_samp) / 2) + start_samp;
426 
427  if ((brs_lat = (int16 *) calloc(brs_nrec * brs_nsamp, sizeof (int16))) == NULL) {
428  fprintf(stderr, "\nl2brsgen: Calloc error while allocating memory for");
429  fprintf(stderr, " brs_lat ");
430  exit(MEMERR);
431  }
432  lat = brs_lat;
433 
434  if ((brs_lon = (int16 *) calloc(brs_nrec * brs_nsamp, sizeof (int16))) == NULL) {
435  fprintf(stderr, "\nl2brsgen: Calloc error while allocating memory for");
436  fprintf(stderr, " brs_lon ");
437  exit(MEMERR);
438  }
439  lon = brs_lon;
440 
441  /* Allocate memory for accumulation of output data. */
442  l2brs_data = (float32 *) malloc(brs_nrec * brs_nsamp * sizeof (float32));
443  if (l2brs_data == NULL) {
444  fprintf(stderr, "\nError: In allocating memory\n");
445  exit(MEMERR);
446  }
447  data = l2brs_data;
448 
449  /* Allocate memory for accumulation of level2 flags */
450  l2brs_flags = (int32 *) malloc(brs_nrec * brs_nsamp * sizeof (int32));
451  if (l2brs_flags == NULL) {
452  fprintf(stderr, "\nError: In allocating memory\n");
453  exit(MEMERR);
454  }
455  flags = l2brs_flags;
456 
457  /* Allocate memory for accumulation of output coordinates. */
458  px_ll_first = (float *) malloc(2 * brs_nsamp * sizeof (float));
459  px_ll_last = (float *) malloc(2 * brs_nsamp * sizeof (float));
460  sc_ll_first = (float *) malloc(2 * brs_nrec * sizeof (float));
461  sc_ll_last = (float *) malloc(2 * brs_nrec * sizeof (float));
462  if (!(px_ll_first && px_ll_last && sc_ll_first && sc_ll_last)) {
463  fprintf(stderr, "\nError: In allocating memory\n");
464  exit(MEMERR);
465  }
466 
467  /* The following four names are somewhat arbitrary but intuitive. */
468  top = px_ll_first;
469  bottom = px_ll_last;
470  left = sc_ll_first;
471  right = sc_ll_last;
472 
473  prod_index = findprod(&l2_str, browse_prod);
474  qual_index = findprod(&l2_str, qual_prod1);
475  if (qual_index == -1) {
476  qual_index = findprod(&l2_str, qual_prod2);
477  }
478 
479  /* if no browse SDS in input file, quit and go home */
480 
481  if (prod_index == -1) {
482  fprintf(stderr, "\n Error: Browse product (%s) not found in input file \n", browse_prod);
483 
484  /* Close the level 2 input file. */
485  status = closeL2(&l2_str, 0);
486 
487  /* Deallocate some memory */
488  free(l2brs_data);
489  free(px_ll_first);
490  free(px_ll_last);
491  free(sc_ll_first);
492  free(sc_ll_last);
493  free(l2brs_flags);
494  free(flag_names);
495  free(brs_lat);
496  free(brs_lon);
497  free(tilt_ranges);
498 
499  status = freeL2meta(&meta_l2);
500 
501  exit(MEMERR);
502  }
503 
504  /* set the initial lon before the loop and before resetting westlon. Also
505  * nudge the init point to the west a little bit for roundoff error. */
506  setGoodLL(&initialLonVal, meta_l2.westlon);
507 
508  firstLoop = 1;
509 
510  /* Read the level 2 data into memory one line at a time
511  * skipping lines according to the line subsampling factor. */
512  rec = start_rec;
513  for (brs_rec = 0; brs_rec < brs_nrec; brs_rec++) {
514 
515  status = readL2(&l2_str, 0, rec, -1, NULL);
516  pix = l2_str.l2_data[prod_index];
517  if (strncmp(browse_prod, "sst", 3) == 0 && qual_index != -1)
518  qual_pix = l2_str.l2_data[qual_index];
519  else
520  qual_pix = NULL;
521 
522  samp = start_samp;
523  for (brs_samp = 0; brs_samp < brs_nsamp; brs_samp++) {
524 
525  if (qual_pix && qual_pix[samp] > qual)
526  *data = MISSING_DATAFLAG;
527  else
528  *data = pix[samp];
529 
530  *flags = l2_str.l2_flags[samp];
531  if (l2_str.latitude[samp] > BAD_LAT_LON)
532  *lat = (int16) roundf(l2_str.latitude[samp] * 360.0);
533  else
534  *lat = -32768;
535  if (l2_str.longitude[samp] > BAD_LAT_LON)
536  *lon = (int16) roundf(l2_str.longitude[samp] * 180.0);
537  else
538  *lon = -32768;
539 
540  if (rec == start_rec) {
541  *top++ = l2_str.latitude[samp];
542  *top++ = l2_str.longitude[samp];
543  }
544  if (rec == max_rec_used) {
545  *bottom++ = l2_str.latitude[samp];
546  *bottom++ = l2_str.longitude[samp];
547  }
548 
549  /* reset the lat and lon limits first time through */
550  if (firstLoop) {
551  firstLoop = 0;
552  meta_l2.northlat = l2_str.latitude[samp];
553  meta_l2.southlat = l2_str.latitude[samp];
554  meta_l2.westlon = l2_str.longitude[samp];
555  meta_l2.eastlon = l2_str.longitude[samp];
556  }
557 
558  /* set the min and max lat and lon*/
559  setMaxLat(&meta_l2.northlat, l2_str.latitude[samp]);
560  setMinLat(&meta_l2.southlat, l2_str.latitude[samp]);
561  setMaxLon(&meta_l2.eastlon, l2_str.longitude[samp]);
562  setMinLon(&meta_l2.westlon, l2_str.longitude[samp]);
563 
564  lat++;
565  lon++;
566  flags++;
567  data++;
568  samp += xsub;
569  } // for brs_samp
570 
571  /* Save the ground coordinates of the two ends of this scan. */
572  *left++ = l2_str.latitude[start_samp];
573  *left++ = l2_str.longitude[start_samp];
574  *right++ = l2_str.latitude[max_samp_used];
575  *right++ = l2_str.longitude[max_samp_used];
576 
577  /* start record */
578  if (brs_rec == 0) {
579  syear = l2_str.year;
580  sday = l2_str.day;
581  smsec = l2_str.msec;
582 
583  // only change the metadata values if the lat lons are valid
584  setGoodLL(&meta_l2.startclat, l2_str.latitude[center_samp]);
585  setGoodLL(&meta_l2.startclon, l2_str.longitude[center_samp]);
586  }
587 
588  /* center record */
589  if (brs_rec == brs_crec) {
590  meta_l2.ncrec = rec;
591  if (l2_str.year != -999 && l2_str.day != -999 && l2_str.msec != -999) {
592  timePtr = unix2ydhmsf(yds2unix(l2_str.year, l2_str.day, l2_str.msec / 1000.0), 'G');
593  if (meta_l2.ctime)
594  free(meta_l2.ctime);
595  meta_l2.ctime = strdup(timePtr);
596  }
597  // only change the metadata values if the lat lons are valid
598 
599  // How do I get the solar zenith ??
600  // meta_l2.scsol_z = l2_str.
601 
602  } // if center record
603 
604  // store these for every line, that way the last valid value will
605  // be saved. Sometimes the last few lines are bad.
606  setGoodLL(&meta_l2.endclat, l2_str.latitude[center_samp]);
607  setGoodLL(&meta_l2.endclon, l2_str.longitude[center_samp]);
608  if (l2_str.year != -999 && l2_str.day != -999 && l2_str.msec != -999) {
609  eyear = l2_str.year;
610  eday = l2_str.day;
611  emsec = l2_str.msec;
612  }
613 
614  rec += ysub;
615  } // for brs_rec
616 
617 
618 
619  /* Write out a level 2 browse file */
620 
621  sp = strrchr(l2_path, '/'); /* write product name without path*/
622  if (sp == NULL)
623  strcpy(infiles, l2_path);
624  else
625  strcpy(infiles, ++sp);
626 
627  if (flaguse == NULL) {
628  if (strncmp(browse_prod, "chl", 3) == 0) {
629  flaguse = chl_flags;
630  } else if (strncmp(browse_prod, "sst", 3) == 0) {
631  flaguse = sst_flags;
632  }
633  }
634 
635  status = put_l2brs(ofile, replaces, ptime, infiles, start_samp + 1, end_samp + 1, xsub,
636  brs_nsamp, start_rec + 1, end_rec + 1, ysub, brs_nrec, browse_prod, l2brs_data,
637  l2brs_flags, flag_names, flaguse, palette, px_ll_first, px_ll_last,
638  sc_ll_first, sc_ll_last, proc_con, syear, sday, smsec, eyear, eday,
639  emsec, dtype, nrec, nsamp, ntilts, &l2_str.tilt_flags[0],
640  tilt_ranges, brs_lat, brs_lon, &meta_l2, ptable_rec, oformat, apply_pal);
641 
642  if (status < 0)
643  fprintf(stderr, "\n Error: put_l2brs unsuccessful\n");
644 
645  /* Close the level 2 input file. */
646  status = closeL2(&l2_str, 0);
647 
648  /* Deallocate some memory */
649 
650  free(l2brs_data);
651  free(px_ll_first);
652  free(px_ll_last);
653  free(sc_ll_first);
654  free(sc_ll_last);
655  free(l2brs_flags);
656  free(flag_names);
657  free(brs_lat);
658  free(brs_lon);
659  free(tilt_ranges);
660 
661  status = freeL2meta(&meta_l2);
662 
663  return SUCCEED;
664 }
665 
integer, parameter int16
Definition: cubeio.f90:3
int r
Definition: decode_rs.h:73
int16 eday
Definition: l1_czcs_hdf.c:17
char * clo_getString(clo_optionList_t *list, const char *key)
Definition: clo.c:1357
int status
Definition: l1_czcs_hdf.c:32
double yds2unix(int16_t year, int16_t day, double secs)
Definition: yds2unix.c:7
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
Definition: CMakeLists.txt:7
int32_t search_product_table(product_table_t *table, int32_t num_entries, char *name)
These are used to scale the SD before writing it to the HDF4 file The default is and which means the product is not scaled at all Since the product is usually stored as a float inside of this is a way to write the float out as a integer l2prod min
int l2brsgen_read_options(clo_optionList_t *list, int argc, char *argv[], l2_prod *l2_str, meta_l2Type *meta_l2)
#define MAXVAL
Definition: l3stat.h:13
int16_t * qual
Definition: l2bin.cpp:86
#define NULL
Definition: decode_rs.h:63
char * unix2ydhmsf(double usec, char zone)
Definition: unix2ydhmsf.c:8
int clo_isSet(clo_optionList_t *list, const char *key)
Definition: clo.c:2270
float * lat
int16 eyear
Definition: l1_czcs_hdf.c:17
int syear
Definition: l1_czcs_hdf.c:15
int main(int32 argc, char *argv[])
int32_t freeL2meta(meta_l2Type *meta_l2)
Definition: readL2scan.c:2255
int32_t readL2(l2_prod *l2_str, int32_t ifile, int32_t recnum, int32_t iprod, unsigned char *scan_in_rowgroup)
Definition: readL2scan.c:1250
int32 smsec
Definition: l1_czcs_hdf.c:16
int clo_getInt(clo_optionList_t *list, const char *key)
Definition: clo.c:1393
int32_t closeL2(l2_prod *l2_str, int32_t ifile)
Definition: readL2scan.c:1936
int sday
Definition: l1_czcs_hdf.c:15
int32 put_l2brs(char *l2brs_path, char *replaces, char *ptime, char *infiles, int32 px_start, int32 px_end, int32 px_subsamp, int32 brs_nsamp, int32 sc_start, int32 sc_end, int32 sc_subsamp, int32 brs_nrec, char *l2brs_name, float32 *l2brs_data, int32 *l2brs_flags, char *flag_names, char *mskflg, unsigned char *palette, float32 *px_ll_first, float32 *px_ll_last, float32 *sc_ll_first, float32 *sc_ll_last, char *proc_con, int16 syear, int16 sday, int32 smsec, int16 eyear, int16 eday, int32 emsec, char *dtype, int32 nrec, int32 nsamp, int32 ntilts, short *tilt_flags, int16 *tilt_ranges, int16 *cntl_pt_lat, int16 *cntl_pt_lon, meta_l2Type *meta_l2, product_table_t *ptable_rec, const char *oformat, int32 apply_pal)
Definition: put_l2brs.c:137
int setlinebuf(FILE *stream)
product_table_t * get_product_table(char *file_name, int32_t *num_entries)
clo_optionList_t * clo_createList()
Definition: clo.c:532
void get_time(char *pr_time)
Definition: get_time.c:28
const char * getFileFormatName(const char *str)
char * strdup(const char *)
float clo_getFloat(clo_optionList_t *list, const char *key)
Definition: clo.c:1429
void clo_printUsage(clo_optionList_t *list)
Definition: clo.c:1988
char ERR_MSG[1024]
Definition: main_l2brsgen.c:87
int l2brsgen_init_options(clo_optionList_t *list)
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
#define MEMERR
Definition: l2brsgen.h:23
void parse_file_name(const char *inpath, char *outpath)
data_t b[NROOTS+1]
Definition: decode_rs.h:77
int getlut_file(char *lut_file, short *rlut, short *glut, short *blut)
Definition: getlut_file.c:8
int32 emsec
Definition: l1_czcs_hdf.c:18
flags
Definition: DDAlgorithm.h:22
dtype
Definition: DDataset.hpp:31
char * flag_names[]
Definition: l2lists.h:46
void clo_setEnableExtraOptions(int val)
Definition: clo.c:429
#define BAD_LAT_LON
Definition: main_l2brsgen.c:85
float * lon
char * clo_getRawString(clo_optionList_t *list, const char *key)
Definition: clo.c:1339
int clo_getBool(clo_optionList_t *list, const char *key)
Definition: clo.c:1375
int i
Definition: decode_rs.h:71
msiBandIdx val
Definition: l1c_msi.cpp:34
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
void clo_printVersion()
Definition: clo.c:1968
int32_t findprod(l2_prod *l2_str, char *prodname)
Definition: readL2scan.c:2071
l2prod max