OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
initialize_scan_data.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "SC_scan.h"
3 
5 
6 /*****************************************************************************
7 !C
8 
9 !Description: This function fills the Scan Data structure (section 4 of
10  the MODIS Level 1A Data Product Format) with the appropriate
11  fill data (-1).
12 
13 !Input Parameters: None
14 
15 !Output Parameters:
16  SC_SCAN_DATA_t *L1A_scan The Scan Data structure
17 
18 Return Values: None
19 
20 Externally Defined:
21  PD_E1P2_NUM_EARTH_ENCODER_TIMES (PD_pkt_data.h)
22  PD_E1P1_NUM_FPA_DCR_OFFSETS (PD_pkt_data.h)
23  PD_E1P2_NUM_VIEW_SECTOR_ACTUALS (PD_pkt_data.h)
24  PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS (PD_pkt_data.h)
25  PD_E2P1_NUM_HK_TELEM_BYTES (PD_pkt_data.h)
26  PD_E2P1_NUM_PARAM_BYTES (PD_pkt_data.h)
27  PD_E2P1_NUM_SC_ANCIL_WORDS (PD_pkt_data.h)
28  PD_E2P2_NUM_PV_GAINS (PD_pkt_data.h)
29  PD_DN_BAND_RATIO_250M (PD_pkt_data.h)
30  PD_DN_BAND_RATIO_500M (PD_pkt_data.h)
31  PD_DN_BAND_RATIO_1KM (PD_pkt_data.h)
32  PD_DN_NUM_1KMDAY_BANDS (PD_pkt_data.h)
33  PD_DN_NUM_1KMDAY_DETECTORS (PD_pkt_data.h)
34  PD_DN_NUM_1KMNIGHT_BANDS (PD_pkt_data.h)
35  PD_DN_NUM_1KMNIGHT_DETECTORS (PD_pkt_data.h)
36  PD_DN_NUM_250M_BANDS (PD_pkt_data.h)
37  PD_DN_NUM_250M_DETECTORS (PD_pkt_data.h)
38  PD_DN_NUM_500M_BANDS (PD_pkt_data.h)
39  PD_DN_NUM_500M_DETECTORS (PD_pkt_data.h)
40  PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS (PH_pkt_hdr.h)
41  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX (PD_pkt_hdr.h)
42  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT (PH_pkt_hdr.h)
43  SC_FILL_VALUE (SC_scan.h)
44  SC_NUM_SCI_ENG_BYTES_IN_SDS (SC_scan.h)
45  SC_SCAN_DATA_t (SC_scan.h)
46 
47 Called By: initialize_scan
48 
49 Routines Called: None
50 
51 !Revision History:
52  $Log: initialize_scan_data.c,v $
53  Revision 4.1 2003/03/07 15:55:05 vlin
54  Updated after code walkthrough
55 
56  Revision 4.0 2002/12/02 15:14:05 vlin
57  called memcmp before using memset
58  vlin@saicmodis.com
59 
60  Revision 2.2 1997/09/08 18:00 EDT
61  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
62  Originated Code.
63 
64 !Team-unique Header:
65 
66  This software is developed by the MODIS Science Data Support Team
67  for the National Aeronautics and Space Administration,
68  Goddard Space Flight Center, under contract NAS5-32373.
69 
70 References and Credits: None
71 
72 Design Notes: The CODE below was developed in C language.
73 
74 !END
75 **************************************************************************/
76 
77 {
78  int i, j, k;
79 
80  L1A_scan->science_state = SC_FILL_VALUE;
81  L1A_scan->science_abnormal = SC_FILL_VALUE;
82  L1A_scan->fpa_aem_config[0] = SC_FILL_VALUE;
83  memset(L1A_scan->fpa_aem_config+1, SC_FILL_VALUE,
84  sizeof(L1A_scan->fpa_aem_config[0]));
85 
86  if (memcmp(L1A_scan->fpa_aem_config, L1A_scan->fpa_aem_config+1,
87  sizeof(L1A_scan->fpa_aem_config[0]))) { /* memset didn't work */
89  L1A_scan->fpa_aem_config[i] = SC_FILL_VALUE;
91  L1A_scan->fpa_dcr_offset[i] = SC_FILL_VALUE;
93  L1A_scan->raw_mir_enc[i] = SC_FILL_VALUE;
95  L1A_scan->raw_vs_def[i] = SC_FILL_VALUE;
97  L1A_scan->raw_vs_act[i] = SC_FILL_VALUE;
99  L1A_scan->raw_sci_eng[i] = SC_FILL_VALUE;
101  L1A_scan->raw_hk_telem[i] = SC_FILL_VALUE;
103  L1A_scan->raw_sc_ancil[i] = SC_FILL_VALUE;
105  L1A_scan->raw_param[i] = SC_FILL_VALUE;
106  for (i=0; i<PD_E2P2_NUM_PV_GAINS; i++)
107  L1A_scan->raw_pv_gains[i] = SC_FILL_VALUE;
108 
110  for (j=0;j<PD_DN_NUM_250M_BANDS;j++)
112  L1A_scan->SD_250m[i][j][k] = SC_FILL_VALUE;
113  L1A_scan->SRCA_250m[i][j][k] = SC_FILL_VALUE;
114  L1A_scan->BB_250m[i][j][k] = SC_FILL_VALUE;
115  L1A_scan->SV_250m[i][j][k] = SC_FILL_VALUE;
116  }
117 
118  for (i=0;i<PD_DN_NUM_250M_DETECTORS;i++)
119  for (j=0;j<PD_DN_NUM_250M_BANDS;j++)
121  L1A_scan->EV_250m[i][j][k] = SC_FILL_VALUE;
122 
124  for (j=0;j<PD_DN_NUM_500M_BANDS;j++)
126  L1A_scan->SD_500m[i][j][k] = SC_FILL_VALUE;
127  L1A_scan->SRCA_500m[i][j][k] = SC_FILL_VALUE;
128  L1A_scan->BB_500m[i][j][k] = SC_FILL_VALUE;
129  L1A_scan->SV_500m[i][j][k] = SC_FILL_VALUE;
130  }
131 
132  for (i=0;i<PD_DN_NUM_500M_DETECTORS;i++)
133  for (j=0;j<PD_DN_NUM_500M_BANDS;j++)
135  L1A_scan->EV_500m[i][j][k] = SC_FILL_VALUE;
136 
138  for (j=0;j<PD_DN_NUM_1KMDAY_BANDS;j++)
140  L1A_scan->SD_1km_day[i][j][k] = SC_FILL_VALUE;
141  L1A_scan->SRCA_1km_day[i][j][k] = SC_FILL_VALUE;
142  L1A_scan->BB_1km_day[i][j][k] = SC_FILL_VALUE;
143  L1A_scan->SV_1km_day[i][j][k] = SC_FILL_VALUE;
144  }
145 
146  for (i=0;i<PD_DN_NUM_1KMDAY_DETECTORS;i++)
147  for (j=0;j<PD_DN_NUM_1KMDAY_BANDS;j++)
149  L1A_scan->EV_1km_day[i][j][k] = SC_FILL_VALUE;
150 
152  for (j=0;j<PD_DN_NUM_1KMNIGHT_BANDS;j++)
154  L1A_scan->SD_1km_night[i][j][k] = SC_FILL_VALUE;
155  L1A_scan->SRCA_1km_night[i][j][k] = SC_FILL_VALUE;
156  L1A_scan->BB_1km_night[i][j][k] = SC_FILL_VALUE;
157  L1A_scan->SV_1km_night[i][j][k] = SC_FILL_VALUE;
158  }
159 
161  for (j=0;j<PD_DN_NUM_1KMNIGHT_BANDS;j++)
163  L1A_scan->EV_1km_night[i][j][k] = SC_FILL_VALUE;
164  }
165  else {
166  memset(L1A_scan->SD_250m, SC_FILL_VALUE, sizeof(L1A_scan->SD_250m));
167  memset(L1A_scan->SD_500m, SC_FILL_VALUE, sizeof(L1A_scan->SD_500m));
168  memset(L1A_scan->SD_1km_day, SC_FILL_VALUE, sizeof(L1A_scan->SD_1km_day));
169  memset(L1A_scan->SD_1km_night, SC_FILL_VALUE,
170  sizeof(L1A_scan->SD_1km_night));
171  memset(L1A_scan->SRCA_250m, SC_FILL_VALUE, sizeof(L1A_scan->SRCA_250m));
172  memset(L1A_scan->SRCA_500m, SC_FILL_VALUE, sizeof(L1A_scan->SRCA_500m));
173  memset(L1A_scan->SRCA_1km_day, SC_FILL_VALUE,
174  sizeof(L1A_scan->SRCA_1km_day));
175  memset(L1A_scan->SRCA_1km_night, SC_FILL_VALUE,
176  sizeof(L1A_scan->SRCA_1km_night));
177  memset(L1A_scan->BB_250m, SC_FILL_VALUE, sizeof(L1A_scan->BB_250m));
178  memset(L1A_scan->BB_500m, SC_FILL_VALUE, sizeof(L1A_scan->BB_500m));
179  memset(L1A_scan->BB_1km_day, SC_FILL_VALUE, sizeof(L1A_scan->BB_1km_day));
180  memset(L1A_scan->BB_1km_night, SC_FILL_VALUE,
181  sizeof(L1A_scan->BB_1km_night));
182  memset(L1A_scan->SV_250m, SC_FILL_VALUE, sizeof(L1A_scan->SV_250m));
183  memset(L1A_scan->SV_500m, SC_FILL_VALUE, sizeof(L1A_scan->SV_500m));
184  memset(L1A_scan->SV_1km_day, SC_FILL_VALUE, sizeof(L1A_scan->SV_1km_day));
185  memset(L1A_scan->SV_1km_night, SC_FILL_VALUE,
186  sizeof(L1A_scan->SV_1km_night));
187  memset(L1A_scan->EV_250m, SC_FILL_VALUE, sizeof(L1A_scan->EV_250m));
188  memset(L1A_scan->EV_500m, SC_FILL_VALUE, sizeof(L1A_scan->EV_500m));
189  memset(L1A_scan->EV_1km_day, SC_FILL_VALUE, sizeof(L1A_scan->EV_1km_day));
190  memset(L1A_scan->EV_1km_night, SC_FILL_VALUE,
191  sizeof(L1A_scan->EV_1km_night));
192  memset(L1A_scan->fpa_aem_config+2, SC_FILL_VALUE,
193  sizeof(L1A_scan->fpa_aem_config)-2*sizeof(L1A_scan->fpa_aem_config[0]));
194  memset(L1A_scan->fpa_dcr_offset, SC_FILL_VALUE,
195  sizeof(L1A_scan->fpa_dcr_offset));
196  memset(L1A_scan->raw_mir_enc, SC_FILL_VALUE,
197  sizeof(L1A_scan->raw_mir_enc));
198  memset(L1A_scan->raw_vs_def, SC_FILL_VALUE, sizeof(L1A_scan->raw_vs_def));
199  memset(L1A_scan->raw_vs_act, SC_FILL_VALUE, sizeof(L1A_scan->raw_vs_act));
200  memset(L1A_scan->raw_sci_eng, SC_FILL_VALUE,
201  sizeof(L1A_scan->raw_sci_eng));
202  memset(L1A_scan->raw_hk_telem, SC_FILL_VALUE,
203  sizeof(L1A_scan->raw_hk_telem));
204  memset(L1A_scan->raw_sc_ancil, SC_FILL_VALUE,
205  sizeof(L1A_scan->raw_sc_ancil));
206  memset(L1A_scan->raw_param, SC_FILL_VALUE,
207  sizeof(L1A_scan->raw_param));
208  memset(L1A_scan->raw_pv_gains, SC_FILL_VALUE,
209  sizeof(L1A_scan->raw_pv_gains));
210  }
211 }
#define PD_DN_NUM_500M_BANDS
Definition: PD_pkt_data.h:97
#define PD_DN_NUM_1KMDAY_BANDS
Definition: PD_pkt_data.h:106
SC_CAL_1KM_NIGHT SRCA_1km_night
Definition: SC_scan.h:216
int j
Definition: decode_rs.h:73
#define PD_DN_NUM_250M_BANDS
Definition: PD_pkt_data.h:90
#define PD_DN_BAND_RATIO_500M
Definition: PD_pkt_data.h:96
int8 fpa_aem_config[PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS]
Definition: SC_scan.h:238
#define PD_E2P1_NUM_SC_ANCIL_WORDS
Definition: PD_pkt_data.h:152
#define PD_DN_NUM_250M_DETECTORS
Definition: PD_pkt_data.h:91
int16 raw_vs_act[PD_E1P2_NUM_VIEW_SECTOR_ACTUALS]
Definition: SC_scan.h:244
#define PD_E1P1_NUM_FPA_DCR_OFFSETS
Definition: PD_pkt_data.h:125
SC_CAL_500M SRCA_500m
Definition: SC_scan.h:214
#define PD_DN_NUM_500M_DETECTORS
Definition: PD_pkt_data.h:98
#define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT
Definition: PH_pkt_hdr.h:195
#define PD_DN_NUM_1KMNIGHT_DETECTORS
Definition: PD_pkt_data.h:109
#define PD_E2P1_NUM_PARAM_BYTES
Definition: PD_pkt_data.h:154
int16 raw_vs_def[PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS]
Definition: SC_scan.h:243
#define PD_DN_NUM_1KMNIGHT_BANDS
Definition: PD_pkt_data.h:108
SC_CAL_1KM_DAY SD_1km_day
Definition: SC_scan.h:209
#define PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX
Definition: PH_pkt_hdr.h:216
SC_CAL_1KM_NIGHT SV_1km_night
Definition: SC_scan.h:228
#define SC_NUM_SCI_ENG_BYTES_IN_SDS
Definition: SC_scan.h:146
SC_EV_500M EV_500m
Definition: SC_scan.h:232
int8 raw_pv_gains[PD_E2P2_NUM_PV_GAINS]
Definition: SC_scan.h:249
#define PD_E1P2_NUM_VIEW_SECTOR_DEFINITIONS
Definition: PD_pkt_data.h:136
int8 science_abnormal
Definition: SC_scan.h:240
#define PD_E1P2_NUM_EARTH_ENCODER_TIMES
Definition: PD_pkt_data.h:134
int8 raw_hk_telem[PD_E2P1_NUM_HK_TELEM_BYTES]
Definition: SC_scan.h:246
SC_CAL_1KM_NIGHT SD_1km_night
Definition: SC_scan.h:210
SC_EV_1KM_DAY EV_1km_day
Definition: SC_scan.h:233
#define PD_DN_NUM_1KMDAY_DETECTORS
Definition: PD_pkt_data.h:107
#define SC_FILL_VALUE
Definition: SC_scan.h:141
void initialize_scan_data(SC_SCAN_DATA_t *L1A_scan)
#define PD_DN_BAND_RATIO_250M
Definition: PD_pkt_data.h:89
SC_CAL_1KM_NIGHT BB_1km_night
Definition: SC_scan.h:222
#define PD_E1P2_NUM_VIEW_SECTOR_ACTUALS
Definition: PD_pkt_data.h:138
SC_CAL_1KM_DAY BB_1km_day
Definition: SC_scan.h:221
SC_CAL_250M SD_250m
Definition: SC_scan.h:207
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
SC_CAL_250M SRCA_250m
Definition: SC_scan.h:213
SC_CAL_1KM_DAY SV_1km_day
Definition: SC_scan.h:227
int8 fpa_dcr_offset[PD_E1P1_NUM_FPA_DCR_OFFSETS]
Definition: SC_scan.h:241
SC_CAL_500M SV_500m
Definition: SC_scan.h:226
int8 science_state
Definition: SC_scan.h:239
SC_CAL_1KM_DAY SRCA_1km_day
Definition: SC_scan.h:215
int8 raw_sci_eng[SC_NUM_SCI_ENG_BYTES_IN_SDS]
Definition: SC_scan.h:245
#define PD_E2P2_NUM_PV_GAINS
Definition: PD_pkt_data.h:163
#define PD_E2P1_NUM_HK_TELEM_BYTES
Definition: PD_pkt_data.h:149
#define PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS
Definition: PH_pkt_hdr.h:221
SC_CAL_500M SD_500m
Definition: SC_scan.h:208
for(i=0;i< NROOTS;i++) s[i]
Definition: decode_rs.h:85
#define PD_DN_BAND_RATIO_1KM
Definition: PD_pkt_data.h:105
SC_CAL_500M BB_500m
Definition: SC_scan.h:220
SC_CAL_250M BB_250m
Definition: SC_scan.h:219
SC_EV_1KM_NIGHT EV_1km_night
Definition: SC_scan.h:234
SC_CAL_250M SV_250m
Definition: SC_scan.h:225
SC_EV_250M EV_250m
Definition: SC_scan.h:231
int i
Definition: decode_rs.h:71
int k
Definition: decode_rs.h:73
int16 raw_mir_enc[PD_E1P2_NUM_EARTH_ENCODER_TIMES]
Definition: SC_scan.h:242