OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
cztimqual.c
Go to the documentation of this file.
1 #include "l1czcs.h"
2 
3 int cztimqual(char *file, timqual_struc *timqual, int *orb_st_day)
4 /*******************************************************************
5 
6  cztimqual
7 
8  purpose: get a time and quality record fro a CZCS L1 file
9 
10  Returns type: int - return status: 0 is good
11 
12  Parameters: (in calling order)
13  Type Name I/O Description
14  ---- ---- --- -----------
15  char * file I name of file to open
16  timqual_struc * timqual O structure with time, quality
17  summary
18  int * orb_st_day I/O orbit start day - determined
19  from first file's start day
20  and < 0 if uninitialized
21 
22  Modification history:
23  Programmer Date Description of change
24  ---------- ---- ---------------------
25  W. Robinson, SAIC 6 Aug 2004 Original development
26 
27  *******************************************************************/
28  {
29  l1_data_struc cz_dat;
30  gattr_struc cz_attr;
31  int i;
32  int32_t fil_st_msec;
33  /*
34  * read in the basic L1 data needed to generate the time and quality
35  */
36  if (cz_l1_read(file, 1, &cz_attr, &cz_dat) != 0) return -1;
37  timqual->nscan = cz_attr.scan_lines;
38  timqual->n_ctl_pt = cz_attr.n_ctl_pt;
39  if (*orb_st_day < 0) *orb_st_day = cz_attr.start_day;
40  /*
41  * set up the areas in the timqual struct to receive data
42  */
43  timqual->qual = (int *) malloc(cz_attr.scan_lines * sizeof ( int));
44  timqual->msec = (int32_t *) malloc(cz_attr.scan_lines * sizeof ( int32_t));
45  /*
46  * transfer the time and create the quality
47  */
48  fil_st_msec = cz_dat.msec[0];
49 
50  for (i = 0; i < cz_attr.scan_lines; i++) {
51  /*
52  * if either the current file's start day is different (1 more) than
53  * the orbit start day or the msec is < the file's start msec,
54  * incriment the msec value in the timqual struct by 1 day (86400000 msec)
55  * this assures steadily rising time in the timqual struct
56  */
57  timqual->msec[i] = ((cz_dat.msec[i] < fil_st_msec) ||
58  (cz_attr.start_day != *orb_st_day)) ?
59  cz_dat.msec[i] + 86400000 : cz_dat.msec[i];
60 
61  if ((cz_attr.parm_presence & 0XF8) != 0XF8)
62  timqual->qual[i] = 1; /* the needed channel missing from file */
63  else {
64  /* if the nav may be bad or missing data in band 1-5 for this scan */
65  if ((cz_dat.cal_sum[ i * 5 + 3 ] != 0) ||
66  (cz_dat.cal_sum[ i * 5 + 4 ] != 0) ||
67  (cz_dat.cal_scan[ i * 6 ] != 0) ||
68  (cz_dat.cal_scan[ i * 6 + 1 ] != 0) ||
69  (cz_dat.cal_scan[ i * 6 + 2 ] != 0) ||
70  (cz_dat.cal_scan[ i * 6 + 3 ] != 0) ||
71  (cz_dat.cal_scan[ i * 6 + 4 ] != 0))
72  timqual->qual[i] = 1;
73  else
74  timqual->qual[i] = 0;
75  }
76  }
77  /*
78  * remove allocated arrays in data struct
79  */
80  cz_dat_free(&cz_dat, 1);
81  return 0;
82 }
int cz_l1_read(char *file, int r_mode, gattr_struc *cz_attr, l1_data_struc *cz_dat)
Definition: cz_l1_read.c:4
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
character(len=1000) if
Definition: names.f90:13
void cz_dat_free(l1_data_struc *l1_data, int r_mode)
Definition: cz_dat_alloc.c:106
int cztimqual(char *file, timqual_struc *timqual, int *orb_st_day)
Definition: cztimqual.c:3
int i
Definition: decode_rs.h:71