OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
finalize_pixel_qual_data.c
Go to the documentation of this file.
1 #include "MD_metadata.h"
2 #include "PH_pkt_hdr.h"
3 #include "SC_scan.h"
4 #include "hdfi.h"
5 #include "L1A_prototype.h"
6 
7 
9  MD_SCAN_MET_t *scan_meta)
10 
11 /*
12 !C************************************************************************
13 
14 !Description: This function will set the unused parts of the pixel quality
15  data to fill values.
16 
17 !Input Parameters:
18 
19 
20 !Output Parameters:
21  MD_SCAN_MET_t *scan_meta ** The MODIS scan level **
22  ** metadata structure **
23 
24 !Input/Output Parameters:
25  SC_PIXEL_QUALITY_DATA_t *scan_pixel ** The MODIS scan pixel **
26  ** quality structure **
27 
28 Return Values:
29  None
30 
31 Externally Defined:
32  SC_PIXEL_QUALITY_DATA_t (SC_scan.h)
33  SC_FILL_VALUE (SC_scan.h)
34  MD_SCAN_MET_t (MD_metadata.h)
35  MD_EARTH_FRAMES_IN_SCAN (MD_metadata.h)
36  MD_SD_FRAMES_IN_SCAN (MD_metadata.h)
37  MD_SRCA_FRAMES_IN_SCAN (MD_metadata.h)
38  MD_BB_FRAMES_IN_SCAN (MD_metadata.h)
39  MD_SV_FRAMES_IN_SCAN (MD_metadata.h)
40  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX (PH_pkt_hdr.h)
41  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT (PH_pkt_hdr.h)
42  PH_REALISTIC_NUM_SD_FRAMES (PH_pkt_hdr.h)
43  PH_REALISTIC_NUM_SRCA_FRAMES (PH_pkt_hdr.h)
44  PH_REALISTIC_NUM_BB_FRAMES (PH_pkt_hdr.h)
45  PH_REALISTIC_NUM_SV_FRAMES (PH_pkt_hdr.h)
46  PH_REALISTIC_NUM_EV_FRAMES (PH_pkt_hdr.h)
47  MAX (hdfi.h)
48 
49 Called By:
50  process_a_scan
51 
52 Routines Called:
53  None
54 
55 !Revision History:
56  Revision 2.0 1997/09/05 14:00
57  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
58  Originated Code
59 
60  Revision 1.0 1997/08/27 11:00
61  Tom Johnson (johnson@ltpmail.gsfc.nasa.gov)
62  Created because of PDL walkthru comments
63 
64 !Team-unique Header:
65  This software is developed by the MODIS Science
66  Data Support Team (SDST) for the National Aeronautics
67  and Space Administration (NASA), Goddard Space Flight
68  Center (GSFC), under contract NAS5-32373.
69 
70 !References and Credits:
71  None
72 
73 !Design Notes:
74  The following CODE was written in C language.
75 
76 !END**********************************************************************
77 */
78 
79  {
80  /*************************************************************************/
81  /* */
82  /* Declare the local variables and initialize them. */
83  /* */
84  /*************************************************************************/
85 
86  int max_SD_frames; /* Maximum number of SD packets in scan */
87  int max_SRCA_frames; /* Maximum number of SDCA packets in scan */
88  int max_BB_frames; /* Maximum number of BB packets in scan */
89  int max_SV_frames; /* Maximum number of SV packets in scan */
90  int max_EV_frames; /* Maximum number of EV packets in scan */
91  int frame; /* Scan Pixel frame index counter */
92 
93 
94  max_SD_frames = 0;
95  max_SRCA_frames = 0;
96  max_BB_frames = 0;
97  max_SV_frames = 0;
98  max_EV_frames = 0;
99 
100 
101 
102  /*************************************************************************/
103  /* */
104  /* Set max_SD_frames to the larger of either */
105  /* (MD_SCAN_MET_t.frame_count_array[MD_SD_FRAMES_IN_SCAN] or */
106  /* PH_REALISTIC_NUM_SD_FRAMES */
107  /* */
108  /* FOR frame equals max_SD_frames to */
109  /* (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1) */
110  /* Set SC_PIXEL_QUALITY_DATA_t.SD_pix_qual[frame][0] to SC_FILL_VALUE */
111  /* Set SC_PIXEL_QUALITY_DATA_t.SD_pix_qual[frame][1] to SC_FILL_VALUE */
112  /* ENDFOR */
113  /* */
114  /*************************************************************************/
115 
116  max_SD_frames = MAX(scan_meta->frame_count_array[MD_SD_FRAMES_IN_SCAN],
118 
119  for (frame = max_SD_frames;
120  frame <= (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1);
121  frame++) {
122  scan_pixel->SD_pix_qual[frame][0] = SC_FILL_VALUE;
123  scan_pixel->SD_pix_qual[frame][1] = SC_FILL_VALUE;
124  }
125 
126 
127 
128  /*************************************************************************/
129  /* */
130  /* Set max_SRCA_frames to the larger of either */
131  /* (MD_SCAN_MET_t.frame_count_array[MD_SRCA_FRAMES_IN_SCAN] or */
132  /* PH_REALISTIC_NUM_SRCA_FRAMES */
133  /* */
134  /* FOR frame equals max_SRCA_frames to */
135  /* (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1) */
136  /* Set SC_PIXEL_QUALITY_DATA_t.SRCA_pix_qual[frame][0] to */
137  /* SC_FILL_VALUE */
138  /* Set SC_PIXEL_QUALITY_DATA_t.SRCA_pix_qual[frame][1] to */
139  /* SC_FILL_VALUE */
140  /* ENDFOR */
141  /* */
142  /*************************************************************************/
143 
144  max_SRCA_frames = MAX(scan_meta->frame_count_array[MD_SRCA_FRAMES_IN_SCAN],
146 
147  for (frame = max_SRCA_frames;
148  frame <= (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1);
149  frame++) {
150  scan_pixel->SRCA_pix_qual[frame][0] = SC_FILL_VALUE;
151  scan_pixel->SRCA_pix_qual[frame][1] = SC_FILL_VALUE;
152  }
153 
154 
155 
156  /*************************************************************************/
157  /* */
158  /* Set max_BB_frames to the larger of either */
159  /* (MD_SCAN_MET_t.frame_count_array[MD_BB_FRAMES_IN_SCAN] or */
160  /* PH_REALISTIC_NUM_BB_FRAMES */
161  /* */
162  /* FOR frame equals max_BB_frames to */
163  /* (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1) */
164  /* Set SC_PIXEL_QUALITY_DATA_t.BB_pix_qual[frame][0] to SC_FILL_VALUE */
165  /* Set SC_PIXEL_QUALITY_DATA_t.BB_pix_qual[frame][1] to SC_FILL_VALUE */
166  /* ENDFOR */
167  /* */
168  /*************************************************************************/
169 
170  max_BB_frames = MAX(scan_meta->frame_count_array[MD_BB_FRAMES_IN_SCAN],
172 
173  for (frame = max_BB_frames;
174  frame <= (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1);
175  frame++) {
176  scan_pixel->BB_pix_qual[frame][0] = SC_FILL_VALUE;
177  scan_pixel->BB_pix_qual[frame][1] = SC_FILL_VALUE;
178  }
179 
180 
181 
182  /*************************************************************************/
183  /* */
184  /* Set max_SV_frames to the larger of either */
185  /* (MD_SCAN_MET_t.frame_count_array[MD_SV_FRAMES_IN_SCAN] or */
186  /* PH_REALISTIC_NUM_SV_FRAMES */
187  /* */
188  /* FOR frame equals max_SV_frames to */
189  /* (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1) */
190  /* Set SC_PIXEL_QUALITY_DATA_t.SV_pix_qual[frame][0] to SC_FILL_VALUE */
191  /* Set SC_PIXEL_QUALITY_DATA_t.SV_pix_qual[frame][1] to SC_FILL_VALUE */
192  /* ENDFOR */
193  /* */
194  /*************************************************************************/
195 
196  max_SV_frames = MAX(scan_meta->frame_count_array[MD_SV_FRAMES_IN_SCAN],
198 
199  for (frame = max_SV_frames;
200  frame <= (PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX - 1);
201  frame++) {
202  scan_pixel->SV_pix_qual[frame][0] = SC_FILL_VALUE;
203  scan_pixel->SV_pix_qual[frame][1] = SC_FILL_VALUE;
204  }
205 
206 
207 
208  /*************************************************************************/
209  /* */
210  /* Set max_EV_frames to the larger of either */
211  /* (MD_SCAN_MET_t.frame_count_array[MD_EV_FRAMES_IN_SCAN] or */
212  /* PH_REALISTIC_NUM_EV_FRAMES */
213  /* */
214  /* FOR frame equals max_EV_frames to */
215  /* (PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT - 1) */
216  /* Set SC_PIXEL_QUALITY_DATA_t.EV_pix_qual[frame][0] to SC_FILL_VALUE */
217  /* Set SC_PIXEL_QUALITY_DATA_t.EV_pix_qual[frame][1] to SC_FILL_VALUE */
218  /* ENDFOR */
219  /* */
220  /*************************************************************************/
221 
222  max_EV_frames = MAX(scan_meta->frame_count_array[MD_EV_FRAMES_IN_SCAN],
224 
225  for (frame = max_EV_frames;
227  frame++) {
228  scan_pixel->EV_pix_qual[frame][0] = SC_FILL_VALUE;
229  scan_pixel->EV_pix_qual[frame][1] = SC_FILL_VALUE;
230  }
231 
232  } /* End of routine finalize_pixel_qual_data */
233 
234 
#define MAX(A, B)
Definition: swl0_utils.h:26
#define MD_BB_FRAMES_IN_SCAN
Definition: MD_metadata.h:138
#define MD_EV_FRAMES_IN_SCAN
Definition: MD_metadata.h:135
#define PH_REALISTIC_NUM_SRCA_FRAMES
Definition: PH_pkt_hdr.h:91
int16 EV_pix_qual[PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT][PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP]
Definition: SC_scan.h:265
int16 SV_pix_qual[PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX][PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP]
Definition: SC_scan.h:263
void finalize_pixel_qual_data(SC_PIXEL_QUALITY_DATA_t *scan_pixel, MD_SCAN_MET_t *scan_meta)
#define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT
Definition: PH_pkt_hdr.h:195
#define PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX
Definition: PH_pkt_hdr.h:216
#define PH_REALISTIC_NUM_SV_FRAMES
Definition: PH_pkt_hdr.h:93
#define MD_SD_FRAMES_IN_SCAN
Definition: MD_metadata.h:136
#define SC_FILL_VALUE
Definition: SC_scan.h:141
#define MD_SV_FRAMES_IN_SCAN
Definition: MD_metadata.h:139
int16 frame_count_array[6]
Definition: MD_metadata.h:219
#define PH_REALISTIC_NUM_SD_FRAMES
Definition: PH_pkt_hdr.h:90
int16 SRCA_pix_qual[PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX][PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP]
Definition: SC_scan.h:259
int16 SD_pix_qual[PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX][PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP]
Definition: SC_scan.h:257
#define MD_SRCA_FRAMES_IN_SCAN
Definition: MD_metadata.h:137
#define PH_REALISTIC_NUM_BB_FRAMES
Definition: PH_pkt_hdr.h:92
#define PH_REALISTIC_NUM_EV_FRAMES
Definition: PH_pkt_hdr.h:94
int16 BB_pix_qual[PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX][PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP]
Definition: SC_scan.h:261