NASA Logo
Ocean Color Science Software

ocssw V2022
main_l2gen.c
Go to the documentation of this file.
1 /* =====================================================================*/
2 /* */
3 /* Program: MSl12 - multi-sensor level-1b to level-2 conversion */
4 /* */
5 /* Usage: */
6 /* See msl12_usage(). */
7 /* */
8 /* Written By: */
9 /* */
10 /* Bryan A. Franz */
11 /* SAIC General Sciences Corp. */
12 /* NASA/SIMBIOS Project */
13 /* March 1998 */
14 /* */
15 /* Modified By: */
16 /* */
17 /* Joel M. Gales */
18 /* Futuretech */
19 /* NASA/SIMBIOS Project */
20 /* September 1999 */
21 /* Add support for SeaWifs specific L2 metadata */
22 /* */
23 /* =====================================================================*/
24 
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <fcntl.h>
28 #include <string.h>
29 #include <errno.h>
30 #include <unistd.h>
31 #include <libgen.h>
32 #include "l12_proto.h"
33 #include "lonlat2pixline.h"
34 #include "version.h"
35 #include "geo_region.h"
36 /* -------------------------------------------------------------------- */
37 /* main */
38 
39 /* -------------------------------------------------------------------- */
40 int main(int argc, char* argv[]) {
41  int32_t iscan = 0; /* input scan number */
42  int32_t oscan = 0; /* output scan number */
43  int32_t npix = 0; /* input number pixels per scan */
44  int32_t spix = 0; /* start pixel for subscene process */
45  int32_t epix = -1; /* end pixel for subscene process */
46  int32_t dpix = 1; /* pixel increment for sub-sampling */
47  int32_t sscan = 0; /* start scan for subscene process */
48  int32_t escan = -1; /* end scan for subscene process */
49  int32_t dscan = 1; /* scan subsampling increment */
50 
51  l1str *l1rec; /* generic level-1b scan structure */
52  l2str *l2rec; /* generic level-2 scan structure */
53  tgstr *tgrec; /* structure to store target values */
54  aestr *aerec; /* structure to store aerosol values */
55 
56  filehandle l1file; /* input l1 file handle */
57  filehandle tgfile; /* input target file handle */
58  filehandle aefile; /* input aerosol file handle */
59  filehandle ofile[MAX_OFILES]; /* output file handles */
60 
61  double start_time;
62  int num_ofiles = 0;
63  int32_t i;
64 
65  if (argc == 1) {
66  l2gen_usage("l2gen");
67  return 0;
68  }
69 
70  for (i = 0; i < argc; i++) {
71  // see if help on command line
72  if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "-help") == 0)) {
73  l2gen_usage("l2gen");
74  return 0;
75  }
76 
77  // see if prodxmlfile is on command line
78  if (strncmp(argv[i], "prodxmlfile=", 12) == 0) {
79  char fname[FILENAME_MAX];
80 
81  parse_file_name(argv[i] + 12, fname);
82  init_l2prod();
83  printf("Writing product information to XML file %s\n", fname);
85  return 0;
86  }
87  }
88 
89  setvbuf(stdout, NULL, _IOLBF, 0);
90  setvbuf(stderr, NULL, _IOLBF, 0);
91 
92  // allocate structures
93  l1rec = (l1str*) malloc(sizeof (l1str));
94  l2rec = (l2str*) malloc(sizeof (l2str));
95  tgrec = (tgstr*) malloc(sizeof (tgstr));
96  aerec = (aestr*) malloc(sizeof (aestr));
98 
99  if (!l1rec || !l2rec || !tgrec || !aerec || !input) {
100  printf("-E- %s %d: Error allocating data structures.\n", __FILE__, __LINE__);
101  exit(EXIT_FAILURE);
102  }
103 
104  /* Initialize file handles */
105  // cdata_();
107  filehandle_init(&tgfile);
108  filehandle_init(&aefile);
109  for (i = 0; i < MAX_OFILES; i++)
111 
112  /* Parse input parameters */
113  if (msl12_input(argc, argv, "msl12", &l1file) != 0) {
114  printf("-E- %s: Error parsing input parameters.\n", argv[0]);
115  exit(FATAL_ERROR);
116  }
117 
118  if (access(input->ifile[0], F_OK) || access(input->ifile[0], R_OK)) {
119  printf("-E- %s: Input file '%s' does not exist or cannot open.\n",
120  argv[0], input->ifile[0]);
121  exit(FATAL_ERROR);
122  }
123 
124  /* if north, south, east, and west used, convert to pix and line */
125  if (input->north != -999 || input->south != -999
126  || input->east != -999 || input->west != -999
127  || input->xbox != -1 || input->ybox != -1) {
128 
129  int result;
130  int save_verbose = want_verbose;
131 
132  // turn off the extra output
133  want_verbose = 0;
134  if (input->north != -999 && input->south != -999
135  && input->east != -999 && input->west != -999
136  && input->xbox == -1 && input->ybox == -1) {
137 
138  // north, south, east and west are set
139  result = lonlat2pixline1(input->ifile[0], input->geofile,
140  l1_input->resolution, input->west, input->south, input->east, input->north,
141  &l1_input->spixl, &l1_input->epixl, &l1_input->sline, &l1_input->eline);
142 
143  } else if (input->north == -999 && input->south != -999
144  && input->east == -999 && input->west != -999
145  && input->xbox != -1 && input->ybox != -1) {
146 
147  // south, west, xbox, ybox are set
148  result = lonlat2pixline2(input->ifile[0], input->geofile,
149  l1_input->resolution, input->west, input->south, input->xbox, input->ybox,
150  &l1_input->spixl, &l1_input->epixl, &l1_input->sline, &l1_input->eline);
151 
152  } else {
153  printf("-E- %s: set either \n", argv[0]);
154  printf(" 1) north, south, east and west or\n");
155  printf(" 2) south, west, xbox, ybox\n");
156  exit(FATAL_ERROR);
157  }
158  want_verbose = save_verbose;
159 
160  if (result == 120) { // requested box includes the whole file
161  l1_input->spixl = 1;
162  l1_input->epixl = -1;
163  l1_input->sline = 1;
164  l1_input->eline = -1;
165  } else {
166  if (result != 0 && result != 110) {
167  printf("-E- %s: north, south, east, west box not in this file.\n", argv[0]);
168  exit(LONLAT_ERROR);
169  }
170  }
171  }
172 
173  /* */
174  /* Determine number of output files. */
175  /* */
176  for (i = 0, num_ofiles = 0; i < MAX_OFILES; i++, num_ofiles++)
177  if (input->ofile[i][0] == '\0')
178  break;
179 
180  if (num_ofiles == 0) {
181  printf("-E- %s: No output file name given\n", argv[0]);
182  exit(FATAL_ERROR);
183  }
184 
189  if(input->georegionfile[0]) {
190  if (access(input->georegionfile, F_OK) || access(input->georegionfile, R_OK)) {
191  printf("-E- %s: Input file '%s' does not exist or cannot open.\n",
192  argv[0], input->georegionfile);
193  exit(FATAL_ERROR);
194  }
195  }
196 
197  /* */
198  /* Open input file and get sensor and scan information from handle. */
199  /* */
200  if (openl1(&l1file) != 0) {
201  printf("-E- %s: Error opening %s for reading.\n",
202  argv[0], l1file.name);
203  exit(FATAL_ERROR);
204  }
205 
206  npix = l1file.npix;
207 
208  // Open aerosol file if provided
209 
210  if (input->aerfile[0] != '\0') {
211  aerec->mode = ON;
212  strcpy(aefile.name, input->aerfile);
213  if (open_aer(&aefile) != 0) {
214  printf("-E- %s: Error opening %s for reading.\n",
215  argv[0], aefile.name);
216  exit(FATAL_ERROR);
217  }
218  if (aefile.npix != npix) {
219  printf("-E- %s: Incompatible scan length between %s and %s: %d, %d.\n",
220  argv[0], l1file.name, aefile.name, aefile.npix, npix);
221  exit(FATAL_ERROR);
222  }
223  } else {
224  aerec->mode = OFF;
225  }
226 
227  /* */
228  /* Allocate memory for L1 and L2 scan data and opional input recs */
229  /* */
230  if (alloc_l1(&l1file, l1rec) == 0) {
231  printf("-E- %s: Unable to allocate L1 record.\n", argv[0]);
232  exit(FATAL_ERROR);
233  }
234  if (alloc_l2(l1rec, l2rec) == 0) {
235  printf("-E- %s: Unable to allocate L2 record.\n", argv[0]);
236  exit(FATAL_ERROR);
237  } // Open calibration target file if provided
238 
239  if (input->tgtfile[0] != '\0') {
240  tgrec->mode = ON;
241  strcpy(tgfile.name, input->tgtfile);
242  file_format format = getFormat(tgfile.name);
243  tgfile.format = format.type;
244  tgfile.sensorID = format.sensor_id;
245  tgfile.subsensorID = format.subsensor_id;
246  tgrec->sensorID = format.sensor_id;
247  tgrec->subsensorID = format.subsensor_id;
248 
249  if (tgfile.format != FT_L3BIN) {
250  if (open_target(&tgfile) != 0) {
251  printf("-E- %s: Error opening %s for reading.\n",
252  argv[0], tgfile.name);
253  exit(FATAL_ERROR);
254  }
255  if (tgfile.npix != npix) {
256  printf("-E- %s: Incompatible scan length between %s and %s.\n",
257  argv[0], l1file.name, tgfile.name);
258  exit(FATAL_ERROR);
259  }
260  }
261  l2rec->tgrec = tgrec;
262  } else {
263  tgrec->mode = OFF;
264  l2rec->tgrec = NULL;
265  }
266 
267 
268  if (aerec->mode == ON) {
269  if (alloc_aer(npix, l1file.nbands, aerec) == 0) {
270  printf("-E- %s: Unable to allocate aerfile record.\n", argv[0]);
271  exit(FATAL_ERROR);
272  }
273  }
274  if (tgrec->mode == ON) {
275  if (alloc_target(npix, l1file.nbands, tgrec) == 0) {
276  printf("-E- %s: Unable to allocate target record.\n", argv[0]);
277  exit(FATAL_ERROR);
278  }
279  }
280 
281  /* Set the end pixel if it was not set by command argument */
282  if (l1_input->epixl == -1 || l1_input->epixl > l1file.npix)
283  l1_input->epixl = l1file.npix;
284  if (l1_input->eline == -1 || l1_input->eline > l1file.nscan)
285  l1_input->eline = l1file.nscan;
286  if (l1_input->spixl < 1)
287  l1_input->spixl = 1;
288  if (l1_input->sline < 1)
289  l1_input->sline = 1;
290 
291  spix = MAX(l1_input->spixl - 1, 0);
292  epix = MIN(l1_input->epixl - 1, l1file.npix - 1);
293  dpix = MAX(l1_input->dpixl, 1);
294  sscan = MAX(l1_input->sline - 1, 0);
295  escan = MIN(l1_input->eline - 1, l1file.nscan - 1);
296  dscan = MAX(l1_input->dline, 1);
297 
298  if (sscan > escan || spix > epix) {
299  printf("-E- %s: scan and pixel limits make no sense.\n", argv[0]);
300  printf(" start scan = %d\n", sscan + 1);
301  printf(" end scan = %d\n", escan + 1);
302  printf(" start pixel = %d\n", spix + 1);
303  printf(" end pixel = %d\n", epix + 1);
304  exit(FATAL_ERROR);
305  }
306 
307  /* Note: for the L1 file, npix is still the native scan pixel count */
308  l1file.spix = spix; /* start pixel rel to L1 scan */
309  l1file.epix = epix; /* end pixel rel to L1 scan */
310 
311  /* */
312  /* Open output file(s) */
313  /* */
314  if (input->mode != FORWARD) {
315 
316  /* */
317  /* Transfer sensor and scan info to recal filehandle and open */
318  /* */
319  strcpy(ofile[0].name, input->ofile[0]);
320  ofile[0].format = FT_L1HDF;
321  ofile[0].mode = WRITE;
322  ofile[0].sensorID = l1file.sensorID;
323  ofile[0].subsensorID = l1file.subsensorID;
324  ofile[0].nbands = l1file.nbands;
325  ofile[0].nbandsir = l1file.nbandsir;
326  ofile[0].nlvl = l1file.nlvl;
327  ofile[0].bindx = l1file.bindx;
328  ofile[0].ndets = l1file.ndets;
329  ofile[0].spix = spix;
330  ofile[0].epix = epix;
331  ofile[0].npix = (epix - spix) / dpix + 1;
332  ofile[0].length = l1rec->length;
333  ofile[0].nscan = (escan - sscan) / dscan + 1;
334 
335  printf("Opening L1B output file: %s\n", ofile[0].name);
336 
337  if (openl1(&ofile[0]) != 0) {
338  printf("-E- %s: Error opening %s for writing.\n",
339  argv[0], ofile[0].name);
340  exit(FATAL_ERROR);
341  }
342 
343  } else {
344 
345  /* */
346  /* Transfer sensor and scan info to output filehandles and open */
347  /* */
348  printf("\n");
349  for (i = 0; i < num_ofiles; i++) {
350 
351  strcpy(ofile[i].name, input->ofile[i]);
352  if (strcmp(input->oformat, "netCDF4") == 0)
353  ofile[i].format = FT_L2NCDF;
354  else
355  ofile[i].format = FT_L2HDF;
356  ofile[i].mode = WRITE;
357  ofile[i].sensorID = l1file.sensorID;
358  ofile[i].nbands = l1file.nbands;
359  ofile[i].nbandsir = l1file.nbandsir;
360  ofile[i].nlvl = l1file.nlvl;
361  ofile[i].bindx = l1file.bindx;
362  ofile[i].ndets = l1file.ndets;
363  ofile[i].subsensorID = l1file.subsensorID;
364  strcpy(ofile[i].spatialResolution, l1file.spatialResolution);
365  ofile[i].spix = spix;
366  ofile[i].epix = epix;
367  ofile[i].npix = (epix - spix) / dpix + 1;
368  ofile[i].length = l2rec->length;
369  ofile[i].nscan = (escan - sscan) / dscan + 1;
370  strcpy(ofile[i].l2prod, input->l2prod[i]);
371  strcpy(ofile[i].def_l2prod, input->def_l2prod[i]);
372 
373  ofile[i].orbit_node_lon = l1file.orbit_node_lon;
374  ofile[i].orbit_number = l1file.orbit_number;
375  ofile[i].node_crossing_time = l1file.node_crossing_time;
376  ofile[i].private_data = l1file.private_data;
377 
378  printf("Opening: %s\n", ofile[i].name);
379  if (openl2(&ofile[i]) != 0) {
380  printf("-E- %s: Error opening %s for writing.\n",
381  argv[0], ofile[i].name);
382  exit(FATAL_ERROR);
383  }
384  }
385  printf("\n");
386  }
387 
388  /* */
389  /* Transfer any additional header info to the record headers */
390  /* */
391  l2rec->bindx = l1file.bindx;
392 
393  printf("\n\nBegin %s Version %d.%d.%d-%s Processing\n", PROGRAM, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, GITSHA);
394  printf("Sensor is %s\n", sensorId2SensorName(l1file.sensorID));
395  printf("Sensor ID is %d\n", l1file.sensorID);
396  printf("Sensor has %d reflective bands\n", l1file.nbands);
397  printf("Sensor has %d emissive bands\n", l1file.nbandsir);
398  printf("Number of along-track detectors per band is %d\n", l1file.ndets);
399  printf("Number of input pixels per scan is %d\n", l1file.npix);
400  printf("Processing pixels %d to %d by %d\n", spix + 1, epix + 1, dpix);
401  printf("Processing scans %d to %d by %d\n", sscan + 1, escan + 1, dscan);
402 
403  if (input->proc_ocean != 0)
404  printf("Ocean processing enabled\n");
405  else
406  printf("Ocean processing disabled\n");
407 
408  if (input->proc_land != 0)
409  printf("Land processing enabled\n");
410  else
411  printf("Land processing disabled\n");
412 
413  if (input->atmocor != 0)
414  printf("Atmospheric correction enabled\n");
415  else
416  printf("Atmospheric correction disabled\n");
417 
418  if (aerec->mode == ON) {
419  printf("Aerosol parameters will be extracted from %s\n",
420  aefile.name);
421  }
422 
423  start_time = now();
424  printf("\nBegin MSl12 processing at %s\n\n", ydhmsf(start_time, 'L'));
425 
426 
427  /* */
428  /* Read file scan by scan, convert to L2, and write. */
429  /* */
430  for (iscan = sscan, oscan = 0; iscan <= escan; iscan += dscan, oscan++) {
431 
432  /* */
433  /* This call returns the specified record, but it internally */
434  /* buffers enough records to facilitate L1B filtering. */
435  /* */
436  if (getl1rec(iscan, dscan, l1rec) != 0) {
437  exit(FATAL_ERROR);
438  }
439 
440  if ((oscan % 50) == 0)
441  printf("Processing scan #%6d (%d of %d) after %6.0f seconds\n",
442  iscan, iscan - sscan + 1, escan - sscan + 1,
443  now() - start_time);
444 
445  if (aerec->mode == ON) {
446  if (read_aer(&aefile, iscan, aerec) != 0) {
447  printf("-E- %s: Error reading %s at scan %d.\n",
448  argv[0], aefile.name, iscan);
449  exit(FATAL_ERROR);
450  }
451  }
452 
453  if (tgrec->mode == ON) {
454  if (tgfile.format == FT_L3BIN) {
455  read_target_l3(&tgfile, l1rec, l1file.nbands, tgrec);
456  } else {
457  if (read_target(&tgfile, iscan, tgrec) != 0) {
458  printf("-E- %s: Error reading %s at scan %d.\n",
459  argv[0], tgfile.name, iscan);
460  exit(FATAL_ERROR);
461  }
462  }
463  }
464 
465  /* */
466  /* Convert the L1B radiances to L2 */
467  /* */
468  convl12(l1rec, l2rec, 0, l1rec->npix - 1, aerec);
469 
470  if (input->mode != FORWARD) {
471 
472  /* */
473  /* Recalibration mode. Read target nLw's for this scan and */
474  /* copy into L2 record. Then reconstruct L1 radiances */
475  /* using the target nLw's and the components of the */
476  /* previous atmospheric correction. */
477  /* */
478  convl21(l2rec, tgrec, 0, l1rec->npix - 1, l1rec->Lt, NULL);
479 
480  /* */
481  /* Write the new L1B record to output file. */
482  /* */
483  if (writel1(&ofile[0], oscan, l1rec) != 0) {
484  printf("-E- %s: error writing to %s\n",
485  argv[0], ofile[0].name);
486  exit(FATAL_ERROR);
487  }
488 
489  } else {
490 /* Alex S. : writel2 is not just writing the output files but calls prodgen */
491  /* */
492  /* Forward mode. Write output record to file(s). */
493  /* */
494  for (i = 0; i < num_ofiles; i++)
495  // if (writel2_hdf( &ofile[i], oscan, l2rec) != 0) {
496  if (writel2(&ofile[i], oscan, l2rec, i) != 0) {
497  printf("-E- %s: error writing to %s\n",
498  argv[0], ofile[i].name);
499  exit(FATAL_ERROR);
500  }
501 
502 
503  }
504 
505  }
506 
507  printf("\nEnd MSl12 processing at %s\n", ydhmsf(now(), 'L'));
508  printf("Processing Rate = %f scans/sec\n\n", ofile[0].nscan / (now() - start_time));
509 
510  /* */
511  /* Write SeaWifs-specific data if appropriate */
512  /* */
513  if (l1file.sensorID == SEAWIFS &&
514  (l1file.format == FT_SEAWIFSL1A || l1file.format == FT_L1HDF) &&
515  (ofile[0].format == FT_L2HDF || ofile[0].format == FT_L1HDF)) {
516  printf("Writing SeaWiFS-specific meta-data\n");
517 
518  unsigned char genBuf[8192];
519 
520  bzero(genBuf, sizeof (genBuf));
521  PTB(getHDFattr(l1file.sd_id, "Mission", "", (VOIDP) & genBuf));
522  for (i = 0; i < num_ofiles; i++)
523  PTB(sd_setattr(ofile[i].sd_id, "Mission", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
524 
525  bzero(genBuf, sizeof (genBuf));
526  PTB(getHDFattr(l1file.sd_id, "Mission Characteristics", "", (VOIDP) & genBuf));
527  for (i = 0; i < num_ofiles; i++)
528  PTB(sd_setattr(ofile[i].sd_id, "Mission Characteristics", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
529 
530  bzero(genBuf, sizeof (genBuf));
531  PTB(getHDFattr(l1file.sd_id, "Sensor", "", (VOIDP) & genBuf));
532  for (i = 0; i < num_ofiles; i++)
533  PTB(sd_setattr(ofile[i].sd_id, "Sensor", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
534 
535  bzero(genBuf, sizeof (genBuf));
536  PTB(getHDFattr(l1file.sd_id, "Sensor Characteristics", "", (VOIDP) & genBuf));
537  for (i = 0; i < num_ofiles; i++)
538  PTB(sd_setattr(ofile[i].sd_id, "Sensor Characteristics", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
539 
540  bzero(genBuf, sizeof (genBuf));
541  PTB(getHDFattr(l1file.sd_id, "Data Type", "", (VOIDP) & genBuf));
542  for (i = 0; i < num_ofiles; i++)
543  PTB(sd_setattr(ofile[i].sd_id, "Data Type", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
544 
545  int32 l1a_spixl, l1a_dpixl;
546  PTB(getHDFattr(l1file.sd_id, "LAC Pixel Start Number", "", (VOIDP) & l1a_spixl));
547  PTB(getHDFattr(l1file.sd_id, "LAC Pixel Subsampling", "", (VOIDP) & l1a_dpixl));
548 
549  int32 spixl = (l1a_dpixl * spix) + l1a_spixl;
550  int32 dpixl = l1a_dpixl * dpix;
551 
552  for (i = 0; i < num_ofiles; i++) {
553  PTB(sd_setattr(ofile[i].sd_id, "LAC Pixel Start Number", DFNT_INT32, 1, (VOIDP) & spixl));
554  PTB(sd_setattr(ofile[i].sd_id, "LAC Pixel Subsampling", DFNT_INT32, 1, (VOIDP) & dpixl));
555  }
556 
557  }
558 
559  /* */
560  /* Close all files */
561  /* */
562  // closing the geo_mask file
563  if(input->georegionfile[0]){
565  }
566  closel1(&l1file);
567 
568  if (input->mode != FORWARD) {
569  closel1(&ofile[0]);
570  /*
571  if (input->mode != INVERSE_ZERO)
572  close_target();
573  */
574  } else
575  for (i = 0; i < num_ofiles; i++)
576  closel2(&ofile[i]);
577 
578  free_l1(l1rec);
579  free_l2(l2rec);
580  free_l1q();
581  free_deminfo();
582 
583  // free structures
584  free(l1rec);
585  free(l2rec);
586  free(tgrec);
587  free(aerec);
588 
589  // free input internals
590  for(i=0;i<input->fctl.nfilt; i++)
591  free(input->fctl.f[i].kernel);
592  free(input->gsm_aphs);
593  free(input->gsm_aphw);
594  free(input->giop_wave);
595  free(input->giop_rrs_unc);
596  free(input->taua);
597  free(input->vcal_nLw);
598  free(input->vcal_Lw);
599  free(input);
600 
601  printf("\nProcessing Completed\n");
602 
603  return (SUCCESS);
604 }
char * ydhmsf(double dtime, char zone)
Definition: ydhmsf.c:12
int32 l1file(int32 sdfid, int32 *nsamp, int32 *nscans, int16 *dtynum)
Definition: l1stat_chk.c:586
#define MAX(A, B)
Definition: swl0_utils.h:25
#define MIN(x, y)
Definition: rice.h:169
#define OFF
Definition: l1.h:43
#define SUCCESS
Definition: ObpgReadGrid.h:15
int msl12_input(int argc, char *argv[], const char *progName, filehandle *l1file)
Definition: msl12_input.c:4359
void free_l2(l2str *l2rec)
Definition: alloc_l2.c:7
int main(int argc, char *argv[])
Definition: main_l2gen.c:40
int closel2(filehandle *l2file)
Definition: l2_generic.c:1440
int alloc_aer(int32_t npix, int32_t nbands, aestr *rec)
Definition: alloc_aer.c:12
int read_target(filehandle *file, int32_t recnum, tgstr *tgrec)
Definition: target_io.c:105
#define VERSION_MINOR
Definition: version.h:2
#define NULL
Definition: decode_rs.h:63
void filehandle_init(filehandle *file)
int read_aer(filehandle *file, int32_t recnum, aestr *aerec)
Definition: aer_io.c:99
read l1rec
@ FT_SEAWIFSL1A
Definition: filetype.h:47
int open_target(filehandle *file)
Definition: target_io.c:79
#define GITSHA
Definition: version.h:4
int writel1(filehandle *l1file, int32_t recnum, l1str *l1rec)
int lonlat2pixline2(char *input_filename, char *geo_filename, int32_t resolution, float lon, float lat, int32_t dx, int32_t dy, int32_t *spixl, int32_t *epixl, int32_t *sline, int32_t *eline)
#define VERSION_PATCH
Definition: version.h:3
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT32
#define ON
Definition: l1.h:44
int open_aer(filehandle *file)
Definition: aer_io.c:73
void msl12_input_init()
Definition: msl12_input.c:495
int32 nscan
Definition: l1_czcs_hdf.c:19
@ FT_L2NCDF
Definition: filetype.h:23
#define LONLAT_ERROR
Definition: l1.h:50
void bzero()
int l2gen_usage(const char *prog)
Definition: msl12_input.c:4414
#define VERSION_MAJOR
Definition: version.h:1
instr * input
#define FORWARD
Definition: regen_attr.h:12
int openl2(filehandle *l2file)
Definition: l2_generic.c:181
void close_georegion_file()
Definition: geo_region.cpp:47
int alloc_target(int32_t npix, int32_t nbands, tgstr *rec)
Definition: alloc_target.c:12
int sd_setattr(int32_t id, const char *nam, int32_t typ, int32_t cnt, const void *data)
Definition: hdf_utils.c:216
int alloc_l2(l1str *l1rec, l2str *l2rec)
Definition: alloc_l2.c:17
int writel2(filehandle *l2file, int32_t recnum, l2str *l2rec, int outfile_number)
Definition: l2_generic.c:939
int read_target_l3(filehandle *file, l1str *l1rec, int32_t nbands, tgstr *tgrec)
Definition: target_io.c:209
file_format getFormat(char *filename)
Definition: filetype.c:192
int convl12(l1str *l1rec, l2str *l2rec, int32_t spix, int32_t epix, aestr *aerec)
Definition: convl12.c:16
l1_input_t * l1_input
Definition: l1_options.c:9
int getHDFattr(int32_t fileID, const char attrname[], const char sdsname[], void *data)
#define FATAL_ERROR
Definition: swl0_parms.h:5
void free_deminfo()
int lonlat2pixline1(char *input_filename, char *geo_filename, int32_t resolution, float SWlon, float SWlat, float NElon, float NElat, int32_t *spixl, int32_t *epixl, int32_t *sline, int32_t *eline)
INT32 getl1rec(INT16 sceneFrameNum, swl0scene *scene, swl0ctl *l0ctl, input_sType navinp[], navblk_sType navblk[], tilt_states_sType *tiltblk, swl1rec l1rec[])
Definition: getl1rec.c:45
int want_verbose
#define PTB(function)
Definition: passthebuck.h:16
void init_l2prod()
void free_l1(l1str *l1rec)
Definition: alloc_l1.c:7
void parse_file_name(const char *inpath, char *outpath)
void closel1(filehandle *l1file)
Definition: l1_io.c:73
#define WRITE
Definition: create_Vdata.c:7
void write_product_XML_file(char *filename)
int32 dpix
Definition: l1_czcs_hdf.c:22
const char * sensorId2SensorName(int sensorId)
Definition: sensorInfo.c:273
#define MAX_OFILES
Definition: l12_parms.h:14
int32 spix
Definition: l1_czcs_hdf.c:21
int32_t iscan
u5 which has been done in the LOCALGRANULEID metadata should have an extension NRT It is requested to identify the NRT production Changes from v6 which may affect scientific the sector rotation may actually occur during one of the scans earlier than the one where it is first reported As a the b1 values are about the LOCALGRANULEID metadata should have an extension NRT It is requested to identify the NRT to fill pixels affected by dead subframes with a special value Output the metadata of noisy and dead subframe Dead Subframe EV and Detector Quality Flag2 Removed the function call of Fill_Dead_Detector_SI to stop interpolating SI values for dead but also for all downstream products for science test only Changes from v5 which will affect scientific to conform to MODIS requirements Removed the Mixed option from the ScanType in the code because the L1A Scan Type is never Mixed Changed for ANSI C compliance and comments to better document the fact that when the HDF_EOS metadata is stricly the and products are off by and in the track respectively Corrected some misspelling of RCS swir_oob_sending_detector to the Reflective LUTs to enable the SWIR OOB correction detector so that if any of the sending detectors becomes noisy or non near by good detectors from the same sending band can be specified as the substitute in the new look up table Code change for adding an additional dimension of mirror side to the Band_21_b1 LUT to separate the coefficient of the two mirror sides for just like other thermal emissive so that the L1B code can calibrate Band scan to scan with mirror side dependency which leads better calibration result Changes which do not affect scientific when the EV data are not provided in this Crosstalk Correction will not be performed to the Band calibration data Changes which do not affect scientific and BB_500m in L1A Logic was added to turn off the or to spatial aggregation processes and the EV_250m_Aggr1km_RefSB and EV_500m_Aggr1km_RefSB fields were set to fill values when SDSs EV_250m and EV_500m are absent in L1A file Logic was added to skip the processing and turn off the output of the L1B QKM and HKM EV data when EV_250m and EV_500m are absent from L1A In this the new process avoids accessing and reading the and L1A EV skips and writing to the L1B and EV omits reading and subsampling SDSs from geolocation file and writing them to the L1B and omits writing metadata to L1B and EV and skips closing the L1A and L1B EV and SDSs Logic was added to turn off the L1B OBC output when the high resolution OBC SDSs are absent from L1A This is accomplished by skipping the openning the writing of metadata and the closing of the L1B OBC hdf which is Bit in the scan by scan bit QA has been changed Until now
Definition: HISTORY.txt:361
@ FT_L1HDF
Definition: filetype.h:20
int convl21(l2str *l2rec, tgstr *tgrec, int32_t spix, int32_t epix, float *vLt, vcstr *vrec)
Definition: convl21.c:15
int32 epix
Definition: l1_czcs_hdf.c:23
int32_t alloc_l1(filehandle *l1file, l1str *l1rec)
Definition: alloc_l1.c:18
void free_l1q()
Definition: getl1rec.c:13
#define PROGRAM
Definition: ice2hdf.c:10
#define SEAWIFS
Definition: sensorDefs.h:12
int i
Definition: decode_rs.h:71
int openl1(filehandle *l1file)
Definition: l1_io.c:230
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
int npix
Definition: get_cmp.c:28
@ FT_L2HDF
Definition: filetype.h:22
@ FT_L3BIN
Definition: filetype.h:24