NASA Logo
Ocean Color Science Software

ocssw V2022
l3binmerge.cpp
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <math.h>
4 #include <time.h>
5 #include <libgen.h>
6 #include <sys/types.h>
7 
8 #include "netcdf.h"
9 
10 #include "l3bin_input.h"
11 #include <timeutils.h>
12 #include <genutils.h>
13 
14 #include "hdf_bin.h"
15 
16 #include <hdf.h>
17 #include <mfhdf.h>
18 
19 #define MAXNFILES 128
20 
21 #define BYTE unsigned char
22 
23 #define BINCHECK -1
24 
25 #define VERSION "2.1"
26 
27 static instr input;
28 
29 /*
30 
31  Revision 2.1 12/5/2016
32  Updated with the CLO library
33  R. Healy
34 
35  Revision 2.0 08/29/2016
36  Converted to 64 bit integer version
37  R. Healy
38 
39  Revision 1.03 06/19/2014
40  Added support for netCDF4 files
41  S. Bailey
42 
43  Revision 1.02 08/16/12
44  Add "-u" switch (Union of input bins)
45  J. Gales
46 
47  Revision 1.01 03/21/12
48  Replace last_prod with prod_offset[]
49  J. Gales
50 
51  Revision 1.00 03/18/12
52  Initial Version
53  J. Gales
54  */
55 
56 
57 int main(int argc, char **argv) {
58  intn i;
59 
60  int32_t irow;
61  int32_t kbin;
62  int32_t iprod;
63 
64  int32_t ifile, nfiles;
65 
66  int32_t nread;
67  int32_t offset;
68  int32_t offset_out;
69  int32_t offmin;
70  int32_t offmax;
71  int64_t bin_num;
72  int64_t bin_num_out;
73  int32_t row_write;
74  int32_t n_write_total = 0;
75  int32_t n_write = 0;
76  int32_t nprod[MAXNFILES];
77  int32_t ncols;
78  int32_t ncols_out;
79 
80  int32_t nrows;
81 
82  float wgt;
83  float *sort_array[MAXNVDATA];
84 
85  char buf[FILENAME_MAX];
86 
87  float *in_sum_buf[MAXNVDATA - 2];
88  float *out_sum_buf[MAXNVDATA - 2];
89 
90  int status;
91 
92  char *ptime = ydhmsf(now(), 'G');
93  char proc_con[2048];
94 
95  char prodname[MAXNVDATA - 2][FILENAME_MAX];
96 
97  float f32;
98 
99  float minlon;
100  float maxlon;
101  float minlat;
102  float maxlat;
103 
104  float lat;
105 
106  time_t tnow;
107  struct tm *tmnow;
108 
109  FILE *fp;
110 
111  uint8 *nfiles_contribute;
112 
114 
115  printf("%s %s (%s %s)\n", "L3BINMERGE", VERSION, __DATE__, __TIME__);
116 
117  if (l3bin_input(argc, argv, &input, "l3binmerge", VERSION) != 0) {
118  exit(EXIT_FAILURE);
119  }
120 
121  // get_time(ptime);
122 
123  input.unit_wgt = 1;
124  bool case_u = input.union_bins;
125 
126  strcpy(proc_con, argv[0]);
127  for (i = 1; i < argc; i++) {
128  strcat(proc_con, " ");
129  strcat(proc_con, argv[i]);
130  }
131 
132  if (input.loneast <= input.lonwest) {
133  printf("loneast: %f must be greater than lonwest: %f.\n", input.loneast,
134  input.lonwest);
135  exit(EXIT_FAILURE);
136  }
137 
138  if (input.latnorth <= input.latsouth) {
139  printf("latnorth: %f must be greater than latsouth: %f.\n",
140  input.latnorth, input.latsouth);
141  exit(EXIT_FAILURE);
142  }
143 
144  /* Get lon/lat limits */
145  minlon = input.lonwest;
146  maxlon = input.loneast;
147  minlat = input.latsouth;
148  maxlat = input.latnorth;
149 
150  /* Determine number of input files */
151  /* ------------------------------- */
152  nfiles = 0;
153 
154  bool isHDF4 = false;
155  bool isHDF5 = false;
156  bool isCDF4 = false;
157 
158  Hdf::hdf_bin * input_binfile[MAXNFILES];
159 
160  fp = fopen(input.infile, "r");
161  if (fp == NULL) {
162  printf("Input listing file: \"%s\" not found.\n", input.infile);
163  return -1;
164  }
165  while (fgets(buf, 256, fp) != NULL)
166  nfiles++;
167  fclose(fp);
168  printf("%d input files\n", nfiles);
169 
170  /* Open L3 input files */
171  /* ------------------- */
172  uint32_t tot_nprod = 0;
173  uint32_t prod_offset[256];
174  fp = fopen(input.infile, "r");
175  for (ifile = 0; ifile < nfiles; ifile++) {
176  fgets(buf, 256, fp);
177  buf[strlen(buf) - 1] = 0;
178 
179  if (ifile == 0) {
180  if (Hishdf(buf) == TRUE)
181  isHDF4 = true;
182  if (H5Fis_hdf5(buf) == TRUE) {
183  int ncid;
184  char nam_buf[256];
185  status = nc_open(buf, NC_NOWRITE, &ncid);
186  if (status != NC_NOERR) {
187  isHDF5 = true;
188  } else {
189  status = nc_get_att(ncid, NC_GLOBAL, "Mission", nam_buf);
190  if (strcmp(nam_buf, "SAC-D Aquarius") == 0) {
191  isHDF5 = true;
192  } else {
193  isCDF4 = true;
194  }
195  nc_close(ncid);
196  }
197  }
198  }
199 
200  if (isHDF4)
201  input_binfile[ifile] = new Hdf::hdf4_bin;
202  if (isHDF5)
203  input_binfile[ifile] = new Hdf::hdf5_bin;
204  if (isCDF4)
205  input_binfile[ifile] = new Hdf::cdf4_bin;
206 
207  if (ifile == 0)
208  prod_offset[ifile] = 0;
209  else
210  prod_offset[ifile] = prod_offset[ifile - 1] + nprod[ifile - 1];
211 
212  printf("%d %s\n", ifile, buf);
213  input_binfile[ifile]->open(buf);
214  nprod[ifile] = input_binfile[ifile]->nprod();
215  for (iprod = 0; iprod < nprod[ifile]; iprod++) {
216  input_binfile[ifile]->get_prodname(iprod, prodname[tot_nprod]);
217  input_binfile[ifile]->active_data_prod[iprod] = true;
218  ;
219  tot_nprod++;
220  }
221  //printf("open status: %d\n", status);
222 
223  } /* ifile loop */
224 
225  fclose(fp);
226 
227  nrows = input_binfile[0]->nrows;
228 
229  /* Create output file */
230  /* ------------------ */
231  Hdf::hdf_bin *output_binfile;
232 
233  if (getFileFormatName(input.oformat) == NULL) {
234  if (isHDF4)
235  strcpy(input.oformat, "HDF4");
236  if (isHDF5)
237  strcpy(input.oformat, "HDF5");
238  if (isCDF4)
239  strcpy(input.oformat, "netCDF4");
240  }
241 
242  strcpy(buf, input.ofile);
243 
244  if (strcmp(input.oformat, "HDF4") == 0) {
245  output_binfile = new Hdf::hdf4_bin;
246  output_binfile->hasNoext = false;
247  if (input.noext == 0)
248  strcat(buf, ".main");
249  else
250  output_binfile->hasNoext = true;
251  }
252  if (strcmp(input.oformat, "HDF5") == 0)
253  output_binfile = new Hdf::hdf5_bin;
254  if (strcmp(input.oformat, "netCDF4") == 0)
255  output_binfile = new Hdf::cdf4_bin;
256 
257  char* tmpProdNames[tot_nprod];
258  for (uint32_t i = 0; i < tot_nprod; i++) {
259  tmpProdNames[i] = prodname[i];
260  }
261  output_binfile->setProductList(tot_nprod, tmpProdNames);
262  output_binfile->create(buf, nrows);
263  if (isCDF4)
264  output_binfile->deflate = input.deflate;
265 
266  if (input.noext == 0)
267  strcat(buf, ".main");
268 
269  /* Allocate I/O buffers */
270  /* -------------------- */
271  ncols = 2 * nrows;
272  ncols_out = 2 * nrows;
273 
274  for (iprod = 0; iprod < (int) tot_nprod; iprod++) {
275  in_sum_buf[iprod] = (float *) calloc(ncols, 2 * sizeof (float));
276  out_sum_buf[iprod] = (float *) calloc(ncols_out, 2 * sizeof (float));
277  } /* iprod loop */
278 
279  nfiles_contribute = (uint8 *) calloc(ncols_out, sizeof (uint8));
280 
281  /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
282  /* For each scan ... (Main Loop) */
283  /* ----------------------------- */
284  for (irow = 0; irow < nrows; irow++) {
285 
286  if ((irow % 500) == 0) {
287  time(&tnow);
288  tmnow = localtime(&tnow);
289  printf("irow:%6d of %8d %s", irow, nrows, asctime(tmnow));
290  }
291 
292  // Get basebin and numbin for this input row
293  int64_t basebin = input_binfile[0]->get_basebin(irow);
294  int64_t numbin = input_binfile[0]->get_numbin(irow);
295 
296  /* Clear output binlist and sum buffers */
297  /* ------------------------------------ */
298  row_write = 0;
299 
300  output_binfile->clear_binlist();
301  for (iprod = 0; iprod < (int32_t) tot_nprod; iprod++) {
302  memset(&out_sum_buf[iprod][0], 0, ncols_out * 2 * sizeof (float));
303  } /* iprod loop */
304 
305  if (case_u) {
306  for (iprod = 0; iprod < (int32_t) tot_nprod; iprod++) {
307  for (i = 0; i < ncols_out * 2; i++) {
308  out_sum_buf[iprod][i] = -32767.0;
309  }
310  }
311  }
312 
313  memset(nfiles_contribute, 0, ncols_out * sizeof (uint8));
314 
315  /* Get bin info */
316  /* ------------ */
317  for (ifile = 0; ifile < nfiles; ifile++) {
318  input_binfile[ifile]->readBinIndex(irow);
319 
320  int ext = input_binfile[ifile]->get_ext();
321  if (ext == 0)
322  continue;
323 
324  /* Read BinList */
325  /* ------------ */
326  nread = input_binfile[ifile]->readBinList(ext);
327 
328  if (nread == -1) {
329  printf("Unable to read bin numbers...: %d\n", ext);
330  }
331  } /* ifile loop */
332 
333  /* For each file ... */
334  /* ----------------- */
335  for (ifile = 0; ifile < nfiles; ifile++) {
336 
337  int64_t beg = input_binfile[ifile]->get_beg();
338  int ext = input_binfile[ifile]->get_ext();
339 
340  /* ========== If row has data ... ========== */
341  /* ----------------------------------------- */
342  if (beg != 0) {
343  /* printf("row has data: %d\n", irow);*/
344 
345  /* Determine lon kbin limits */
346  /* ------------------------- */
347  offmin = (int32_t) ((minlon + 180) * (numbin / 360.0) + 0.5);
348  offmax = (int32_t) ((maxlon + 180) * (numbin / 360.0) + 0.5);
349 
350  /* Get data values (sum, sum_sq) for each filled bin in row */
351  /* -------------------------------------------------------- */
352  int nbins_to_read = ext;
353  for (iprod = 0; iprod < nprod[ifile]; iprod++) {
354  input_binfile[ifile]->readSums(&in_sum_buf[iprod][0],
355  nbins_to_read, iprod);
356  } /* iprod loop */
357 
358  if (isHDF5 || isCDF4)
359  input_binfile[ifile]->setDataPtr(nbins_to_read);
360  // row_write = 1;
361 
362  /* Skip row if not between minlat & maxlat */
363  lat = ((irow + 0.5) / nrows) * 180.0 - 90.0;
364  if (lat < minlat || lat > maxlat) {
365  // row_write = 0;
366  continue;
367  }
368 
369  /* Fill output buffers with input bin data */
370  /* --------------------------------------- */
371  for (kbin = 0; kbin < ext; kbin++) {
372 
373  /* Store bin number */
374  /* ---------------- */
375  bin_num = input_binfile[ifile]->get_bin_num(kbin);
376  offset = bin_num - basebin;
377 
378  /* If bin outside lon range then skip */
379  /* ---------------------------------- */
380  if (offset < offmin || offset > offmax)
381  continue;
382 
383  float weights = input_binfile[ifile]->get_weights(kbin);
384 
385  /* Skip if not good enough */
386  /* ----------------------- */
387  // Assign output offset & bin number
388  offset_out = offset;
389  bin_num_out = bin_num;
390 
391  if (offset_out >= ncols_out) {
392  printf("Bad write to BINLIST: %d %d %d %d\n", ifile,
393  irow, ncols_out, offset_out);
394  exit(EXIT_FAILURE);
395  }
396 
397  nfiles_contribute[offset_out]++;
398 
399  output_binfile->set_bin_num(offset_out, bin_num_out);
400  row_write = 1;
401 
402  /* Sum & store number of observations,nscenes */
403  /* ------------------------------------------ */
404  int nobs = input_binfile[ifile]->get_nobs(kbin);
405  output_binfile->inc_nobs(offset_out, nobs);
406  int nscenes = input_binfile[ifile]->get_nscenes(kbin);
407  output_binfile->inc_nscenes(offset_out, nscenes);
408 
409  /* Sum & store weights */
410  /* ------------------- */
411  if (input.unit_wgt || input.median) {
412  output_binfile->set_weights(offset_out, 1);
413  } else {
414  output_binfile->inc_weights(offset_out, weights);
415  }
416 
417  /* Product loop */
418  /* ------------ */
419  for (iprod = 0; iprod < nprod[ifile]; iprod++) {
420  if (input.unit_wgt) {
421  wgt = weights;
422  f32 = in_sum_buf[iprod][2 * kbin];
423  if (out_sum_buf[prod_offset[ifile] + iprod][2
424  * offset_out] == -32767.0) {
425  out_sum_buf[prod_offset[ifile] + iprod][2
426  * offset_out] = f32 / wgt;
427  out_sum_buf[prod_offset[ifile] + iprod][2
428  * offset_out + 1] = (f32 / wgt)
429  * (f32 / wgt);
430  } else {
431  out_sum_buf[prod_offset[ifile] + iprod][2
432  * offset_out] += f32 / wgt;
433  out_sum_buf[prod_offset[ifile] + iprod][2
434  * offset_out + 1] += (f32 / wgt)
435  * (f32 / wgt);
436  }
437  } else {
438  /* Add new sum to accumulated sum & sum2 */
439  /* ------------------------------------- */
440  f32 = in_sum_buf[iprod][2 * kbin];
441  if (out_sum_buf[prod_offset[ifile] + iprod][2
442  * offset_out] == -32767.0) {
443  out_sum_buf[prod_offset[ifile] + iprod][2
444  * offset_out] = f32;
445  } else {
446  out_sum_buf[prod_offset[ifile] + iprod][2
447  * offset_out] += f32;
448  }
449 
450  f32 = in_sum_buf[iprod][2 * kbin + 1];
451  if (out_sum_buf[prod_offset[ifile] + iprod][2
452  * offset_out + 1] == -32767.0) {
453  out_sum_buf[prod_offset[ifile] + iprod][2
454  * offset_out + 1] = f32;
455  } else {
456  out_sum_buf[prod_offset[ifile] + iprod][2
457  * offset_out + 1] += f32;
458  }
459  } /* input.unit_wgt */
460  } /* product loop */
461 
462  } /* kbin loop */
463 
464  } /* ========== if row has data ========== */
465 
466  } /* ifile loop */
467 
468  /* Write output vdatas */
469  /* ------------------- */
470  if (row_write) {
471 
472  n_write = 0;
473  for (kbin = 0; kbin < output_binfile->get_numbin(irow); kbin++) {
474 
475  bin_num = output_binfile->get_bin_num(kbin);
476 
477  if (bin_num != 0) {
478 
479  // Skip rows where not all files contribute
480  if ((nfiles_contribute[bin_num - basebin] != nfiles)
481  and !case_u)
482  continue;
483 
484  /* Loop over data products */
485  /* ----------------------- */
486  for (iprod = 0; iprod < (int32_t) tot_nprod; iprod++) {
487 
488  /* Remove "blank" bin records */
489  /* -------------------------- */
490  if (n_write != kbin)
491  memcpy(&out_sum_buf[iprod][2 * n_write],
492  &out_sum_buf[iprod][2 * kbin], 8);
493  } /* iprod loop */
494 
495  /* Remove "blank" bin records */
496  /* -------------------------- */
497  if (n_write != kbin)
498  output_binfile->copy_binlist(kbin, n_write);
499 
500  n_write++;
501  n_write_total++;
502 
503  } /* bin_num != 0 */
504  } /* kbin loop */
505 
506  /* Write BinList & Data Products */
507  /* ----------------------------- */
508  if (n_write > 0) {
509  output_binfile->writeBinList(n_write);
510 
511  for (iprod = 0; iprod < (int32_t) tot_nprod; iprod++) {
512  strcpy(buf, prodname[iprod]);
513  output_binfile->writeSums(&out_sum_buf[iprod][0], n_write,
514  buf);
515  }
516  if (isHDF5 || isCDF4)
517  output_binfile->incNumRec(n_write);
518  }
519  }
520  // if median free storage arrays
521  if (input.median) {
522  for (iprod = 0; iprod < (int32_t) tot_nprod; iprod++) {
523  free(sort_array[iprod]);
524  }
525  }
526 
527  } /* irow loop */
528  /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
529 
530  for (iprod = 0; iprod < (int32_t) tot_nprod; iprod++) {
531  free(in_sum_buf[iprod]);
532  free(out_sum_buf[iprod]);
533  } /* iprod loop */
534 
535  free(nfiles_contribute);
536 
537  // Copy metadata from input to output binfile
538  strcpy(buf, input.ofile);
539  strcpy(output_binfile->meta_l3b.product_name, buf);
540 
541  input.tflag = toupper(input.tflag);
542  if (input.tflag == 'D') {
543  strcpy(output_binfile->meta_l3b.prod_type, "day");
544  } else if (input.tflag == 'W') {
545  strcpy(output_binfile->meta_l3b.prod_type, "8-day");
546  } else if (input.tflag == 'M') {
547  strcpy(output_binfile->meta_l3b.prod_type, "month");
548  } else if (input.tflag == 'Y') {
549  strcpy(output_binfile->meta_l3b.prod_type, "year");
550  } else if (input.tflag == 'O') {
551  strcpy(output_binfile->meta_l3b.prod_type, "other");
552  }
553  strcpy(output_binfile->meta_l3b.pversion, input.pversion);
554  strcpy(output_binfile->meta_l3b.soft_name, "L3BINMERGE");
555  strcpy(output_binfile->meta_l3b.soft_ver, VERSION);
556  strcpy(output_binfile->meta_l3b.proc_con, proc_con);
557  strcpy(output_binfile->meta_l3b.input_parms, input.parms);
558 
559  char buf2[5000];
560  if (Hishdf(input.infile) == TRUE || H5Fis_hdf5(input.infile) == TRUE) {
561  strcpy(buf2, input.infile);
562  } else {
563  fp = fopen(input.infile, "r");
564  buf2[0] = 0;
565  for (ifile = 0; ifile < nfiles; ifile++) {
566  fgets(buf, 256, fp);
567  buf[strlen(buf) - 1] = 0;
568 
569  strcat(buf2, buf);
570  strcat(buf2, ",");
571  } /* ifile loop */
572  fclose(fp);
573  buf2[strlen(buf2) - 1] = 0;
574  }
575  strcpy(output_binfile->meta_l3b.infiles, buf2);
576 
577  output_binfile->copymeta(nfiles, &input_binfile[0]);
578 
579  if (strcmp(input.oformat, "netCDF4") == 0) {
580  ptime = unix2isodate(now(), 'G');
581  strcpy(output_binfile->meta_l3b.ptime, ptime);
582  // if (!input_binfile[0]->isCDF4){
583  // int stimez = zulu2unix(output_binfile->meta_l3b.stime);
584  // strcpy( output_binfile->meta_l3b.stime,unix2isodate(stimez,'G'));
585  // int etimez = zulu2unix(output_binfile->meta_l3b.etime);
586  // strcpy( output_binfile->meta_l3b.etime, unix2isodate(etimez,'G'));
587  // }
588  } else {
589  strcpy(output_binfile->meta_l3b.ptime, ptime);
590  }
591 
592  for (ifile = 0; ifile < nfiles; ifile++)
593  input_binfile[ifile]->close();
594  output_binfile->close();
595 
596  return 0;
597 }
598 
char * ydhmsf(double dtime, char zone)
Definition: ydhmsf.c:12
virtual int64_t get_bin_num(int kbin)=0
virtual int get_nobs(int kbin)=0
char product_name[SM_ATTRSZ]
Definition: meta_l3b.h:16
uint8_t isHDF5
Definition: get_l3m.c:8
int status
Definition: l1_czcs_hdf.c:32
virtual int readSums(float *sums, int32_t nbins_to_read, int iprod)=0
virtual void setProductList(int numProducts, char *prodNames[])
Definition: bin_io.cpp:2807
char infiles[LG_ATTRSZ]
Definition: meta_l3b.h:38
virtual int inc_weights(int offset, float weights)=0
#define NULL
Definition: decode_rs.h:63
virtual int create(const char *l3b_filename, int32_t nrows)=0
int32 nrows
char input_parms[LG_ATTRSZ]
Definition: meta_l3b.h:36
#define TRUE
Definition: rice.h:165
float tm[MODELMAX]
virtual int close()=0
virtual int64_t get_numbin(int irow)
Definition: hdf_bin.h:72
bool active_data_prod[MAXNVDATA]
Definition: hdf_bin.h:123
virtual int64_t get_beg()=0
virtual int copy_binlist(int src, int dest)=0
virtual int get_nscenes(int kbin)=0
int32_t nobs
Definition: atrem_cor.h:93
instr * input
int l3bin_input(int argc, char **argv, instr *input, const char *prog, const char *version)
Definition: l3bin_input.c:336
int setlinebuf(FILE *stream)
virtual int get_ext()=0
bool hasNoext
Definition: hdf_bin.h:129
virtual int set_weights(int offset, float weights)=0
virtual int copymeta(int32_t nfiles, Hdf::hdf_bin *input_binfile[])
Definition: bin_io.cpp:2874
const char * getFileFormatName(const char *str)
virtual int64_t get_basebin(int irow)
Definition: hdf_bin.h:76
char prod_type[SM_ATTRSZ]
Definition: meta_l3b.h:29
int32_t nrows
Definition: hdf_bin.h:121
virtual int32_t nprod()
Definition: hdf_bin.h:110
meta_l3bType meta_l3b
Definition: hdf_bin.h:133
===========================================================================V5.0.48(Terra) 03/20/2015 Changes shown below are differences from MOD_PR02 V5.0.46(Terra)============================================================================Changes noted for V6.1.20(Terra) below were also instituted for this version.============================================================================V6.1.20(Terra) 03/12/2015 Changes shown below are differences from MOD_PR02 V6.1.18(Terra)============================================================================Changes from v6.1.18 which may affect scientific output:A situation can occur in which a scan which contains sector rotated data has a telemetry value indicating the completeness of the sector rotation. This issue is caused by the timing of the instrument command to perform the sector rotation and the recording of the telemetry point that reports the status of sector rotation. In this case a scan is considered valid by L1B and pass through the calibration - reporting extremely high radiances. Operationally the TEB calibration uses a 40 scan average coefficient, so the 20 scans(one mirror side) after the sector rotation are contaminated with anomalously high radiance values. A similar timing issue appeared before the sector rotation was fixed in V6.1.2. Our analysis indicates the ‘SET_FR_ENC_DELTA’ telemetry correlates well with the sector rotation encoder position. The use of this telemetry point to determine scans that are sector rotated should fix the anomaly occured before and after the sector rotation(usually due to the lunar roll maneuver). The fix related to the sector rotation in V6.1.2 is removed in this version.============================================================================V6.1.18(Terra) 10/01/2014 Changes shown below are differences from MOD_PR02 V6.1.16(Terra)============================================================================Added doi attributes to NRT(Near-Real-Time) product.============================================================================V6.1.16(Terra) 01/27/2014 Changes shown below are differences from MOD_PR02 V6.1.14(Terra)============================================================================Migrate to SDP Toolkit 5.2.17============================================================================V6.1.14(Terra) 06/26/2012 Changes shown below are differences from MOD_PR02 V6.1.12(Terra)============================================================================Added the doi metadata to L1B product============================================================================V6.1.12(Terra) 04/25/2011 Changes shown below are differences from MOD_PR02 V6.1.8(Terra)============================================================================1. The algorithm to calculate uncertainties for reflective solar bands(RSB) is updated. The current uncertainty in L1B code includes 9 terms from prelaunch analysis. The new algorithm regroups them with the new added contributions into 5 terms:u1:the common term(AOI and time independent) and
Definition: HISTORY.txt:126
virtual int open(const char *l3b_filename)=0
int main(int argc, char **argv)
Definition: l3binmerge.cpp:57
virtual int incNumRec(int n_write)=0
virtual int writeSums(float *sums, int32_t nbins_to_write, const char *prodname)=0
virtual int setDataPtr(int nbins_to_read)=0
virtual int get_prodname(int iprod, char *prodname)
Definition: bin_io.cpp:2802
char proc_con[MD_ATTRSZ]
Definition: meta_l3b.h:35
virtual int inc_nobs(int offset, int nobs)=0
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution offsets between the high resolution geolocation and a bi linear interpolation extrapolation of the positions This can be used to reconstruct the high resolution geolocation Resolved Bug by delaying cumulation of gflags until after validation of derived products Resolved Bug by setting Latitude and Longitude to the correct fill resolving to support Near Real Time because they may be unnecessary if use of entrained ephemeris and attitude data is turned resolving bug report Corrected to filter out Aqua attitude records with missing status helping resolve bug MOD_PR03 will still correctly write scan and pixel data that does not depend upon the start time
Definition: HISTORY.txt:248
char soft_ver[SM_ATTRSZ]
Definition: meta_l3b.h:33
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
char * unix2isodate(double dtime, char zone)
Definition: unix2isodate.c:10
int16_t * nscenes
Definition: l2bin.cpp:80
#define MAXNVDATA
#define VERSION
Definition: l3binmerge.cpp:25
#define MAXNFILES
Definition: l3binmerge.cpp:19
virtual int set_bin_num(int offset, int64_t bin_num)=0
char ptime[SM_ATTRSZ]
Definition: meta_l3b.h:34
virtual int clear_binlist()=0
char pversion[SM_ATTRSZ]
Definition: meta_l3b.h:30
virtual int readBinIndex(int row_num_to_read)=0
l2prod offset
virtual int readBinList(int nbins_to_read)=0
int16 ncols[121]
int i
Definition: decode_rs.h:71
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
virtual int inc_nscenes(int offset, int nscenes)=0
char soft_name[SM_ATTRSZ]
Definition: meta_l3b.h:32
uint32_t deflate
Definition: hdf_bin.h:131
float32 f32
Definition: l2bin.cpp:98
virtual float get_weights(int kbin)=0
virtual int writeBinList(int32_t nbins_to_write)=0