OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
output_eng1_pkt2_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 void output_eng1_pkt2_to_scan (PGSt_IO_L0_Packet *pkt,
8  SC_SCAN_DATA_t *L1A_scan)
9 
10 /*
11 !C************************************************************************
12 
13 !Description: This routine extracts the engineering1, packet2 data contents
14  and puts it in the scan structure.
15 
16 !Input Parameters:
17  PGSt_IO_L0_Packet *pkt ** The structure containing **
18  ** the current packet's **
19  ** unpacked contents **
20 
21 !Output Parameters:
22  None
23 
24 !Input/Output Parameters:
25  SC_SCAN_DATA_t *L1A_scan ** The MODIS scan structure **
26  ** currently being built **
27 
28 Return Values:
29  None
30 
31 Externally Defined:
32  PGSt_IO_L0_Packet (PGS_IO.h)
33  PD_FIRST_BIT_IN_BYTE (PD_pkt_data.h)
34  PD_NUM_BYTES_IN_WORD (PD_pkt_data.h)
35  PD_E1P2_NUM_EARTH_ENCODER_TIMES (PD_pkt_data.h)
36  PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS (PD_pkt_data.h)
37  PD_E1P2_NUM_VIEW_SECTOR_ACTUALS (PD_pkt_data.h)
38  PD_E1P2_NUM_SCI_ENG_BYTES (PD_pkt_data.h)
39  PD_E1P2_EARTH_ENCODER_TIMES_BYTE_OFFSET (PD_pkt_data.h)
40  PD_E1P2_VIEW_SECTOR_DEFINITIONS_BYTE_OFFSET (PD_pkt_data.h)
41  PD_E1P2_VIEW_SECTOR_ACTUALS_BYTE_OFFSET (PD_pkt_data.h)
42  PD_E1P2_SCI_ENG_BYTE_OFFSET (PD_pkt_data.h)
43  SC_SCAN_DATA_t (SC_scan.h)
44 
45 Called By:
46  output_eng_data_to_scan
47 
48 Routines Called:
49  None
50 
51 !Revision History:
52  Revision 3.0 2001/04/13
53  John Seaton (seaton@ltpmail.gsfc.nasa.gov)
54  Changed raw_mir_enc to uint16
55 
56  Revision 2.0 1997/09/09 13:10 EDT
57  Timi Adelekan/GSC (adelekan@ltpmail.gsfc.nasa.gov)
58  Originated Code.
59 
60  Revision 1.1 1997/08/27 9:50
61  Tom Johnson (johnson@ltpmail.gsfc.nasa.gov)
62  Incorporate PDL walkthru comments
63 
64  Revision 1.0 1997/08/14 15:45 EDT
65  Timi Adelekan/GSC (adelekan@ltpmail.gsfc.nasa.gov)
66  Original design
67 
68 !Team-unique Header:
69  This software is developed by the MODIS Science
70  Data Support Team (SDST) for the National Aeronautics
71  and Space Administration (NASA), Goddard Space Flight
72  Center (GSFC), under contract NAS5-32373.
73 
74 !References and Credits:
75  None
76 
77 !Design Notes:
78  The CODE below was developed in C language.
79 
80  This routine was designed totally under the assumption that
81  the packet header has been previously validated and there
82  is no need to test for error conditions.
83 
84 !END************************************************************************
85 */
86 
87  {
88  /*************************************************************************/
89  /* */
90  /* Define and Initialize Local Variables */
91  /* */
92  /*************************************************************************/
93 
94  int start_pos; /* Offset to structure location within pkt */
95  int i; /* loop variable */
96 
97 
98 
99  /*************************************************************************/
100  /* */
101  /* Use loop to move engineering 1, packet 2 contents to scan structure */
102  /* Suggested loop: FOR loop */
103  /* */
104  /*************************************************************************/
105  /* */
106  /* set start_pos equal to PD_E1P2_EARTH_ENCODER_TIMES_BYTE_OFFSET */
107  /* */
108  /* FOR index equal 0 upto PD_E1P2_NUM_EARTH_ENCODER_TIMES */
109  /* SC_SCAN_DATA_t.raw_mir_enc[index] = pkt[start_pos] shifted left 8 */
110  /* bits OR pkt[start_pos+1] */
111  /* */
112  /* increment start_pos by PD_NUM_BYTES_IN_WORD */
113  /* ENDFOR */
114  /* */
115  /*************************************************************************/
116 
118 
119  for (i = 0; i < PD_E1P2_NUM_EARTH_ENCODER_TIMES; i++) {
120  L1A_scan->raw_mir_enc[i] =
121  ((int16)(pkt[start_pos]))<<8 | ((int16)(pkt[start_pos+1]));
122 
123  start_pos += PD_NUM_BYTES_IN_WORD;
124  }
125 
126 
127 
128  /*************************************************************************/
129  /* */
130  /* set start_pos equal to PD_E1P2_VIEW_SECTOR_DEFINITIONS_BYTE_OFFSET */
131  /* */
132  /* FOR index equal 0 upto PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS */
133  /* SC_SCAN_DATA_t.raw_vs_def[index] = pkt[start_pos] shifted left 8 */
134  /* bits OR pkt[start_pos+1] */
135  /* */
136  /* increment start_pos by PD_NUM_BYTES_IN_WORD */
137  /* ENDFOR */
138  /* */
139  /*************************************************************************/
140 
142 
143  for (i = 0; i < PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS; i++) {
144  L1A_scan->raw_vs_def[i] =
145  ((int16)(pkt[start_pos]))<<8 | ((int16)(pkt[start_pos+1]));
146  start_pos += PD_NUM_BYTES_IN_WORD;
147  }
148 
149 
150 
151  /*************************************************************************/
152  /* */
153  /* set start_pos equal to PD_E1P2_VIEW_SECTOR_ACTUALS_BYTE_OFFSET */
154  /* */
155  /* FOR index equal 0 upto PD_E1P2_NUM_VIEW_SECTOR_ACTUALS */
156  /* SC_SCAN_DATA_t.raw_vs_act[index] = pkt[start_pos] shifted left 8 */
157  /* bits OR pkt[start_pos+1] */
158  /* */
159  /* increment start_pos by PD_NUM_BYTES_IN_WORD */
160  /* ENDFOR */
161  /* */
162  /*************************************************************************/
163 
165 
166  for (i = 0; i < PD_E1P2_NUM_VIEW_SECTOR_ACTUALS; i++) {
167  L1A_scan->raw_vs_act[i] =
168  ((int16)(pkt[start_pos]))<<8 | ((int16)(pkt[start_pos+1]));
169 
170  start_pos += PD_NUM_BYTES_IN_WORD;
171  }
172 
173 
174 
175  /*************************************************************************/
176  /* */
177  /* FOR index equals 0 up to PD_E1P2_NUM_SCI_ENG_BYTES */
178  /* set SC_SCAN_DATA_t.raw_sci_eng[index] equal to */
179  /* pkt[PD_E1P2_SCI_ENG_BYTE_OFFSET + index] */
180  /* ENDFOR */
181  /* */
182  /*************************************************************************/
183 
184  for (i = 0; i < PD_E1P2_NUM_SCI_ENG_BYTES; i++)
185  L1A_scan->raw_sci_eng[i] = pkt[PD_E1P2_SCI_ENG_BYTE_OFFSET + i];
186 
187  } /* End of routine output_eng1_pkt2_to_scan */
integer, parameter int16
Definition: cubeio.f90:3
int16 raw_vs_act[PD_E1P2_NUM_VIEW_SECTOR_ACTUALS]
Definition: SC_scan.h:244
#define PD_NUM_BYTES_IN_WORD
Definition: PD_pkt_data.h:73
int16 raw_vs_def[PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS]
Definition: SC_scan.h:243
#define PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS
Definition: PD_pkt_data.h:136
#define PD_E1P2_NUM_EARTH_ENCODER_TIMES
Definition: PD_pkt_data.h:134
#define PD_E1P2_SCI_ENG_BYTE_OFFSET
Definition: PD_pkt_data.h:141
#define PD_E1P2_NUM_VIEW_SECTOR_ACTUALS
Definition: PD_pkt_data.h:138
void output_eng1_pkt2_to_scan(PGSt_IO_L0_Packet *pkt, SC_SCAN_DATA_t *L1A_scan)
int8 raw_sci_eng[SC_NUM_SCI_ENG_BYTES_IN_SDS]
Definition: SC_scan.h:245
#define PD_E1P2_VIEW_SECTOR_DEFINITIONS_BYTE_OFFSET
Definition: PD_pkt_data.h:137
#define PD_E1P2_VIEW_SECTOR_ACTUALS_BYTE_OFFSET
Definition: PD_pkt_data.h:139
int i
Definition: decode_rs.h:71
#define PD_E1P2_NUM_SCI_ENG_BYTES
Definition: PD_pkt_data.h:140
#define PD_E1P2_EARTH_ENCODER_TIMES_BYTE_OFFSET
Definition: PD_pkt_data.h:135
int16 raw_mir_enc[PD_E1P2_NUM_EARTH_ENCODER_TIMES]
Definition: SC_scan.h:242