OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
output_eng2_pkt1_to_scan.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "PGS_IO.h"
3 #include "PD_pkt_data.h"
4 #include "SC_scan.h"
5 #include "hdfi.h"
6 
7 
8 void output_eng2_pkt1_to_scan (PGSt_IO_L0_Packet *pkt,
9  SC_SCAN_DATA_t *L1A_scan)
10 
11 /*
12 !C************************************************************************
13 
14 !Description: This routine extracts the engineering2, packet1 data contents
15  and puts it in the scan structure.
16 
17 !Input Parameters:
18  PGSt_IO_L0_Packet *pkt ** The structure containing **
19  ** the current packet's **
20  ** unpacked contents **
21 
22 !Output Parameters:
23  None
24 
25 !Input/Output Parameters:
26  SC_SCAN_DATA_t *L1A_scan ** The MODIS scan structure **
27  ** currently being built **
28 
29 Return Values:
30  None
31 
32 Externally Defined:
33  PGSt_IO_L0_Packet (PGS_IO.h)
34  PD_E2P1_NUM_HK_TELEM_BYTES (PD_pkt_data.h)
35  PD_E2P1_CURR_HK_BYTE_OFFSET (PD_pkt_data.h)
36  PD_E2P1_PRIOR_HK_BYTE_OFFSET (PD_pkt_data.h)
37  PD_E2P1_NUM_SC_ANCIL_WORDS (PD_pkt_data.h)
38  PD_E2P1_SC_ANCIL_BYTE_OFFSET (PD_pkt_data.h)
39  PD_E2P1_NUM_PARAM_BYTES (PD_pkt_data.h)
40  PD_E2P1_PARAM_BYTE_OFFSET (PD_pkt_data.h)
41  SC_SCAN_DATA_t (SC_scan.h)
42 
43 Called By:
44  output_eng_data_to_scan
45 
46 Routines Called:
47  None
48 
49 !Revision History:
50  Revision 2.0 1997/09/09 13:16 EDT
51  Timi Adelekan/GSC (adelekan@ltpmail.gsfc.nasa.gov)
52  Originated Code.
53 
54  Revision 1.1 1997/08/27 10:00
55  Tom Johnson (johnson@ltpmail.gsfc.nasa.gov)
56  Incorporate PDL walkthru comments
57 
58  Revision 1.0 1997/08/14 16:10 EDT
59  Timi Adelekan/GSC (adelekan@ltpmail.gsfc.nasa.gov)
60  Original design
61 
62 !Team-unique Header:
63  This software is developed by the MODIS Science
64  Data Support Team (SDST) for the National Aeronautics
65  and Space Administration (NASA), Goddard Space Flight
66  Center (GSFC), under contract NAS5-32373.
67 
68 !References and Credits:
69  None
70 
71 !Design Notes:
72  The CODE below was developed in C language.
73 
74  This routine was designed totally under the assumption that
75  the packet header has been previously validated and there
76  is no need to test for error conditions.
77 
78 !END************************************************************************
79 */
80 
81  {
82  /**************************************************************************/
83  /* Define and Initialize Local Variables */
84  /* */
85  /**************************************************************************/
86 
87  int start_pos; /* Offset to structure location within pkt */
88  int i; /* loop variable */
89 
90 
91  /**************************************************************************/
92  /* */
93  /* Use loop to move engineering 2, packet 1 contents to scan structure */
94  /* Suggested loop: FOR loop */
95  /* */
96  /**************************************************************************/
97  /* */
98  /* FOR index equals 0 up to PD_E2P1_NUM_HK_TELEM_BYTES */
99  /* set SC_SCAN_DATA_t.raw_hk_telem[index] equal to */
100  /* pkt[PD_E2P1_CURR_HK_BYTE_OFFSET + index] */
101  /* ENDFOR */
102  /* */
103  /**************************************************************************/
104 
105  for (i = 0; i < PD_E2P1_NUM_HK_TELEM_BYTES; i++)
106  L1A_scan->raw_hk_telem[i] = pkt[PD_E2P1_CURR_HK_BYTE_OFFSET + i];
107 
108 
109  /**************************************************************************/
110  /* */
111  /* set start_pos equal to PD_E2P1_SC_ANCIL_BYTE_OFFSET */
112  /* */
113  /* FOR index equal 0 upto PD_E2P1_NUM_SC_ANCIL_WORDS */
114  /* SC_SCAN_DATA_t.raw_sc_ancil[index] = pkt[start_pos] shifted left 8 */
115  /* bits OR pkt[start_pos+1] */
116  /* */
117  /* increment start_pos by PD_NUM_BYTES_IN_WORD */
118  /* ENDFOR */
119  /* */
120  /**************************************************************************/
121 
122  start_pos = PD_E2P1_SC_ANCIL_BYTE_OFFSET;
123 
124  for (i = 0; i < PD_E2P1_NUM_SC_ANCIL_WORDS; i++) {
125  L1A_scan->raw_sc_ancil[i] =
126  ((int16)(pkt[start_pos]))<<8 | ((int16)(pkt[start_pos+1]));
127  start_pos += PD_NUM_BYTES_IN_WORD;
128  }
129 
130  /**************************************************************************/
131  /* */
132  /* FOR index equals 0 up to PD_E2P1_NUM_PARAM_BYTES */
133  /* set SC_SCAN_DATA_t.raw_param[index] equal to */
134  /* pkt[PD_E2P1_PARAM_BYTE_OFFSET + index] */
135  /* ENDFOR */
136  /* */
137  /**************************************************************************/
138 
139  for (i = 0; i < PD_E2P1_NUM_PARAM_BYTES; i++)
140  L1A_scan->raw_param[i] = pkt[PD_E2P1_PARAM_BYTE_OFFSET + i];
141 
142  } /* End of routine output_engr2_pkt1_to_scan */
integer, parameter int16
Definition: cubeio.f90:3
void output_eng2_pkt1_to_scan(PGSt_IO_L0_Packet *pkt, SC_SCAN_DATA_t *L1A_scan)
#define PD_E2P1_NUM_SC_ANCIL_WORDS
Definition: PD_pkt_data.h:152
#define PD_E2P1_CURR_HK_BYTE_OFFSET
Definition: PD_pkt_data.h:150
#define PD_NUM_BYTES_IN_WORD
Definition: PD_pkt_data.h:73
#define PD_E2P1_NUM_PARAM_BYTES
Definition: PD_pkt_data.h:154
#define PD_E2P1_PARAM_BYTE_OFFSET
Definition: PD_pkt_data.h:155
int8 raw_hk_telem[PD_E2P1_NUM_HK_TELEM_BYTES]
Definition: SC_scan.h:246
int8 raw_param[PD_E2P1_NUM_PARAM_BYTES]
Definition: SC_scan.h:248
int16 raw_sc_ancil[PD_E2P1_NUM_SC_ANCIL_WORDS]
Definition: SC_scan.h:247
#define PD_E2P1_NUM_HK_TELEM_BYTES
Definition: PD_pkt_data.h:149
for(i=0;i< NROOTS;i++) s[i]
Definition: decode_rs.h:85
#define PD_E2P1_SC_ANCIL_BYTE_OFFSET
Definition: PD_pkt_data.h:153
int i
Definition: decode_rs.h:71