ocssw V2020
l1a_seawifs.c
Go to the documentation of this file.
1 #include "hdf.h"
2 #include "mfhdf.h"
3 #include "l1a.h"
4 #include "navigation.h"
5 #include "l1a_proto.h"
6 #include "eng_qual.h"
7 #include "l12_proto.h"
8 #include "l1a_seawifs.h"
9 #include "call1a_proto.h"
10 #include "getcal_proto.h"
11 #include "st_proto.h"
12 
13 #define LAC_PIXEL_NUM 1285
14 #define GAC_PIXEL_NUM 248
15 #define NREC_IN_BUF 10
16 #define STBUFSIZ 5
17 #define NOTDONE 0
18 #define FIRST_KNEE 1
19 #define MASK_HIGHLT1 16
20 #define GENBUFSIZ NREC_IN_BUF*sizeof(float)*40 /* size of inst_ana */
21 
22 //static int evalmask;
23 
24 int16 syear, sday; /* data start date */
25 int32 smsec; /* data start time */
26 int16 eyear, eday; /* data end date */
27 int32 emsec; /* data end time */
28 int32 nscan; /* number of scans */
29 int32 npix; /* number pixels per scan */
30 int32 spix; /* start pixel number (from 0) */
31 int32 dpix; /* LAC pixel increment */
32 float dark_mean[8]; /* Mean of dark restore counts */
33 float dark_std[8]; /* Std dev of dark restore counts */
34 
35 int16 tdi[BANDS_DIMS_1A] = {0, 0, 0, 0, 0, 0, 0, 0};
36 
42 float32 fp_temps[256][BANDS_DIMS_1A];
43 float32 scan_mod[2][1285];
46 
67 
68 char cal_path_tab[128];
69 char dtype[8];
70 
73 
74 
78 
79 int32 nsta;
80 int32 ninc;
81 
82 int16 *l1a_data = NULL; /* raw radiances band-int-by-pix */
83 int16 *l1a_back = NULL; /* raw radiances band-int-by-pix */
84 float *l1b_buffer = NULL; /* l1b radiances band-int-by-pix */
85 int32 *msec;
88 float32 *tilt;
89 
96 
97 
98 int16 stray_light = -1; /* num pixels to apply sl correct. */
99 float Ltyp_frac = 0.25; /* fraction of B8 for sl threshold */
100 int16 out_band = 0; /* if <= 0, no out of band correct. */
101 
102 typedef struct {
104  int16 tdi[8];
105  int16 scan_temp[8];
106  float32 inst_temp[40];
107  float32 orb_vec[3];
108  float32 sun_ref[3];
109  float32 sen_mat[3 * 3];
110  float32 scan_ell[6];
111 } inputBuffer;
112 
113 
114 int32 do_st = 1;
115 
116 int32 get_l1a_rec(int32 sd_id, int32 recno, cal_mod_struc *cal_mod,
117  int16 *l1a_dum, float32 **l1b_data, int16 **l2_flags) {
118  /* */
119  /* local vars */
120  /* */
121  int32 ipix; /* pixel number */
122  int32 idet; /* detector number */
123  int32 irec;
124  int32 start[3] = {0, 0, 0};
125  int32 edges[3];
126 
127  int16 band_buf[LAC_PIXEL_NUM * 8];
128  int32 scan_no;
129  int16 gain8;
130  int32 AS_pixels;
131  float Styp_frac = 0.9;
132  int32 sl_scan;
133  int16 *l1a_ptr;
134  int16 *gain_ptr;
135 
136  static inputBuffer rdBuf[NREC_IN_BUF];
137  static inputBuffer bkBuf[STBUFSIZ - 2];
138  byte genBuf[GENBUFSIZ];
139 
140  static int32 crec = -1;
141  static int16 recursive_flag = 0;
142  static int16 n_read = 0;
143  static int32 max_rec_in_rdbuf;
144  static int32 offset;
145  static int32 i, j;
146  static int32 stray_light_scan_no;
147 
148  static float *st_l1b_data;
149  static int16 *st_l2_flags;
150 
151  static int32 initial = 1;
152  static byte first = 1;
153 
154 
155  static int16 hi_Lt[LAC_PIXEL_NUM]; /* whether radiance > knee */
156  int pixvalue; /* l1a pixel value */
157  int pixdark; /* dark_restore value for each pixel */
158  float kneevalue; /* radiance at first knee */
159 
160  /* */
161  /* Read L1A data scan by scan, build L1B record, and write. */
162 
163  /* If reading out-of-sequence, force restart from beginning to get stlight */
164  /* baf, 05-oct-2001. */
165  if (first || recno < crec) {
166  max_rec_in_rdbuf = recno - 1;
167  stray_light_scan_no = recno;
168  }
169 
170  crec = recno;
171 
172  if (crec > nscan) return 0;
173 
174 
175  if (crec > max_rec_in_rdbuf) {
176 
177  memcpy(&bkBuf, &rdBuf[NREC_IN_BUF - STBUFSIZ + 2],
178  sizeof (inputBuffer) * (STBUFSIZ - 2));
179  memcpy(l1a_back, &l1a_data[(NREC_IN_BUF - STBUFSIZ + 2) * npix * 8],
180  npix * 8 * (STBUFSIZ - 2) * sizeof (int16));
181 
182  n_read = (nscan - max_rec_in_rdbuf >= NREC_IN_BUF) ?
183  NREC_IN_BUF : nscan - max_rec_in_rdbuf;
184 
185 
186  edges[0] = 1;
187  start[1] = 0;
188  edges[1] = npix;
189  edges[2] = 8;
190  for (irec = 0; irec < n_read; irec++) {
191  start[0] = recno - 1 + irec;
192  SDreaddata(SDselect(sd_id, SDnametoindex(sd_id, "l1a_data")),
193  start, NULL, edges, (VOIDP) band_buf);
194  for (ipix = 0; ipix < npix; ipix++)
195  for (idet = 0; idet < 8; idet++)
196  l1a_data[irec * (8 * npix) + idet * npix + ipix] =
197  band_buf[ipix * 8 + idet];
198  }
199 
200 
201  rdSDS(sd_id, "gain", recno - 1, 0, n_read, 8, (VOIDP) genBuf);
202  for (i = 0; i < n_read; i++)
203  memcpy(&rdBuf[i].gain, &genBuf[i * 8 * 2], 8 * 2);
204 
205  rdSDS(sd_id, "tdi", recno - 1, 0, n_read, 8, (VOIDP) genBuf);
206  for (i = 0; i < n_read; i++)
207  memcpy(&rdBuf[i].tdi, &genBuf[i * 8 * 2], 8 * 2);
208 
209  rdSDS(sd_id, "scan_temp", recno - 1, 0, n_read, 8, (VOIDP) genBuf);
210  for (i = 0; i < n_read; i++)
211  memcpy(&rdBuf[i].scan_temp, &genBuf[i * 8 * 2], 8 * 2);
212 
213  rdSDS(sd_id, "inst_ana", recno - 1, 0, n_read, 40, (VOIDP) genBuf);
214  for (i = 0; i < n_read; i++)
215  memcpy(&rdBuf[i].inst_temp, &genBuf[i * 40 * 4], 40 * 4);
216 
217  rdSDS(sd_id, "orb_vec", recno - 1, 0, n_read, 3, (VOIDP) genBuf);
218  for (i = 0; i < n_read; i++)
219  memcpy(&rdBuf[i].orb_vec, &genBuf[i * 3 * 4], 3 * 4);
220 
221  rdSDS(sd_id, "sun_ref", recno - 1, 0, n_read, 3, (VOIDP) genBuf);
222  for (i = 0; i < n_read; i++)
223  memcpy(&rdBuf[i].sun_ref, &genBuf[i * 3 * 4], 3 * 4);
224 
225  rdSDS(sd_id, "scan_ell", recno - 1, 0, n_read, 6, (VOIDP) genBuf);
226  for (i = 0; i < n_read; i++)
227  memcpy(&rdBuf[i].scan_ell, &genBuf[i * 6 * 4], 6 * 4);
228 
229 
230  start[0] = recno - 1;
231  edges[0] = n_read;
232  start[1] = 0;
233  edges[1] = 3;
234  edges[2] = 3;
235  SDreaddata(SDselect(sd_id, SDnametoindex(sd_id, "sen_mat")),
236  start, NULL, edges, (VOIDP) genBuf);
237  for (i = 0; i < n_read; i++)
238  memcpy(&rdBuf[i].sen_mat, &genBuf[i * 9 * 4], 9 * 4);
239 
240 
241  offset = max_rec_in_rdbuf + 1;
242  max_rec_in_rdbuf += n_read;
243  }
244 
245  if ((crec - offset) >= 0) {
246  j = crec - offset;
247  gain8 = rdBuf[j].gain[7];
248  gain_ptr = rdBuf[j].gain;
249  l1a_ptr = &l1a_data[j * 8 * npix];
250 
251  l1b_rad(syear, sday, smsec, msec[recno - 1],
252  dtype, nsta, ninc, npix,
253  dark_mean, rdBuf[j].gain, rdBuf[j].tdi,
254  rdBuf[j].scan_temp, rdBuf[j].inst_temp, side[recno - 1],
255  &l1a_data[j * 8 * npix], l1b_buffer, cal_mod);
256  /*
257  calibrate_l1a(cal_path_tab,syear,sday,smsec,eday,msec[recno-1],
258  dtype, nsta, ninc, npix,
259  dark_mean, rdBuf[j].gain, rdBuf[j].tdi,
260  rdBuf[j].scan_temp, rdBuf[j].inst_temp, side[recno-1],
261  &l1a_data[j*8*npix], l1b_buffer, cal_mod);
262  */
263 
264  if (!recursive_flag) {
265  geonav_(rdBuf[j].orb_vec, rdBuf[j].sen_mat, rdBuf[j].scan_ell,
266  rdBuf[j].sun_ref, &nsta, &ninc, &npix,
267  ylat, xlon, solz, sola, senz, sena);
268 
269  }
270  } else {
271  j = (STBUFSIZ - 2) + (crec - offset);
272  gain8 = bkBuf[j].gain[7];
273  gain_ptr = bkBuf[j].gain;
274  l1a_ptr = &l1a_back[j * 8 * npix];
275 
276  if (!recursive_flag) {
277  geonav_(bkBuf[j].orb_vec, bkBuf[j].sen_mat, bkBuf[j].scan_ell,
278  bkBuf[j].sun_ref, &nsta, &ninc, &npix,
279  ylat, xlon, solz, sola, senz, sena);
280 
281  }
282  }
283 
284  if (first) {
285  memcpy(pcal_counts, cal_counts, sizeof (cal_counts));
286  memcpy(pcal_rads, cal_rads, sizeof (cal_rads));
287  first = 0;
288  }
289 
290  if (!recursive_flag) {
291  for (ipix = 0; ipix < npix; ipix++) {
292  hi_Lt[ipix] = FALSE;
293  /* HILT check limited to bands 7 & 8, BAF, 23 Jan 2002 */
294  /* Use dark_mean rather than dark_rest, BAF, 7 July 2003 */
295  for (idet = 6; (idet < 8)&&(hi_Lt[ipix] == FALSE); idet++) {
296  pixvalue = l1a_ptr[ipix + npix * idet];
297  /*
298  pixdark = dark_rest[8*(recno-1)+idet];
299  */
300  pixdark = dark_mean[idet];
301  kneevalue = pcal_counts[idet][gain_ptr[idet]][FIRST_KNEE];
302  hi_Lt[ipix] = ((pixvalue - pixdark) >= kneevalue);
303  }
304  }
305  }
306 
307 
308  scan_no = crec;
309  AS_pixels = stray_light;
310 
311  if (do_st == 0) {
312 
313  for (ipix = 0; ipix < npix; ipix++)
314  l2_flags_buffer[ipix] = 0;
315 
316  } else if (!recursive_flag) {
317 
318  do {
319  if (stray_light_scan_no != scan_no) {
320 
321  recursive_flag = 1;
322 
323  get_l1a_rec(sd_id, stray_light_scan_no, cal_mod,
324  l1a_dum, &st_l1b_data, &st_l2_flags);
325  }
326  } while (stray_light_corr(&initial, Ltyp_frac, Styp_frac,
327  nscan, npix, stray_light_scan_no++, dtype,
328  gain8, &pcal_rads[0][0][0], l1b_buffer, &sl_scan,
329  l2_flags_buffer, &AS_pixels) == NOTDONE);
330  recursive_flag = 0;
331  crec = scan_no;
332 
333  }
334 
335 
336 
337  for (ipix = 0; ipix < npix; ipix++) {
338  if (hi_Lt[ipix])
339  l2_flags_buffer[ipix] |= MASK_HIGHLT1;
340  }
341 
342  *l1b_data = l1b_buffer;
343  *l2_flags = l2_flags_buffer;
344 
345  return (0);
346 }
347 
348 int openl1a_seawifs(filehandle *file) {
349 
350  /* */
351  /* input files */
352  /* */
353  char *cal_path = file->calfile;
354 
355  /* */
356  /* get_l1a_open interface */
357  /* */
358  int32 fileID;
359  int32 status;
360  char buf[32];
361 
362 
363  /* */
364  /* set static global evaluation switch */
365  /* */
366  // evalmask = input->evalmask;
367 
368  /* open the file and get the file ID */
369  fileID = SDstart(file->name, DFACC_RDONLY);
370 
371  if (fileID < 0) {
372  fprintf(stderr,
373  "-E %s Line %d: Error opening %s for reading.\n",
374  __FILE__, __LINE__, file->name);
375  return (1);
376  }
377 
378  status = getHDFattr(fileID, "Start Year", "", (VOIDP) & syear);
379  status = getHDFattr(fileID, "Start Day", "", (VOIDP) & sday);
380  status = getHDFattr(fileID, "Start Millisec", "", (VOIDP) & smsec);
381  status = getHDFattr(fileID, "End Year", "", (VOIDP) & eyear);
382  status = getHDFattr(fileID, "End Day", "", (VOIDP) & eday);
383  status = getHDFattr(fileID, "End Millisec", "", (VOIDP) & emsec);
384  status = getHDFattr(fileID, "Number of Scan Lines", "", (VOIDP) & nscan);
385  status = getHDFattr(fileID, "Data Type", "", (VOIDP) & dtype);
386 
387  status = getHDFattr(fileID, "Pixels per Scan Line", "", (VOIDP) & npix);
388  status = getHDFattr(fileID, "LAC Pixel Start Number", "", (VOIDP) & nsta);
389  status = getHDFattr(fileID, "LAC Pixel Subsampling", "", (VOIDP) & ninc);
390 
391  status = getHDFattr(fileID, "Orbit Node Longitude", "", (VOIDP) & file->orbit_node_lon);
392  status = getHDFattr(fileID, "Orbit Number", "", (VOIDP) & file->orbit_number);
393  status = getHDFattr(fileID, "Node Crossing Time", "", (VOIDP) & buf);
394  file->node_crossing_time = zulu2unix(buf);
395 
396 
397  Ltyp_frac = input->sl_frac;
398  stray_light = input->sl_pixl;
399 
400 
401  if (stray_light == 0)
402  do_st = 0;
403  else {
404  do_st = 1;
405  if (stray_light < 0) {
406  if (strcmp(dtype, "GAC") == 0)
407  stray_light = 4;
408  else
409  stray_light = 3;
410  }
411  }
412 
413 
414  /* get the current calibration model solution */
415  if (cal_path == NULL) {
416  fprintf(stderr,
417  "-E %s Line %d: No calibration file specified.\n",
418  __FILE__, __LINE__);
419  exit(1);
420  }
421 
422  read_caltable(cal_path);
423 
424  /*
425  status = get_cal(cal_path, syear, sday, eday, smsec, npix, nsta, ninc,
426  dtype, tdi, &entry_year, &entry_day, &ref_year,
427  &ref_day, &ref_minute, fp_temps, scan_mod, t_const,
428  t_linear_1, t_exponential_1, t_linear_2, t_exponential_2,
429  cal_offs, inst_tcorr, inst_tref, fp_tcorr, fp_tref,
430  ms1_const, ms1_linear_1, ms1_exponential_1, ms1_linear_2,
431  ms1_exponential_2, ms2_const, ms2_linear_1,
432  ms2_exponential_1, ms2_linear_2, ms2_exponential_2,
433  counts, rads);
434  */
435 
436  if (status < 0) {
437  fprintf(stderr,
438  "-E- %s line %d: Error applying calibration table \"%s\".\n",
439  __FILE__, __LINE__, cal_path);
440  exit(status);
441  }
442 
443 
444  /* call cdata.f to initialize global FORTRAN common block data */
445  cdata_();
446 
447 
448  file->npix = npix;
449  file->nscan = nscan;
450  file->sensorID = SEAWIFS;
451  file->sd_id = fileID;
452  if (strcmp(dtype, "GAC") == 0)
453  strcpy(file->spatialResolution, "4.5 km");
454  else
455  strcpy(file->spatialResolution, "1.1 km");
456 
457  strcpy(cal_path_tab, cal_path);
458 
459  l1a_data = (int16 *) calloc(npix * 8 * NREC_IN_BUF, sizeof (int16));
460  l1a_back = (int16 *) calloc(npix * 8 * (STBUFSIZ - 2), sizeof (int16));
461  l1b_buffer = (float *) calloc(npix * 8, sizeof (float));
462 
463  msec = (int32 *) calloc(nscan, sizeof (int32));
464  status = rdSDS(file->sd_id, "msec", 0, 0, 0, 0, (VOIDP) msec);
465  side = (int16 *) calloc(nscan, sizeof (int16));
466  status = rdSDS(file->sd_id, "side", 0, 0, 0, 0, (VOIDP) side);
467 
468  dark_rest = (int16 *) calloc(nscan * 8, sizeof (int16));
469  status = rdSDS(file->sd_id, "dark_rest", 0, 0, 0, 0, (VOIDP) dark_rest);
471  free(dark_rest);
472 
473  tilt = (float32 *) calloc(nscan, sizeof (float32));
474  status = rdSDS(file->sd_id, "tilt", 0, 0, 0, 0, (VOIDP) tilt);
475 
476  spix = nsta - 1;
477  dpix = ninc;
478 
479  return (status);
480 }
481 
482 int readl1a_seawifs(filehandle *file, int32_t recnum, l1str *l1rec) {
483 
484  /* */
485  /* get_l1a_rec interface */
486  /* */
487  static cal_mod_struc cal_mod; /* cal modification structure */
488  static int16 *l2_flags; /* radiance quality flags for L2 */
489  static float32 *l1b_data;
490 
491  int32 i;
492  int32 status = 0;
493 
494  int32 nwave = l1rec->l1file->nbands;
495  int32 *bindx = (int32*) l1rec->l1file->bindx;
496 
497  /* */
498  /* local vars */
499  /* */
500  int32 ipix; /* pixel number */
501  int32 iw, ib;
502 
503  int16 *l1a_dum = NULL;
504 
505  static int32 prev_recnum = -1;
506 
507  static int16 first = 1;
508  static int32 ntilts;
509  static int16 tilt_flags[20];
510  static int16 tilt_ranges[2 * 20];
511 
512  int32 nflag[8];
513 
514 
515  /* If reading out-of-sequence, force restart from beginning to get stlight */
516  /* baf, 05-oct-2001. */
517  if (recnum < prev_recnum) {
518  printf("Reading out-of-sequence %d %d\n", recnum, prev_recnum);
519  prev_recnum = -1;
520  }
521 
522 
523  /* Get tilt info */
524  /* ------------- */
525  if (first) {
526  status = rdSDS(file->sd_id, "ntilts", 0, 0, 0, 0, (VOIDP) & ntilts);
527  status = rdSDS(file->sd_id, "tilt_flags", 0, 0, 0, 0, (VOIDP) tilt_flags);
528  status = rdSDS(file->sd_id, "tilt_ranges", 0, 0, 0, 0, (VOIDP) tilt_ranges);
529  first = 0;
530  }
531 
532 
533  /* Check for bad or changing tilt */
534  /* ------------------------------ */
535  for (i = 0; i < ntilts; i++) {
536  if (tilt_ranges[2 * i] <= recnum + 1 && tilt_ranges[2 * i + 1] >= recnum)
537  break;
538  // if (tilt_flags[i] == 0 || /* nadir */
539  // tilt_flags[i] == 1 || /* fwd */
540  // tilt_flags[i] == 2 ) /* aft */
541  // bad_tilt = 0; /* tilt result is ok */
542  // else if (tilt_flags[i] == 3) /* tilt is changing */
543  // bad_tilt = 1;
544  // else /* tilt is unknown */
545  // bad_tilt = 2;
546  }
547 
548 
549  /* Get nav flag */
550  /* ------------ */
551  status = rdSDS(file->sd_id, "nflag", recnum, 0, 1, 8, (VOIDP) & nflag);
552 
553 
554  /* Get l1a data */
555  /* ------------ */
556  for (i = prev_recnum + 1; i <= recnum; i++)
557  status = get_l1a_rec(file->sd_id, i + 1, &cal_mod, l1a_dum,
558  &l1b_data, &l2_flags);
559 
560  /* */
561  /* Copy scan geolocation and view geometry */
562  /* */
563  memcpy(l1rec->lat, ylat, npix * sizeof (float));
564  memcpy(l1rec->lon, xlon, npix * sizeof (float));
565  memcpy(l1rec->solz, solz, npix * sizeof (float));
566  memcpy(l1rec->sola, sola, npix * sizeof (float));
567  memcpy(l1rec->senz, senz, npix * sizeof (float));
568  memcpy(l1rec->sena, sena, npix * sizeof (float));
569 
570  /* */
571  /* Copy L1B radiances, pixel interlaced by band. Add per-band */
572  /* view angles. */
573  /* */
574  for (ipix = 0; ipix < file->npix; ipix++) {
575  if (l1rec->sena[ipix] > 180) {
576  l1rec->sena[ipix] -= 360.0;
577  }
578  if (l1rec->sola[ipix] > 180) {
579  l1rec->sola[ipix] -= 360.0;
580  }
581  l1rec->pixnum[ipix] = spix + ipix*dpix;
582  for (iw = 0; iw < nwave; iw++) {
583  ib = bindx[iw];
584  l1rec->Lt [ipix * nwave + ib] = l1b_data[iw * npix + ipix];
585  }
586  l1rec->stlight[ipix] = ((l2_flags[ipix] & STRAYLIGHT) > 0);
587  l1rec->hilt [ipix] = ((l2_flags[ipix] & HILT) > 0);
588  l1rec->navwarn[ipix] = (nflag[7] & 1) | (nflag[0] & 1);
589  }
590 
591 
592  /* */
593  /* Set scan time in L1B output record */
594  /* */
595  double secs = (double) (msec[recnum] / 1.e3);
596  int16_t year = syear;
597  int16_t day = sday;
598 
599  if (msec[recnum] < smsec) { /* adjust for day rollover */
600  day += 1;
601  if (day > (365 + (year % 4 == 0))) {
602  year += 1;
603  day = 1;
604  }
605  }
606  l1rec->scantime = yds2unix(year, day, secs);
607 
608  l1rec->tilt = tilt[recnum];
609  l1rec->mside = side[recnum];
610 
611  prev_recnum = recnum;
612 
613  return (status);
614 }
615 
616 int readl1a_lonlat_seawifs(filehandle *file, int32_t recnum, l1str *l1rec) {
617  int32 start[3];
618  int32 edges[3];
619 
620  inputBuffer rdBuf;
621 
622  if (recnum > nscan) return 0;
623 
624  rdSDS(file->sd_id, "orb_vec", recnum, 0, 1, 3, (VOIDP) rdBuf.orb_vec);
625  rdSDS(file->sd_id, "sun_ref", recnum, 0, 1, 3, (VOIDP) rdBuf.sun_ref);
626  rdSDS(file->sd_id, "scan_ell", recnum, 0, 1, 6, (VOIDP) rdBuf.scan_ell);
627 
628  start[0] = recnum;
629  edges[0] = 1;
630  start[1] = 0;
631  edges[1] = 3;
632  start[2] = 0;
633  edges[2] = 3;
634  SDreaddata(SDselect(file->sd_id, SDnametoindex(file->sd_id, "sen_mat")),
635  start, NULL, edges, (VOIDP) rdBuf.sen_mat);
636 
637  geonav_lonlat_(rdBuf.orb_vec, rdBuf.sen_mat, rdBuf.scan_ell,
638  rdBuf.sun_ref, &nsta, &ninc, &npix,
639  l1rec->lat, l1rec->lon);
640 
641  return (0);
642 }
643 
644 int closel1a_seawifs(filehandle *file) {
645  free(l1a_data);
646  free(l1a_back);
647  free(l1b_buffer);
648  free(msec);
649  free(side);
650  free(tilt);
651 
652  SDend(file->sd_id);
653 
654  return (0);
655 }
656 
657 
658 
int32 nsta
Definition: l1a_seawifs.c:79
float32 pcal_counts[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
Definition: l1a_seawifs.c:75
int16 out_band
Definition: l1a_seawifs.c:100
integer, parameter int16
Definition: cubeio.f90:3
const int bindx[3]
Definition: DbLutNetcdf.cpp:31
int16 entry_year
Definition: l1a_seawifs.c:37
int j
Definition: decode_rs.h:73
float dark_mean[8]
Definition: l1a_seawifs.c:32
float32 sen_mat[3 *3]
Definition: l1a_seawifs.c:109
int32 ninc
Definition: l1a_seawifs.c:80
int32_t day
float64 t_const[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:47
int status
Definition: l1_czcs_hdf.c:31
double yds2unix(int16_t year, int16_t day, double secs)
Definition: yds2unix.c:7
int16 eyear
Definition: l1a_seawifs.c:26
int16 * side
Definition: l1a_seawifs.c:86
float32 orb_vec[3]
Definition: l1a_seawifs.c:107
int16 * gain
Definition: l1_czcs_hdf.c:32
float64 ms1_exponential_1[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:59
#define GENBUFSIZ
Definition: l1a_seawifs.c:20
float32 fp_temps[256][BANDS_DIMS_1A]
Definition: l1a_seawifs.c:42
float32 xlon[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:91
int16_t fileID
#define GAINS_DIMS_1A
char cal_path_tab[128]
Definition: l1a_seawifs.c:68
#define FALSE
Definition: rice.h:164
void read_caltable(char *cal_path)
Definition: get_cal_swf.c:149
#define NULL
Definition: decode_rs.h:63
int32 smsec
Definition: l1a_seawifs.c:25
float64 ms1_linear_2[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:60
#define MASK_HIGHLT1
Definition: l1a_seawifs.c:19
float64 ms2_exponential_2[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:66
int16 tdi[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:35
float32 rads[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
Definition: l1a_seawifs.c:45
read l1rec
int16 stray_light
Definition: l1a_seawifs.c:98
int32 do_st
Definition: l1a_seawifs.c:114
#define STRAYLIGHT
Definition: l2_flags.h:17
float32 pcal_rads[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
Definition: l1a_seawifs.c:76
int geonav_(FLOAT32 pos[3], FLOAT32 rm[3][3], FLOAT32 coef[6], FLOAT32 sunref[3], INT32 *spix, INT32 *ipix, INT32 *npix, FLOAT32 lat[], FLOAT32 lon[], FLOAT32 solz[], FLOAT32 sola[], FLOAT32 senz[], FLOAT32 sena[])
int16 eday
Definition: l1a_seawifs.c:26
#define VOIDP
Definition: hdf5utils.h:11
int16 * l1a_back
Definition: l1a_seawifs.c:83
#define NOTDONE
Definition: l1a_seawifs.c:17
short l2_flags_buffer[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:77
int openl1a_seawifs(filehandle *file)
Definition: l1a_seawifs.c:348
int32 * msec
Definition: l1a_seawifs.c:85
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
Definition: HISTORY.txt:413
instr * input
#define NREC_IN_BUF
Definition: l1a_seawifs.c:15
int readl1a_seawifs(filehandle *file, int32_t recnum, l1str *l1rec)
Definition: l1a_seawifs.c:482
float32 sola[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:93
float64 ms1_const[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:57
float64 ms2_const[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:62
dtype
Definition: dataset.h:17
float Ltyp_frac
Definition: l1a_seawifs.c:99
int32 nscan
Definition: l1a_seawifs.c:28
int16 gain[8]
Definition: l1a_seawifs.c:103
float32 cal_rads[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
int32 npix
Definition: l1a_seawifs.c:29
read recnum
double zulu2unix(char *zulu)
Definition: zulu2unix.c:3
float32 sun_ref[3]
Definition: l1a_seawifs.c:108
if(BUILD_JPL) add_executable(interp_hycom interp_hycom.f) add_executable(interp_hycom_ascii interp_hycom_ascii.f) add_executable(tec tec.c) add_executable(swh swh.c) target_link_libraries(interp_hycom netcdff dfutils $
Definition: CMakeLists.txt:127
float64 inst_tref[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:54
#define BANDS_DIMS_1A
Definition: level_1a_index.h:8
int16 sday
Definition: l1a_seawifs.c:24
int rdSDS(int32 fileID, const char sdsname[], int32 start1, int32 start2, int32 edges1, int32 edges2, VOIDP array_data)
float64 ms1_exponential_2[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:61
int16 * l1a_data
Definition: l1a_seawifs.c:82
void cdata_()
short gain8
Definition: l1a.c:197
void geonav_lonlat_(float *orb_vec, float *sen_mat, float *scan_ell, float *sun_ref, int32 *nsta, int32 *ninc, int32 *npix, float ylat[], float xlon[])
int16 ref_year
Definition: l1a_seawifs.c:39
float dark_std[8]
Definition: l1a_seawifs.c:33
int16 entry_day
Definition: l1a_seawifs.c:38
int32 spix
Definition: l1a_seawifs.c:30
int readl1a_lonlat_seawifs(filehandle *file, int32_t recnum, l1str *l1rec)
Definition: l1a_seawifs.c:616
float32 counts[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
Definition: l1a_seawifs.c:44
int16 syear
Definition: l1a_seawifs.c:24
int32 emsec
Definition: l1a_seawifs.c:27
int16 ref_day
Definition: l1a_seawifs.c:40
#define HILT
Definition: l2_flags.h:13
int closel1a_seawifs(filehandle *file)
Definition: l1a_seawifs.c:644
float * l1b_buffer
Definition: l1a_seawifs.c:84
int32_t l1b_rad(int syear, int sday, int32_t smsec, int32_t msec, char *dtype, int32_t nsta, int32_t ninc, int32_t npix, float *dark_mean, short *gain, short *tdi, short *scan_temp, float *inst_temp, int mside, short *l1a_data, float *l1b_data, cal_mod_struc *cal_mod)
Definition: get_cal_swf.c:697
float64 cal_offs[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:52
float32 cal_counts[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
int dark_rest_stat(int16 *data, int nrec, float *dark_mean, float *dark_std)
Definition: l1a.c:261
float32 ylat[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:90
float32 sena[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:95
float32 scan_mod[2][1285]
Definition: l1a_seawifs.c:43
int scan_ell(float p[3], double sm[3][3], double coef[10])
float64 fp_tcorr[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:55
float32 * tilt
Definition: l1a_seawifs.c:88
float32 scan_ell[6]
Definition: l1a_seawifs.c:110
int32_t stray_light_corr(int32_t *initial, float Ltyp_frac, float Styp_frac, int32_t nscans, int32_t nsamples, int32_t scan_no, char *dtype, int16_t gn, float *rads, float *l1b_data, int32_t *sl_scan, int16_t *l2_flags, int32_t *AS_pixels)
Definition: st_lt.c:65
float64 t_exponential_2[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:51
int32 get_l1a_rec(int32 sd_id, int32 recno, cal_mod_struc *cal_mod, int16 *l1a_dum, float32 **l1b_data, int16 **l2_flags)
Definition: l1a_seawifs.c:116
float64 t_linear_2[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:50
#define LAC_PIXEL_NUM
Definition: l1a_seawifs.c:13
float64 t_linear_1[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:48
l2prod offset
int getHDFattr(int32 fileID, const char attrname[], const char sdsname[], VOIDP data)
float64 ms2_linear_2[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:65
#define KNEES_DIMS_1A
float64 inst_tcorr[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:53
float64 fp_tref[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:56
float64 t_exponential_1[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:49
#define SEAWIFS
Definition: sensorDefs.h:12
float64 ms2_linear_1[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:63
int16 ref_minute
Definition: l1a_seawifs.c:41
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")
int16 * dark_rest
Definition: l1a_seawifs.c:87
float64 ms2_exponential_1[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:64
float64 ms1_linear_1[BANDS_DIMS_1A]
Definition: l1a_seawifs.c:58
#define FIRST_KNEE
Definition: l1a_seawifs.c:18
int32 dpix
Definition: l1a_seawifs.c:31
float32 solz[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:92
#define STBUFSIZ
Definition: l1a_seawifs.c:16
float32 senz[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:94