OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
main_l0info.c
Go to the documentation of this file.
1 /* ==================================================================== */
2 /* */
3 /* SWl0info - checks level-0 file structure, frame content, and errors */
4 /* */
5 /* Synopsis: */
6 /* */
7 /* SWl0info L0-filename */
8 /* */
9 /* Description: */
10 /* */
11 /* Reads the level-0 file and reports statistics on frame types and */
12 /* frame errors. If the file can not be opened or does not appear to */
13 /* be a seawifs level-0 file (based on the header), the error status */
14 /* will be set to -1, else it will be set to the number of frames read. */
15 /* */
16 /* Written By: */
17 /* */
18 /* Bryan A. Franz */
19 /* General Sciences Corp. */
20 /* 27 September 1997 */
21 /* */
22 /* =====================================================================*/
23 
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <fcntl.h>
27 #include <string.h>
28 #include <errno.h>
29 #include <unistd.h>
30 #include <time.h>
31 
32 #include "swl0_proto.h"
33 
34 #define CMD_ARGS "h"
35 
36 /* ----------------------------------------------------------------------- */
37 /* main */
38 
39 /* ----------------------------------------------------------------------- */
40 int main(int argc, char* argv[]) {
41  swl0indx indx;
42  swl0scene scene[MAXSCENES];
43  INT32 nframes;
44  INT32 nscenes = 0;
45  swl0ctl l0ctl; /* Control str for L0 indexing */
46 
47  /* Parameters for getopt() */
48  extern int opterr;
49  extern int optind;
50  extern char *optarg;
51  int c;
52 
53  l0ctl.fileType = -1; /* Get filetype from header */
54 
55  /* */
56  /* Process command-line arguments */
57  /* */
58  while ((c = getopt(argc, argv, CMD_ARGS)) != EOF) {
59  switch (c) {
60  case 'h':
61  l0ctl.fileType = HRPT;
62  break;
63  case 'g':
64  l0ctl.fileType = GAC;
65  break;
66  default:
67  printf("%s %s (%s %s)\n",
68  "l0info_seawifs", L01VERSION, __DATE__, __TIME__);
69  printf("Usage: %s [-h -g] level0_filename\n", argv[0]);
70  exit(FATAL_ERROR);
71  break;
72  }
73  }
74  switch (argc - optind + 1) {
75  case 2:
76  break;
77  default:
78  printf("%s %s (%s %s)\n",
79  "l0info_seawifs", L01VERSION, __DATE__, __TIME__);
80  printf("Usage: %s [-h -g] level0_filename\n", argv[0]);
81  exit(FATAL_ERROR);
82  break;
83  }
84 
85  /* */
86  /* Initialize control structure */
87  /* */
88  l0ctl.timerangeFactor = 0; /* Get timerange limits from header */
89  l0ctl.maxBitErrors = 50; /* Max bit errors before tossing frame*/
90  l0ctl.gainSetting = 0; /* Forced gain setting, for HRPT only */
91  l0ctl.stopTimeDelta = 2700; /* Stop-time delta (seconds) */
92 
93  nframes = getl0indx(argv[optind], &l0ctl, &indx);
94  if (nframes > 0) {
95  printindx(&indx);
96  nscenes = getl0scene(&indx, scene);
97  printscene(nscenes, scene);
98  }
99 
100  if (nscenes < 1)
101  exit(1);
102  else
103  exit(nframes);
104 }
105 
106 
107 
108 
INT32 getl0indx(char *filename, swl0ctl *l0ctl, swl0indx *indx)
Definition: getl0indx.c:15
int main(int argc, char *argv[])
Definition: main_l0info.c:40
int32_t INT32
Definition: elements.h:6
#define GAC
Definition: l1stat.h:33
#define HRPT
Definition: l1stat.h:35
#define CMD_ARGS
Definition: main_l0info.c:34
void printindx(swl0indx *indx)
Definition: printindx.c:29
#define FATAL_ERROR
Definition: swl0_parms.h:5
#define L01VERSION
Definition: swl0_parms.h:4
void printscene(int nscenes, swl0scene scene[])
Definition: printscene.c:14
int16_t * nscenes
Definition: l2bin.cpp:86
#define MAXSCENES
Definition: swl0_parms.h:10
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 as required for compatibility with version of the SDP toolkit Corrected test output file names to end in per delivery and then split off a new MYD_PR03 pcf file for Aqua Added AssociatedPlatformInstrumentSensor to the inventory metadata in MOD01 mcf and MOD03 mcf Created new versions named MYD01 mcf and MYD03 where AssociatedPlatformShortName is rather than Terra The program itself has been changed to read the Satellite Instrument validate it against the input L1A and LUT and to use it determine the correct files to retrieve the ephemeris and attitude data from Changed to produce a LocalGranuleID starting with MYD03 if run on Aqua data Added the Scan Type file attribute to the Geolocation copied from the L1A and attitude_angels to radians rather than degrees The accumulation of Cumulated gflags was moved from GEO_validate_earth_location c to GEO_locate_one_scan c
Definition: HISTORY.txt:464
INT16 getl0scene(swl0indx *indx, swl0scene scene[])
Definition: getl0scene.c:14