OB.DAAC Logo
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 
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 
185  /* */
186  /* Open input file and get sensor and scan information from handle. */
187  /* */
188  if (openl1(&l1file) != 0) {
189  printf("-E- %s: Error opening %s for reading.\n",
190  argv[0], l1file.name);
191  exit(FATAL_ERROR);
192  }
193 
194  npix = l1file.npix;
195 
196  // Open aerosol file if provided
197 
198  if (input->aerfile[0] != '\0') {
199  aerec->mode = ON;
200  strcpy(aefile.name, input->aerfile);
201  if (open_aer(&aefile) != 0) {
202  printf("-E- %s: Error opening %s for reading.\n",
203  argv[0], aefile.name);
204  exit(FATAL_ERROR);
205  }
206  if (aefile.npix != npix) {
207  printf("-E- %s: Incompatible scan length between %s and %s: %d, %d.\n",
208  argv[0], l1file.name, aefile.name, aefile.npix, npix);
209  exit(FATAL_ERROR);
210  }
211  } else {
212  aerec->mode = OFF;
213  }
214 
215  /* */
216  /* Allocate memory for L1 and L2 scan data and opional input recs */
217  /* */
218  if (alloc_l1(&l1file, l1rec) == 0) {
219  printf("-E- %s: Unable to allocate L1 record.\n", argv[0]);
220  exit(FATAL_ERROR);
221  }
222  if (alloc_l2(l1rec, l2rec) == 0) {
223  printf("-E- %s: Unable to allocate L2 record.\n", argv[0]);
224  exit(FATAL_ERROR);
225  } // Open calibration target file if provided
226 
227  if (input->tgtfile[0] != '\0') {
228  tgrec->mode = ON;
229  strcpy(tgfile.name, input->tgtfile);
230  file_format format = getFormat(tgfile.name);
231  tgfile.format = format.type;
232  tgfile.sensorID = format.sensor_id;
233  tgfile.subsensorID = format.subsensor_id;
234  tgrec->sensorID = format.sensor_id;
235  tgrec->subsensorID = format.subsensor_id;
236 
237  if (tgfile.format != FT_L3BIN) {
238  if (open_target(&tgfile) != 0) {
239  printf("-E- %s: Error opening %s for reading.\n",
240  argv[0], tgfile.name);
241  exit(FATAL_ERROR);
242  }
243  if (tgfile.npix != npix) {
244  printf("-E- %s: Incompatible scan length between %s and %s.\n",
245  argv[0], l1file.name, tgfile.name);
246  exit(FATAL_ERROR);
247  }
248  }
249  l2rec->tgrec = tgrec;
250  } else {
251  tgrec->mode = OFF;
252  l2rec->tgrec = NULL;
253  }
254 
255 
256  if (aerec->mode == ON) {
257  if (alloc_aer(npix, l1file.nbands, aerec) == 0) {
258  printf("-E- %s: Unable to allocate aerfile record.\n", argv[0]);
259  exit(FATAL_ERROR);
260  }
261  }
262  if (tgrec->mode == ON) {
263  if (alloc_target(npix, l1file.nbands, tgrec) == 0) {
264  printf("-E- %s: Unable to allocate target record.\n", argv[0]);
265  exit(FATAL_ERROR);
266  }
267  }
268 
269  /* Set the end pixel if it was not set by command argument */
270  if (l1_input->epixl == -1 || l1_input->epixl > l1file.npix)
271  l1_input->epixl = l1file.npix;
272  if (l1_input->eline == -1 || l1_input->eline > l1file.nscan)
273  l1_input->eline = l1file.nscan;
274  if (l1_input->spixl < 1)
275  l1_input->spixl = 1;
276  if (l1_input->sline < 1)
277  l1_input->sline = 1;
278 
279  spix = MAX(l1_input->spixl - 1, 0);
280  epix = MIN(l1_input->epixl - 1, l1file.npix - 1);
281  dpix = MAX(l1_input->dpixl, 1);
282  sscan = MAX(l1_input->sline - 1, 0);
283  escan = MIN(l1_input->eline - 1, l1file.nscan - 1);
284  dscan = MAX(l1_input->dline, 1);
285 
286  if (sscan > escan || spix > epix) {
287  printf("-E- %s: scan and pixel limits make no sense.\n", argv[0]);
288  printf(" start scan = %d\n", sscan + 1);
289  printf(" end scan = %d\n", escan + 1);
290  printf(" start pixel = %d\n", spix + 1);
291  printf(" end pixel = %d\n", epix + 1);
292  exit(FATAL_ERROR);
293  }
294 
295  /* Note: for the L1 file, npix is still the native scan pixel count */
296  l1file.spix = spix; /* start pixel rel to L1 scan */
297  l1file.epix = epix; /* end pixel rel to L1 scan */
298 
299  /* Make sure number of pixel control points is adequate */
300  if (input->ctl_pt_incr > 0)
301  if (((epix - spix) / dpix + 1) / input->ctl_pt_incr < 25)
302  input->ctl_pt_incr = 1;
303 
304 
305  /* */
306  /* Open output file(s) */
307  /* */
308  if (input->mode != FORWARD) {
309 
310  /* */
311  /* Transfer sensor and scan info to recal filehandle and open */
312  /* */
313  strcpy(ofile[0].name, input->ofile[0]);
314  ofile[0].format = FT_L1HDF;
315  ofile[0].mode = WRITE;
316  ofile[0].sensorID = l1file.sensorID;
317  ofile[0].subsensorID = l1file.subsensorID;
318  ofile[0].nbands = l1file.nbands;
319  ofile[0].nbandsir = l1file.nbandsir;
320  ofile[0].nlvl = l1file.nlvl;
321  ofile[0].bindx = l1file.bindx;
322  ofile[0].ndets = l1file.ndets;
323  ofile[0].spix = spix;
324  ofile[0].epix = epix;
325  ofile[0].npix = (epix - spix) / dpix + 1;
326  ofile[0].length = l1rec->length;
327  ofile[0].nscan = (escan - sscan) / dscan + 1;
328  ofile[0].ctl_pt_incr = input->ctl_pt_incr;
329 
330  printf("Opening L1B output file: %s\n", ofile[0].name);
331 
332  if (openl1(&ofile[0]) != 0) {
333  printf("-E- %s: Error opening %s for writing.\n",
334  argv[0], ofile[0].name);
335  exit(FATAL_ERROR);
336  }
337 
338  } else {
339 
340  /* */
341  /* Transfer sensor and scan info to output filehandles and open */
342  /* */
343  printf("\n");
344  for (i = 0; i < num_ofiles; i++) {
345 
346  strcpy(ofile[i].name, input->ofile[i]);
347  if (strcmp(input->oformat, "netCDF4") == 0)
348  ofile[i].format = FT_L2NCDF;
349  else
350  ofile[i].format = FT_L2HDF;
351  ofile[i].mode = WRITE;
352  ofile[i].sensorID = l1file.sensorID;
353  ofile[i].nbands = l1file.nbands;
354  ofile[i].nbandsir = l1file.nbandsir;
355  ofile[i].nlvl = l1file.nlvl;
356  ofile[i].bindx = l1file.bindx;
357  ofile[i].ndets = l1file.ndets;
358  ofile[i].subsensorID = l1file.subsensorID;
359  strcpy(ofile[i].spatialResolution, l1file.spatialResolution);
360  ofile[i].spix = spix;
361  ofile[i].epix = epix;
362  ofile[i].npix = (epix - spix) / dpix + 1;
363  ofile[i].length = l2rec->length;
364  ofile[i].nscan = (escan - sscan) / dscan + 1;
365  strcpy(ofile[i].l2prod, input->l2prod[i]);
366  strcpy(ofile[i].def_l2prod, input->def_l2prod[i]);
367  ofile[i].ctl_pt_incr = input->ctl_pt_incr;
368 
369  ofile[i].orbit_node_lon = l1file.orbit_node_lon;
370  ofile[i].orbit_number = l1file.orbit_number;
371  ofile[i].node_crossing_time = l1file.node_crossing_time;
372  ofile[i].private_data = l1file.private_data;
373 
374  printf("Opening: %s\n", ofile[i].name);
375  if (openl2(&ofile[i]) != 0) {
376  printf("-E- %s: Error opening %s for writing.\n",
377  argv[0], ofile[i].name);
378  exit(FATAL_ERROR);
379  }
380  }
381  printf("\n");
382  }
383 
384  /* */
385  /* Transfer any additional header info to the record headers */
386  /* */
387  l2rec->bindx = l1file.bindx;
388 
389  printf("\n\nBegin %s Version %d.%d.%d-%s Processing\n", PROGRAM, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, GITSHA);
390  printf("Sensor is %s\n", sensorId2SensorName(l1file.sensorID));
391  printf("Sensor ID is %d\n", l1file.sensorID);
392  printf("Sensor has %d reflective bands\n", l1file.nbands);
393  printf("Sensor has %d emissive bands\n", l1file.nbandsir);
394  printf("Number of along-track detectors per band is %d\n", l1file.ndets);
395  printf("Number of input pixels per scan is %d\n", l1file.npix);
396  printf("Processing pixels %d to %d by %d\n", spix + 1, epix + 1, dpix);
397  printf("Processing scans %d to %d by %d\n", sscan + 1, escan + 1, dscan);
398 
399  if (input->proc_ocean != 0)
400  printf("Ocean processing enabled\n");
401  else
402  printf("Ocean processing disabled\n");
403 
404  if (input->proc_land != 0)
405  printf("Land processing enabled\n");
406  else
407  printf("Land processing disabled\n");
408 
409  if (input->atmocor != 0)
410  printf("Atmospheric correction enabled\n");
411  else
412  printf("Atmospheric correction disabled\n");
413 
414  if (aerec->mode == ON) {
415  printf("Aerosol parameters will be extracted from %s\n",
416  aefile.name);
417  }
418 
419  start_time = now();
420  printf("\nBegin MSl12 processing at %s\n\n", ydhmsf(start_time, 'L'));
421 
422 
423  /* */
424  /* Read file scan by scan, convert to L2, and write. */
425  /* */
426  for (iscan = sscan, oscan = 0; iscan <= escan; iscan += dscan, oscan++) {
427 
428  /* */
429  /* This call returns the specified record, but it internally */
430  /* buffers enough records to facilitate L1B filtering. */
431  /* */
432  if (getl1rec(iscan, dscan, l1rec) != 0) {
433  exit(FATAL_ERROR);
434  }
435 
436  if ((oscan % 50) == 0)
437  printf("Processing scan #%6d (%d of %d) after %6.0f seconds\n",
438  iscan, iscan - sscan + 1, escan - sscan + 1,
439  now() - start_time);
440 
441  if (aerec->mode == ON) {
442  if (read_aer(&aefile, iscan, aerec) != 0) {
443  printf("-E- %s: Error reading %s at scan %d.\n",
444  argv[0], aefile.name, iscan);
445  exit(FATAL_ERROR);
446  }
447  }
448 
449  if (tgrec->mode == ON) {
450  if (tgfile.format == FT_L3BIN) {
451  read_target_l3(&tgfile, l1rec, l1file.nbands, tgrec);
452  } else {
453  if (read_target(&tgfile, iscan, tgrec) != 0) {
454  printf("-E- %s: Error reading %s at scan %d.\n",
455  argv[0], tgfile.name, iscan);
456  exit(FATAL_ERROR);
457  }
458  }
459  }
460 
461  /* */
462  /* Convert the L1B radiances to L2 */
463  /* */
464  convl12(l1rec, l2rec, 0, l1rec->npix - 1, aerec);
465 
466  if (input->mode != FORWARD) {
467 
468  /* */
469  /* Recalibration mode. Read target nLw's for this scan and */
470  /* copy into L2 record. Then reconstruct L1 radiances */
471  /* using the target nLw's and the components of the */
472  /* previous atmospheric correction. */
473  /* */
474  convl21(l2rec, tgrec, 0, l1rec->npix - 1, l1rec->Lt, NULL);
475 
476  /* */
477  /* Write the new L1B record to output file. */
478  /* */
479  if (writel1(&ofile[0], oscan, l1rec) != 0) {
480  printf("-E- %s: error writing to %s\n",
481  argv[0], ofile[0].name);
482  exit(FATAL_ERROR);
483  }
484 
485  } else {
486 
487  /* */
488  /* Forward mode. Write output record to file(s). */
489  /* */
490  for (i = 0; i < num_ofiles; i++)
491  // if (writel2_hdf( &ofile[i], oscan, l2rec) != 0) {
492  if (writel2(&ofile[i], oscan, l2rec, i) != 0) {
493  printf("-E- %s: error writing to %s\n",
494  argv[0], ofile[i].name);
495  exit(FATAL_ERROR);
496  }
497 
498 
499  }
500 
501  }
502 
503  printf("\nEnd MSl12 processing at %s\n", ydhmsf(now(), 'L'));
504  printf("Processing Rate = %f scans/sec\n\n", ofile[0].nscan / (now() - start_time));
505 
506  /* */
507  /* Write SeaWifs-specific data if appropriate */
508  /* */
509  if (l1file.sensorID == SEAWIFS &&
510  (l1file.format == FT_SEAWIFSL1A || l1file.format == FT_L1HDF) &&
511  (ofile[0].format == FT_L2HDF || ofile[0].format == FT_L1HDF)) {
512  printf("Writing SeaWiFS-specific meta-data\n");
513 
514  unsigned char genBuf[8192];
515 
516  bzero(genBuf, sizeof (genBuf));
517  PTB(getHDFattr(l1file.sd_id, "Mission", "", (VOIDP) & genBuf));
518  for (i = 0; i < num_ofiles; i++)
519  PTB(sd_setattr(ofile[i].sd_id, "Mission", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
520 
521  bzero(genBuf, sizeof (genBuf));
522  PTB(getHDFattr(l1file.sd_id, "Mission Characteristics", "", (VOIDP) & genBuf));
523  for (i = 0; i < num_ofiles; i++)
524  PTB(sd_setattr(ofile[i].sd_id, "Mission Characteristics", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
525 
526  bzero(genBuf, sizeof (genBuf));
527  PTB(getHDFattr(l1file.sd_id, "Sensor", "", (VOIDP) & genBuf));
528  for (i = 0; i < num_ofiles; i++)
529  PTB(sd_setattr(ofile[i].sd_id, "Sensor", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
530 
531  bzero(genBuf, sizeof (genBuf));
532  PTB(getHDFattr(l1file.sd_id, "Sensor Characteristics", "", (VOIDP) & genBuf));
533  for (i = 0; i < num_ofiles; i++)
534  PTB(sd_setattr(ofile[i].sd_id, "Sensor Characteristics", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
535 
536  bzero(genBuf, sizeof (genBuf));
537  PTB(getHDFattr(l1file.sd_id, "Data Type", "", (VOIDP) & genBuf));
538  for (i = 0; i < num_ofiles; i++)
539  PTB(sd_setattr(ofile[i].sd_id, "Data Type", DFNT_CHAR, strlen((const char *) genBuf) + 1, (VOIDP) genBuf));
540 
541  int32 l1a_spixl, l1a_dpixl;
542  PTB(getHDFattr(l1file.sd_id, "LAC Pixel Start Number", "", (VOIDP) & l1a_spixl));
543  PTB(getHDFattr(l1file.sd_id, "LAC Pixel Subsampling", "", (VOIDP) & l1a_dpixl));
544 
545  int32 spixl = (l1a_dpixl * spix) + l1a_spixl;
546  int32 dpixl = l1a_dpixl * dpix;
547 
548  for (i = 0; i < num_ofiles; i++) {
549  PTB(sd_setattr(ofile[i].sd_id, "LAC Pixel Start Number", DFNT_INT32, 1, (VOIDP) & spixl));
550  PTB(sd_setattr(ofile[i].sd_id, "LAC Pixel Subsampling", DFNT_INT32, 1, (VOIDP) & dpixl));
551  }
552 
553  }
554 
555  /* */
556  /* Close all files */
557  /* */
558 
559  closel1(&l1file);
560 
561  if (input->mode != FORWARD) {
562  closel1(&ofile[0]);
563  /*
564  if (input->mode != INVERSE_ZERO)
565  close_target();
566  */
567  } else
568  for (i = 0; i < num_ofiles; i++)
569  closel2(&ofile[i]);
570 
571  free_l1(l1rec);
572  free_l2(l2rec);
573  free_l1q();
574  free_deminfo();
575 
576  // free structures
577  free(l1rec);
578  free(l2rec);
579  free(tgrec);
580  free(aerec);
581 
582  // free input internals
583  for(i=0;i<input->fctl.nfilt; i++)
584  free(input->fctl.f[i].kernel);
585  free(input->gsm_aphs);
586  free(input->gsm_aphw);
587  free(input->giop_wave);
588  free(input->giop_rrs_unc);
589  free(input->gain_unc);
590  free(input->taua);
591  free(input->vcal_nLw);
592  free(input->vcal_Lw);
593  free(input->lt_noise_scale);
594  free(input->bias_frac);
595  free(input);
596 
597  printf("\nProcessing Completed\n");
598 
599  return (SUCCESS);
600 }
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:26
#define MIN(x, y)
Definition: rice.h:169
#define OFF
Definition: l1.h:42
#define SUCCESS
Definition: ObpgReadGrid.h:15
int msl12_input(int argc, char *argv[], const char *progName, filehandle *l1file)
Definition: msl12_input.c:4201
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:1499
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:43
int open_aer(filehandle *file)
Definition: aer_io.c:73
void msl12_input_init()
Definition: msl12_input.c:485
int32 nscan
Definition: l1_czcs_hdf.c:19
@ FT_L2NCDF
Definition: filetype.h:23
#define LONLAT_ERROR
Definition: l1.h:49
void bzero()
int l2gen_usage(const char *prog)
Definition: msl12_input.c:4254
#define VERSION_MAJOR
Definition: version.h:1
instr * input
#define FORWARD
Definition: regen_attr.h:12
int openl2(filehandle *l2file)
Definition: l2_generic.c:222
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:988
void free_deminfo()
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
void cdata_()
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
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:6
void parse_file_name(const char *inpath, char *outpath)
void closel1(filehandle *l1file)
Definition: l1_io.c:68
#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:198
#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:15
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:207
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:27
@ FT_L2HDF
Definition: filetype.h:22
@ FT_L3BIN
Definition: filetype.h:24