OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
nav_read.c
Go to the documentation of this file.
1 #include <string.h>
2 //#include "netcdf.h"
3 #include "mfhdf.h"
4 #include "l1io.h"
5 
6 int32 nav_read(l1info_struct l1info, int irec,
7  navblockType *nav)
8 /*******************************************************************
9 
10  nav_read
11 
12  purpose: read just a record of nav info from a hdf dataset
13 
14  Returns type: int32 - return status: 0 is good
15 
16  Parameters: (in calling order)
17  Type Name I/O Description
18  ---- ---- --- -----------
19  struct l1info_struct l1info I information struct
20  about the opened file
21  int irec I line, record # to read
22  struct navblockType * nav O navigation info struct
23 
24  Modification history:
25  Programmer Date Description of change
26  ---------- ---- ---------------------
27  W. Robinson 10-Feb-1995 Original development
28 
29  *******************************************************************/
30  {
31  int i, j;
32  int32 index, rank, sdid, numbertype, nattrs, data_dims[5];
33  int32 start[5], edge[5];
34  void *ptr; /* generic data pointer */
35  char name[H4_MAX_NC_NAME]; /* MAX_NC_NAME is max # chars for this */
36 
37  /* This is the list of names of the data elements we will be getting */
38  static char *namelist[4] ={"orb_vec", "sun_ref", "sen_mat", "scan_ell"};
39 
40  /*
41  * now, SDnametoindex is used to zero in on the data we want,
42  * ie. get the index of the data
43  */
44 
45  for (i = 0; i < 4; i++) {
46  if ((index = SDnametoindex(l1info.sdfid, namelist[i])) < 0) {
47  printf("l1io_read: couldn't find %s in the qc dataset\n",
48  namelist[i]);
49  return -1;
50  }
51 
52  /*
53  * next, get the SD ID for the data
54  */
55  if ((sdid = SDselect(l1info.sdfid, index)) < 0) {
56  printf("l1io_read: Failed in SDselect for item %s\n",
57  namelist[i]);
58  return -1;
59  }
60 
61  /*
62  * now, get the size information of the data item
63  */
64  if (SDgetinfo(sdid, name, &rank, data_dims, &numbertype,
65  &nattrs) < 0) {
66  printf("l1io_read: Failed in SDgetinfo for item %s\n",
67  namelist[i]);
68  return -1;
69  }
70 
71  /*
72  * compute the read controls
73  */
74  for (j = 0; j < rank; j++) {
75  start[j] = 0;
76  edge[j] = 1; /* test WDR */
77  edge[j] = data_dims[j];
78  }
79  start[0] = irec; /* the first dim is the row dim so set for the rec */
80  edge[0] = 1;
81 
82  /*
83  * set the pointer to read into for the 8 sds arrays being read
84  */
85 
86  switch (i) {
87  case 0: /* "orb_vec" */
88  {
89  ptr = (void *) (nav->orb_vec);
90  break;
91  }
92  case 1: /* "sun_ref" */
93  {
94  ptr = (void *) (nav->sun_ref);
95  break;
96  }
97  case 2: /* "sen_mat" */
98  {
99  ptr = (void *) (nav->sen_mat);
100  break;
101  }
102  case 3: /* "scan_ell" */
103  {
104  ptr = (void *) (nav->scan_ell);
105  break;
106  }
107  }
108  /*
109  * read the data
110  */
111  if (SDreaddata(sdid, start, NULL, edge, ptr) < 0) {
112  printf("l2io_read: failure to read data for item %s\n", namelist[i]);
113  return -1;
114  }
115  }
116  return 0;
117 }
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of it will be treated as a constant LUT The manner in which Earth View data is checked for saturation was changed Previously the raw Earth View DNs and Space View DNs were checked against the lookup table values contained in the table dn_sat The change made is to check the raw Earth and Space View DNs to be sure they are less than the maximum saturation value and to check the Space View subtracted Earth View dns against a set of values contained in the new lookup table dn_sat_ev The metadata configuration and ASSOCIATEDINSTRUMENTSHORTNAME from the MOD02HKM product The same metatdata with extensions and were removed from the MOD021KM and MOD02OBC products ASSOCIATEDSENSORSHORTNAME was set to MODIS in all products These changes are reflected in new File Specification which users may consult for exact the pow functions were eliminated in Emissive_Cal and Emissive bands replaced by more efficient code Other calculations throughout the code were also made more efficient Aside from a few round off there was no difference to the product The CPU time decreased by about for a day case and for a night case A minor bug in calculating the uncertainty index for emissive bands was corrected The frame index(0-based) was previously being used the frame number(1-based) should have been used. There were only a few minor changes to the uncertainty index(maximum of 1 digit). 3. Some inefficient arrays(Sigma_RVS_norm_sq) were eliminated and some code lines in Preprocess_L1A_Data were moved into Process_OBCEng_Emiss. There were no changes to the product. Required RAM was reduced by 20 MB. Now
int j
Definition: decode_rs.h:73
#define NULL
Definition: decode_rs.h:63
int32 nav_read(l1info_struct l1info, int irec, navblockType *nav)
Definition: nav_read.c:6
Extra metadata that will be written to the HDF4 file l2prod rank
int i
Definition: decode_rs.h:71