OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
update_eng_data_for_maj_cycle_n.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "hdf.h"
3 #include "PGS_IO_L0.h"
4 #include "EN_eng_data.h"
5 #include "PH_pkt_hdr.h"
6 
7 void update_eng_data_for_maj_cycle_n ( uint16 major_cycle,
8  PGSt_IO_L0_Packet *eng_pkt_2_1,
9  uint16 scan_number,
10  EN_VDATA_TYPE_t *eng_data,
11  int is_cp_hk_prior_section )
12 
13 
14 /*
15 !C***********************************************************************************
16 
17 !Description: This function processes the major cycle dependent parts of group 2
18  pkt #1's Current/Prior HK Tlmy section. The appropriate eng_data Vdatas
19  are updated for this scan using the data in the engineering packet's
20  Current/Prior HK Tlmy section.
21  (c.f. CDRL Table 30-6A and the Vdata_list file).
22 
23  The following table shows the Major Cycle to vdata_array index
24  relationship.
25 
26  ----------------------------------------------------------------------
27  If Major Cycle is: | then update Vdatas at vdata_array indices:
28  ----------------------------------------------------------------------
29  Major Cycle (MOD 8) = |
30  0 | 3
31  1 | 4
32  2 | 5
33  3 | 6, 7, 8
34  4 | 9, 10
35  5 | 11, 12
36  6 | 13
37  7 | 14
38  ----------------------------------------------------------------------
39  0..32 | 15..47
40  ----------------------------------------------------------------------
41  (c.f. CDRL Table 30-6A, CDRL Table 20-4, and the Vdata_list)
42 
43 
44 
45 !Input Parameters:
46  uint16 major_cycle ** The major cycle for which
47  to update the eng_data **
48 
49  PGSt_IO_LO_Packet *eng_pkt_2_1 ** eng grp 2 packet #1 for the
50  current scan **
51 
52  uint16 scan_number ** The scan number (counting
53  from 1) of the current scan
54  within the current granule **
55 
56  boolean is_cp_hk_prior_section ** whether or not
57  this is the "prior"
58  part of eng pkt
59  2-1's current/prior
60  section **
61 !Output Parameters:
62  None
63 
64 !Input/Output Parameters:
65  EN_VDATA_TYPE_t *eng_data ** The Vdata array structure **
66 
67 Return Values:
68  None
69 
70 Externally Defined:
71  EN_VDATA_TYPE_t (EN_eng_data.h)
72  PGSt_IO_LO_Packet (PGS_IO.h)
73  EN_NUM_MAJ_CYCLES (EN_eng_data.h)
74 
75 Called By:
76  process_cp_hk_tlmy
77 
78 Routines Called:
79  update_eng_data
80 
81 !Revision History:
82  Revision 2.0 2001/01/04
83  John Seaton (seaton@ltpmail.gsfc.nasa.gov)
84  Simplified code. Removed call to is_in_range
85 
86  revision 1.0 1997/09/12 17:30:00
87  Qi Huang/RDC (qhuang@ltpmail.gsfc.nasa.gov)
88  Original development
89 
90 !Team-unique Header:
91  This software is developed by the MODIS Science
92  Data Support Team (SDST) for the National Aeronautics
93  and Space Administration (NASA), Goddard Space Flight
94  Center (GSFC), under contract NAS5-32373.
95 
96 !References and Credits:
97  None
98 
99 !Design Notes:
100  None
101 
102 !END************************************************************************
103 */
104 {
105  int index;
106  uint16 cycle_x_of_7;
107 
108  /*******************************************************************************/
109  /* IF major_cycle is less than or equal to EN_NUM_MAJ_CYCLES (32) */
110  /* THEN */
111  /* Set index to major_cycle + 15 */
112  /* CALL update_eng_data to update the appropriate */
113  /* "Telemetry Major Cycle X of 63" Vdata in the eng_data structure */
114  /* INPUTS: index,eng_pkt_2_1,scan_number,eng_data,is_cp_hk_prior_section */
115  /* OUTPUT: eng_data */
116  /* RETURN: None */
117  /* ENDIF */
118  /*******************************************************************************/
119 
120  if (major_cycle <= EN_NUM_MAJ_CYCLES)
121  {
122  index = major_cycle + 15;
123  update_eng_data(index,eng_pkt_2_1,scan_number,eng_data,is_cp_hk_prior_section);
124  }
125 
126 
127  /****************************************************************************/
128  /* SWITCH ( major_cycle MODULO 8 ) */
129  /* */
130  /* CASE 0: */
131  /* Set index to 3 */
132  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
133  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
134  /* values in the eng pkt for major cycle 0 */
135  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
136  /* is_cp_hk_prior_section */
137  /* OUTPUT: eng_data */
138  /* RETURN: None */
139  /* BREAK */
140  /* */
141  /* CASE 1: */
142  /* Set index to 4 */
143  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
144  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
145  /* values in the eng pkt for major cycle 1 */
146  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
147  /* is_cp_hk_prior_section */
148  /* OUTPUT: eng_data */
149  /* RETURN: None */
150  /* BREAK */
151  /* */
152  /* CASE 2: */
153  /* Set index to 5 */
154  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
155  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
156  /* values in the eng pkt for major cycle 2 */
157  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
158  /* is_cp_hk_prior_section */
159  /* OUTPUT: eng_data */
160  /* RETURN: None */
161  /* BREAK */
162  /* */
163  /* CASE 3: */
164  /* FOR ( index = 6 to 8 ) */
165  /* CALL update_eng_data to update the the appropriate "Telemetry */
166  /* Major Cycle X of 7" Vdata in the eng_data structure with the */
167  /* eng data values in the eng pkt for major cycle 3 */
168  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
169  /* is_cp_hk_prior_section */
170  /* OUTPUT: eng_data */
171  /* RETURN: None */
172  /* ENDFOR */
173  /* BREAK */
174  /* */
175  /* CASE 4: */
176  /* Set index to 9 */
177  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
178  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
179  /* values in the eng pkt for major cycle 4 */
180  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
181  /* is_cp_hk_prior_section */
182  /* OUTPUT: eng_data */
183  /* RETURN: None */
184  /* */
185  /* Set index to 10 */
186  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
187  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
188  /* values in the eng pkt for major cycle 4 */
189  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
190  /* is_cp_hk_prior_section */
191  /* OUTPUT: eng_data */
192  /* RETURN: None */
193  /* */
194  /* BREAK */
195  /* */
196  /* CASE 5: */
197  /* Set index to 11 */
198  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
199  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
200  /* values in the eng pkt for major cycle 5 */
201  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
202  /* is_cp_hk_prior_section */
203  /* OUTPUT: eng_data */
204  /* RETURN: None */
205  /* */
206  /* Set index to 12 */
207  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
208  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
209  /* values in the eng pkt for major cycle 5 */
210  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
211  /* is_cp_hk_prior_section */
212  /* OUTPUT: eng_data */
213  /* RETURN: None */
214  /* */
215  /* BREAK */
216  /* */
217  /* CASE 6: */
218  /* Set index to 13 */
219  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
220  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
221  /* values in the eng pkt for major cycle 6 */
222  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
223  /* is_cp_hk_prior_section */
224  /* OUTPUT: eng_data */
225  /* RETURN: None */
226  /* */
227  /* BREAK */
228  /* */
229  /* CASE 7: */
230  /* Set index to 14 */
231  /* CALL update_eng_data to update the the appropriate "Telemetry Major */
232  /* Cycle X of 7" Vdata in the eng_data structure with the eng data */
233  /* values in the eng pkt for major cycle 7 */
234  /* INPUTS: index, eng_pkt_2_1, scan_number, eng_data, */
235  /* is_cp_hk_prior_section */
236  /* OUTPUT: eng_data */
237  /* RETURN: None */
238  /* */
239  /* BREAK */
240  /* */
241  /* END_SWITCH */
242  /****************************************************************************/
243 
244  cycle_x_of_7 = major_cycle % 8;
245  switch(cycle_x_of_7)
246  {
247  case 0:
248  index = 3;
249  update_eng_data(index,eng_pkt_2_1,scan_number,eng_data,
250  is_cp_hk_prior_section);
251  break;
252 
253  case 1:
254  index = 4;
255  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
256  is_cp_hk_prior_section);
257  break;
258 
259  case 2:
260  index = 5;
261  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
262  is_cp_hk_prior_section);
263  break;
264 
265  case 3:
266  for (index=6; index<=8; index++)
267  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
268  is_cp_hk_prior_section);
269  break;
270 
271  case 4:
272  index = 9;
273  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
274  is_cp_hk_prior_section);
275 
276  index = 10;
277  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
278  is_cp_hk_prior_section);
279  break;
280 
281  case 5:
282  index = 11;
283  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
284  is_cp_hk_prior_section);
285 
286  index = 12;
287  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
288  is_cp_hk_prior_section);
289  break;
290 
291  case 6:
292  index = 13;
293  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
294  is_cp_hk_prior_section);
295  break;
296 
297  case 7:
298  index = 14;
299  update_eng_data(index, eng_pkt_2_1,scan_number,eng_data,
300  is_cp_hk_prior_section);
301  break;
302  }
303 
304  return;
305 }
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
#define EN_NUM_MAJ_CYCLES
Definition: EN_eng_data.h:67
void update_eng_data(uint16 index, PGSt_IO_L0_Packet *eng_packet, uint16 scan_number, EN_VDATA_TYPE_t *eng_data, int use_cp_prior_offset)
void update_eng_data_for_maj_cycle_n(uint16 major_cycle, PGSt_IO_L0_Packet *eng_pkt_2_1, uint16 scan_number, EN_VDATA_TYPE_t *eng_data, int is_cp_hk_prior_section)