OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
output_nightmode_data_to_scan.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "hdfi.h"
3 #include "PH_pkt_hdr.h"
4 #include "PD_pkt_data.h"
5 #include "SC_scan.h"
6 
7 
9  uint16 *pkt_contents,
10  SC_EV_1KM_NIGHT EV_1km_night )
11 
12 /*
13 !C************************************************************************
14 
15 !Description: The routine takes an unpacked nightmode packet and places the
16  packet's contents in the scan structure.
17 
18 !Input Parameters:
19  PH_PACKET_HEADER_t *pkt_header ** The structure containing **
20  ** the current packet's **
21  ** packet header **
22 
23  uint16 *pkt_contents ** The structure containing **
24  ** the current packet's **
25  ** unpacked contents **
26 
27 !Output Parameters:
28  None
29 
30 !Input/Output Parameters:
31  SC_EV_1KM_NIGHT EV_1km_night ** array that holds earth **
32  ** view sector 1km night **
33  ** radiances **
34 
35 Return Values:
36  None
37 
38 
39 Externally Defined:
40  int16 (hdfi.h)
41  uint16 (hdfi.h)
42  PH_PACKET_HEADER_t (PH_pkt_hdr.h)
43  PD_DN_FIRST_1KM_NIGHT_BAND (PD_pkt_data.h)
44  PD_DN_LAST_1KM_NIGHT_BAND (PD_pkt_data.h)
45  PD_DN_NUM_IFOVS_IN_NIGHT_PKT (PD_pkt_data.h)
46  PD_DN_NUM_1KMNIGHT_DETECTORS (PD_pkt_data.h)
47  SC_EV_1KM_NIGHT (SC_scan.h)
48 
49 Called By:
50  put_pkt_cont_in_scan
51 
52 Routines Called:
53  None
54 
55 !Revision History:
56  Revision 2.0 1997/09/09 11:50 EDT
57  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
58  Recreating module per version2 developement.
59 
60  Revision 1.1 1997/08/27 9:40
61  Tom Johnson (johnson@ltpmail.gsfc.nasa.gov)
62  Incorporate PDL walkthru comments
63 
64  Revision 1.0 1997/06/18 16:40 EDT
65  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
66  Baseline from Version 1.
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  /* set pkt_cont_pos equal to PH_NUM_12BIT_WORDS_IN_HEADER */
95  /* set start_ifov equal to 0 */
96  /* set end_ifov equal to PD_NUM_IFOVS_IN_NIGHT_PKT - 1 */
97  /* */
98  /*************************************************************************/
99 
100  int start_ifov; /* starting ifov position within scan */
101  int end_ifov; /* ending ifov position within scan */
102  int det_num; /* Calculated detector number; used to */
103  /* properly place data in science arrays */
104  int band; /* Band indicator (used as loop variable) */
105  int band_num; /* Band indicator corrected for each */
106  /* detector group's start position */
107  int line_num; /* Calculated line number; used to pro- */
108  /* perly extract data in science arrays */
109  int frame; /* Calculated frame number; used to pro- */
110  /* perly extract data in science arrays */
111  int pkt_cont_pos; /* index into packet_contents */
112 
113 
114  det_num = 0;
115  band = 0;
116  band_num = 0;
117  line_num = 0;
118  frame = 0;
119  start_ifov = 0;
120  end_ifov = PD_DN_NUM_IFOVS_IN_NIGHT_PKT;
121  pkt_cont_pos = PH_NUM_12BIT_WORDS_IN_HEADER;
122 
123 
124  /**************************************************************************/
125  /* */
126  /* First check the Validity of the packet's frame count, then extract */
127  /* the nightmode data */
128  /* */
129  /**************************************************************************/
130  /* */
131  /* IF PH_PACKET_HEADER_t.earth_frame_cnt is greater than zero */
132  /* THEN */
133  /* set frame equal to PH_PACKET_HEADER_t.earth_frame_cnt */
134  /* FOR det_num equal to start_ifov to end_ifov */
135  /* {The 1km night data is all that is in the packet, with one } */
136  /* {sample per band } */
137  /* FOR band equal to PD_DN_FIRST_1KM_NIGHT_BAND to */
138  /* PD_DN_LAST_1KM_NIGHT_BAND */
139  /* set band_num equal to band - PD_DN_FIRST_1KM_NIGHT_BAND */
140  /* {Correct line number to account for instrument detector } */
141  /* {numbering } */
142  /* set line_num equal to (PD_DN_NUM_1KMNIGHT_DETECTORS - 1) - */
143  /* det_num */
144  /* set EV_1km_night(line_num,band_num,frame) equal to */
145  /* pkt_contents(pkt_cont_pos) */
146  /* set pkt_cont_pos to pkt_cont_pos + 1 */
147  /* ENDFOR (next band) */
148  /* ENDFOR (next ifov) */
149  /* ENDIF */
150  /* */
151  /**************************************************************************/
152 
153  if (pkt_header->earth_frame_cnt > 0) {
154  frame = pkt_header->earth_frame_cnt - 1;
155  for (det_num = start_ifov; det_num < end_ifov; det_num++) {
158  band++) {
159  band_num = band - PD_DN_FIRST_1KM_NIGHT_BAND;
160  line_num = (PD_DN_NUM_1KMNIGHT_DETECTORS - 1) - det_num;
161  EV_1km_night[line_num][band_num][frame] =
162  pkt_contents[pkt_cont_pos];
163  pkt_cont_pos++;
164  }
165  }
166  }
167 
168  } /* End of routine output_nightmode_data_to_scan */
void output_nightmode_data_to_scan(PH_PACKET_HEADER_t *pkt_header, uint16 *pkt_contents, SC_EV_1KM_NIGHT EV_1km_night)
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second band
#define PD_DN_NUM_IFOVS_IN_NIGHT_PKT
Definition: PD_pkt_data.h:112
#define PD_DN_NUM_1KMNIGHT_DETECTORS
Definition: PD_pkt_data.h:109
#define PD_DN_LAST_1KM_NIGHT_BAND
Definition: PD_pkt_data.h:104
#define PD_DN_FIRST_1KM_NIGHT_BAND
Definition: PD_pkt_data.h:103
#define PH_NUM_12BIT_WORDS_IN_HEADER
Definition: PH_pkt_hdr.h:78
int16 SC_EV_1KM_NIGHT[PD_DN_NUM_1KMNIGHT_DETECTORS][PD_DN_NUM_1KMNIGHT_BANDS][PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT *PD_DN_BAND_RATIO_1KM]
Definition: SC_scan.h:196