OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
write_scan_data.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "mapi.h"
3 #include "PGS_MODIS_35005.h"
4 #include "SC_scan.h"
5 #include "MD_metadata.h"
6 #include "PD_pkt_data.h"
7 #include "PH_pkt_hdr.h"
8 #include "mapiL1A.h"
9 #include "PGS_SMF.h"
10 
11 PGSt_SMF_status write_scan_data (MODFILE *L1A_file_ptr,
12  SC_SCAN_DATA_t *L1A_scan,
13  int16 scan_num,
14  char *scan_type)
15 
16 /*
17 !C**********************************************************************
18 
19 !Description: This function will write out the Scan Data (section 4 of the
20  MODIS Level 1A Data Product Format) to the L1A file.
21 
22 !Input Parameters:
23  MODFILE *L1A_file_ptr ** A pointer to the L1A file **
24  SC_SCAN_DATA_t *L1A_scan ** L1A scan data for this scan **
25  int16 scan_num ** scan number **
26  char *scan_type ** scan type **
27 
28 !Output Parameters:
29  None
30 
31 Return Values: MODIS_S_SUCCESS (PGS_MODIS_35005.h)
32  MODIS_E_ARRAY_OUTPUT_ERR (PGS_MODIS_35005.h)
33 
34 Externally Defined:
35  PGSt_SMF_status (PGS_SMF.h)
36  SC_SCAN_DATA_t (SC_scan.h)
37  MODFILE (mapi.h)
38  M01SD_250M (mapiL1A.h)
39  M01SD_500M (mapiL1A.h)
40  M01SD_1M_DAY (mapiL1A.h)
41  M01SD_1M_NITE (mapiL1A.h)
42  M01SRCA_250M (mapiL1A.h)
43  M01SRCA_500M (mapiL1A.h)
44  M01SRCA_1M_DAY (mapiL1A.h)
45  M01SRCA_1M_NITE (mapiL1A.h)
46  M01BB_250M (mapiL1A.h)
47  M01BB_500M (mapiL1A.h)
48  M01BB_1M_DAY (mapiL1A.h)
49  M01BB_1M_NITE (mapiL1A.h)
50  M01SV_250M (mapiL1A.h)
51  M01SV_500M (mapiL1A.h)
52  M01SV_1M_DAY (mapiL1A.h)
53  M01SV_1M_NITE (mapiL1A.h)
54  M01EV_250M (mapiL1A.h)
55  M01EV_500M (mapiL1A.h)
56  M01EV_1M_DAY (mapiL1A.h)
57  M01EV_1M_NITE (mapiL1A.h)
58  M01FPA_AEM_CONFIG (mapiL1A.h)
59  M01SCIENCE_STATE (mapiL1A.h)
60  M01SCIENCE_ABNORM (mapiL1A.h)
61  M01FPA_DCR_OFFSET (mapiL1A.h)
62  M01RAW_MIR_ENC (mapiL1A.h)
63  M01RAW_VS_DEF (mapiL1A.h)
64  M01RAW_VS_ACT (mapiL1A.h)
65  M01RAW_SCI_ENG (mapiL1A.h)
66  M01RAW_HK_TELEM (mapiL1A.h)
67  M01RAW_SC_ANCIL (mapiL1A.h)
68  M01RAW_PARAM (mapiL1A.h)
69  M01RAW_PV_GAINS (mapiL1A.h)
70  PD_DN_NUM_250M_DETECTORS (PD_pkt_data.h)
71  PD_DN_NUM_250M_BANDS (PD_pkt_data.h)
72  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX (PH_pkt_hdr.h)
73  PD_DN_BAND_RATIO_250M (PD_pkt_data.h)
74  PD_DN_NUM_500M_DETECTORS (PD_pkt_data.h)
75  PD_DN_NUM_500M_BANDS (PD_pkt_data.h)
76  PD_DN_BAND_RATIO_500M (PD_pkt_data.h)
77  PD_DN_NUM_1KMDAY_DETECTORS (PD_pkt_data.h)
78  PD_DN_NUM_1KMDAY_BANDS (PD_pkt_data.h)
79  PD_DN_BAND_RATIO_1KM (PD_pkt_data.h)
80  PD_DN_NUM_1KMNIGHT_DETECTORS (PD_pkt_data.h)
81  PD_DN_NUM_1KMNIGHT_BANDS (PD_pkt_data.h)
82  PD_DN_BAND_RATIO_1KM (PD_pkt_data.h)
83 
84 Called By:
85  write_scan
86 
87 Routines Called:
88  putMODISarray
89  log_fmt_msg
90 
91 !Revision History:
92  revision 1.0 1997/09/03 17:30:00
93  Qi Huang/RDC (qhuang@ltpmail.gsfc.nasa.gov)
94  Original development
95 
96 !Team-unique Header:
97  This software is developed by the MODIS Science
98  Data Support Team (SDST) for the National Aeronautics
99  and Space Administration (NASA), Goddard Space Flight
100  Center (GSFC), under contract NAS5-32373.
101 
102 !References and Credits:
103  None
104 
105 !Design Notes:
106  None
107 
108 !END***************************************************************************
109 */
110 {
111  /*************************************************************************/
112  /* */
113  /* Define and Initialize Local Variables */
114  /* */
115  /*************************************************************************/
116 
117  char *routine = "write_scan_data";
118  char msg[300];
119  PGSt_SMF_status returnStatus;
120  long int start[3] = {0, 0, 0};
121  long int start_250[3] = {0, 0, 0};
122  long int start_500[3] = {0, 0, 0};
123  long int start_day[3] = {0, 0, 0};
124  long int start_night[3] = {0, 0, 0};
125  long int dimsize[3];
126  long int dimsize_cal_250[3] = {PD_DN_NUM_250M_DETECTORS,
130  long int dimsize_cal_500[3] = {PD_DN_NUM_500M_DETECTORS,
134  long int dimsize_cal_day[3] = {PD_DN_NUM_1KMDAY_DETECTORS,
138  long int dimsize_cal_night[3] = {PD_DN_NUM_1KMNIGHT_DETECTORS,
142 
143 
144  start[0] = scan_num - 1;
145  start_250[0] = (scan_num - 1) * PD_DN_NUM_250M_DETECTORS;
146  start_500[0] = (scan_num - 1) * PD_DN_NUM_500M_DETECTORS;
147  start_day[0] = (scan_num - 1) * PD_DN_NUM_1KMDAY_DETECTORS;
148  start_night[0] = (scan_num - 1) * PD_DN_NUM_1KMNIGHT_DETECTORS;
149 
150  /*****************************************************************************/
151  /* */
152  /* set returnStatus to MODIS_S_SUCCESS */
153  /* */
154  /*****************************************************************************/
155 
156  returnStatus = MODIS_S_SUCCESS;
157 
158 
159  /*****************************************************************************/
160  /* */
161  /* Compute dimsize array for the SD 250m data */
162  /* Compute the start for the SD 250m data */
163  /* CALL putMODISarray to write the SD 250m data to the L1A granule */
164  /* INPUTS: MODFILE, M01SD_250M, NULL, start, dimsize array, */
165  /* SC_SCAN_DATA_t.SD_250m */
166  /* OUTPUT: None */
167  /* RETURN: mapiStatus */
168  /* */
169  /* IF mapiStatus equals MFAIL */
170  /* THEN */
171  /* set routine to "write_scan_data" */
172  /* set msg to "The SD 250m data could not be written to the L1A granule" */
173  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
174  /* CALL log_fmt_msg to report that the SD 250m data could not be */
175  /* written to the L1A granule */
176  /* INPUTS: returnStatus, routine, msg */
177  /* OUTPUT: None */
178  /* RETURN: None */
179  /* ENDIF */
180  /* */
181  /*****************************************************************************/
182 
183  if (putMODISarray(L1A_file_ptr,M01SD_250M,NULL,start_250,dimsize_cal_250,
184  L1A_scan->SD_250m) == MFAIL)
185  {
186  sprintf(msg,"The SD 250m data could not be written to the L1A granule %s",
187  L1A_file_ptr->filename);
188  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
190  }
191 
192 
193  /*****************************************************************************/
194  /* */
195  /* Compute dimsize array for the SD 500m data */
196  /* Compute the start for the SD 500m data */
197  /* CALL putMODISarray to write the SD 500m data to the L1A granule */
198  /* INPUTS: MODFILE, M01SD_500M, NULL, start, dimsize array, */
199  /* SC_SCAN_DATA_t.SD_500m */
200  /* OUTPUT: None */
201  /* RETURN: mapiStatus */
202  /* */
203  /* IF mapiStatus equals MFAIL */
204  /* THEN */
205  /* set routine to "write_scan_data" */
206  /* set msg to "The SD 500m data could not be written to the L1A granule" */
207  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
208  /* CALL log_fmt_msg to report that the SD 500m data could not be */
209  /* written to the L1A granule */
210  /* INPUTS: returnStatus, routine, msg */
211  /* OUTPUT: None */
212  /* RETURN: None */
213  /* ENDIF */
214  /* */
215  /*****************************************************************************/
216 
217  if (putMODISarray(L1A_file_ptr,M01SD_500M,NULL,start_500,dimsize_cal_500,
218  L1A_scan->SD_500m) == MFAIL)
219  {
220  sprintf(msg,"The SD 500m data could not be written to the L1A granule %s",
221  L1A_file_ptr->filename);
222  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
224  }
225 
226 
227  /*****************************************************************************/
228  /* */
229  /* Compute dimsize array for the SD 1km day data */
230  /* Compute the start for the SD 1km day data */
231  /* CALL putMODISarray to write the SD 1km day data to the L1A granule */
232  /* INPUTS: MODFILE, M01SD_1M_DAY, NULL, start, dimsize array, */
233  /* SC_SCAN_DATA_t.SD_1km_day */
234  /* OUTPUT: None */
235  /* RETURN: mapiStatus */
236  /* */
237  /* IF mapiStatus equals MFAIL */
238  /* THEN */
239  /* set routine to "write_scan_data" */
240  /* set msg to "The SD 1km day data could not be written to the L1A */
241  /* granule" */
242  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
243  /* CALL log_fmt_msg to report that the SD 1km day data could not be */
244  /* written to the L1A granule */
245  /* INPUTS: returnStatus, routine, msg */
246  /* OUTPUT: None */
247  /* RETURN: None */
248  /* ENDIF */
249  /* */
250  /*****************************************************************************/
251 
252  if (putMODISarray(L1A_file_ptr,M01SD_1KM_DAY,NULL,start_day,dimsize_cal_day,
253  L1A_scan->SD_1km_day) == MFAIL)
254  {
255  sprintf(msg,"The SD 1km day data could not be written to the L1A granule %s",
256  L1A_file_ptr->filename);
257  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
259  }
260 
261 
262  /*****************************************************************************/
263  /* */
264  /* Compute dimsize array for the SD 1km night data */
265  /* Compute the start for the SD 1km night data */
266  /* CALL putMODISarray to write the SD 1km night data to the L1A granule */
267  /* INPUTS: MODFILE, M01SD_1M_NITE, NULL, start, dimsize array, */
268  /* SC_SCAN_DATA_t.SD_1km_night */
269  /* OUTPUT: None */
270  /* RETURN: mapiStatus */
271  /* */
272  /* IF mapiStatus equals MFAIL */
273  /* THEN */
274  /* set routine to "write_scan_data" */
275  /* set msg to "The SD 1km night data could not be written to the L1A */
276  /* granule" */
277  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
278  /* CALL log_fmt_msg to report that the SD 1km night data could not be */
279  /* written to the L1A granule */
280  /* INPUTS: returnStatus, routine, msg */
281  /* OUTPUT: None */
282  /* RETURN: None */
283  /* ENDIF */
284  /* */
285  /*****************************************************************************/
286 
287  if (putMODISarray(L1A_file_ptr,M01SD_1KM_NITE,NULL,start_night,dimsize_cal_night,
288  L1A_scan->SD_1km_night) == MFAIL)
289  {
290  sprintf(msg,"The SD 1km_night data could not be written to the L1A granule %s",
291  L1A_file_ptr->filename);
292  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
294  }
295 
296 
297  /*****************************************************************************/
298  /* */
299  /* Compute dimsize array for the SRCA 250m data */
300  /* Compute the start for the SRCA 250m data */
301  /* CALL putMODISarray to write the SRCA 250m data to the L1A granule */
302  /* INPUTS: MODFILE, M01SRCA_250M, NULL, start, dimsize array, */
303  /* SC_SCAN_DATA_t.SRCA_250m */
304  /* OUTPUT: None */
305  /* RETURN: mapiStatus */
306  /* */
307  /* IF mapiStatus equals MFAIL */
308  /* THEN */
309  /* set routine to "write_scan_data" */
310  /* set msg to "The SRCA 250m data could not be written to the L1A */
311  /* granule" */
312  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
313  /* CALL log_fmt_msg to report that the SRCA 250m data could not be */
314  /* written to the L1A granule */
315  /* INPUTS: returnStatus, routine, msg */
316  /* OUTPUT: None */
317  /* RETURN: None */
318  /* ENDIF */
319  /* */
320  /*****************************************************************************/
321 
322  if (putMODISarray(L1A_file_ptr,M01SRCA_250M,NULL,start_250,dimsize_cal_250,
323  L1A_scan->SRCA_250m) == MFAIL)
324  {
325  sprintf(msg,"The SRCA 250m data could not be written to the L1A granule %s",
326  L1A_file_ptr->filename);
327  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
329  }
330 
331 
332  /*****************************************************************************/
333  /* */
334  /* Compute dimsize array for the SRCA 500m data */
335  /* Compute the start for the SRCA 500m data */
336  /* CALL putMODISarray to write the SRCA 500m data to the L1A granule */
337  /* INPUTS: MODFILE, M01SRCA_500M, NULL, start, dimsize array, */
338  /* SC_SCAN_DATA_t.SRCA_500m */
339  /* OUTPUT: None */
340  /* RETURN: mapiStatus */
341  /* */
342  /* IF mapiStatus equals MFAIL */
343  /* THEN */
344  /* set routine to "write_scan_data" */
345  /* set msg to "The SRCA 500m data could not be written to the L1A */
346  /* granule" */
347  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
348  /* CALL log_fmt_msg to report that the SRCA 500m data could not be */
349  /* written to the L1A granule */
350  /* INPUTS: returnStatus, routine, msg */
351  /* OUTPUT: None */
352  /* RETURN: None */
353  /* ENDIF */
354  /* */
355  /*****************************************************************************/
356 
357  if (putMODISarray(L1A_file_ptr,M01SRCA_500M,NULL,start_500,dimsize_cal_500,
358  L1A_scan->SRCA_500m) == MFAIL)
359  {
360  sprintf(msg,"The SRCA 500m data could not be written to the L1A granule %s",
361  L1A_file_ptr->filename);
362  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
364  }
365 
366 
367  /*****************************************************************************/
368  /* */
369  /* Compute dimsize array for the SRCA 1km day data */
370  /* Compute the start for the SRCA 1km day data */
371  /* CALL putMODISarray to write the SRCA 1km day data to the L1A granule */
372  /* INPUTS: MODFILE, M01SRCA_1M_DAY, NULL, start, dimsize array, */
373  /* SC_SCAN_DATA_t.SRCA_1km_day */
374  /* OUTPUT: None */
375  /* RETURN: mapiStatus */
376  /* */
377  /* IF mapiStatus equals MFAIL */
378  /* THEN */
379  /* set routine to "write_scan_data" */
380  /* set msg to "The SRCA 1km day data could not be written to the L1A */
381  /* granule" */
382  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
383  /* CALL log_fmt_msg to report that the SRCA 1km day data could not be */
384  /* written to the L1A granule */
385  /* INPUTS: returnStatus, routine, msg */
386  /* OUTPUT: None */
387  /* RETURN: None */
388  /* ENDIF */
389  /* */
390  /*****************************************************************************/
391 
392  if (putMODISarray(L1A_file_ptr,M01SRCA_1KM_DAY,NULL,start_day,dimsize_cal_day,
393  L1A_scan->SRCA_1km_day) == MFAIL)
394  {
395  sprintf(msg,"The SRCA 1km day data could not be written to the L1A granule %s",
396  L1A_file_ptr->filename);
397  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
399  }
400 
401 
402  /*****************************************************************************/
403  /* */
404  /* Compute dimsize array for the SRCA 1km night data */
405  /* Compute the start for the SRCA 1km night data */
406  /* CALL putMODISarray to write the SRCA 1km night data to the L1A granule */
407  /* INPUTS: MODFILE, M01SRCA_1M_NITE, NULL, start, dimsize array, */
408  /* SC_SCAN_DATA_t.SRCA_1km_night */
409  /* OUTPUT: None */
410  /* RETURN: mapiStatus */
411  /* */
412  /* IF mapiStatus equals MFAIL */
413  /* THEN */
414  /* set routine to "write_scan_data" */
415  /* set msg to "The SRCA 1km night data could not be written to the L1A */
416  /* granule" */
417  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
418  /* CALL log_fmt_msg to report that the SRCA 1km night data could not be */
419  /* written to the L1A granule */
420  /* INPUTS: returnStatus, routine, msg */
421  /* OUTPUT: None */
422  /* RETURN: None */
423  /* ENDIF */
424  /* */
425  /*****************************************************************************/
426 
427  if (putMODISarray(L1A_file_ptr,M01SRCA_1KM_NITE,NULL,start_night,dimsize_cal_night,
428  L1A_scan->SRCA_1km_night) == MFAIL)
429  {
430  sprintf(msg,"The SRCA 1km night data could not be written to the L1A granule %s",
431  L1A_file_ptr->filename);
432  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
434  }
435 
436 
437  /*****************************************************************************/
438  /* */
439  /* Compute dimsize array for the BB 250m data */
440  /* Compute the start for the BB 250m data */
441  /* CALL putMODISarray to write the BB 250m data to the L1A granule */
442  /* INPUTS: MODFILE, M01BB_250M, NULL, start, dimsize array, */
443  /* SC_SCAN_DATA_t.BB_250m */
444  /* OUTPUT: None */
445  /* RETURN: mapiStatus */
446  /* */
447  /* IF mapiStatus equals MFAIL */
448  /* THEN */
449  /* set routine to "write_scan_data" */
450  /* set msg to "The BB 250m data could not be written to the L1A granule" */
451  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
452  /* CALL log_fmt_msg to report that the BB 250m data could not be written */
453  /* to the L1A granule */
454  /* INPUTS: returnStatus, routine, msg */
455  /* OUTPUT: None */
456  /* RETURN: None */
457  /* ENDIF */
458  /* */
459  /*****************************************************************************/
460 
461  if (putMODISarray(L1A_file_ptr,M01BB_250M,NULL,start_250,dimsize_cal_250,
462  L1A_scan->BB_250m) == MFAIL)
463  {
464  sprintf(msg,"The BB 250m data could not be written to the L1A granule %s",
465  L1A_file_ptr->filename);
466  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
468  }
469 
470 
471  /*****************************************************************************/
472  /* */
473  /* Compute dimsize array for the BB 500m data */
474  /* Compute the start for the BB 500m data */
475  /* CALL putMODISarray to write the BB 500m data to the L1A granule */
476  /* INPUTS: MODFILE, M01BB_500M, NULL, start, dimsize array, */
477  /* SC_SCAN_DATA_t.BB_500m */
478  /* OUTPUT: None */
479  /* RETURN: mapiStatus */
480  /* */
481  /* IF mapiStatus equals MFAIL */
482  /* THEN */
483  /* set routine to "write_scan_data" */
484  /* set msg to "The BB 500m data could not be written to the L1A granule" */
485  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
486  /* CALL log_fmt_msg to report that the BB 500m data could not be written */
487  /* to the L1A granule */
488  /* INPUTS: returnStatus, routine, msg */
489  /* OUTPUT: None */
490  /* RETURN: None */
491  /* ENDIF */
492  /* */
493  /*****************************************************************************/
494 
495  if (putMODISarray(L1A_file_ptr,M01BB_500M,NULL,start_500,dimsize_cal_500,
496  L1A_scan->BB_500m) == MFAIL)
497  {
498  sprintf(msg,"The BB 500m data could not be written to the L1A granule %s",
499  L1A_file_ptr->filename);
500  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
502  }
503 
504 
505  /*****************************************************************************/
506  /* */
507  /* Compute dimsize array for the BB 1km day data */
508  /* Compute the start for the BB 1km day data */
509  /* CALL putMODISarray to write the BB 1km day data to the L1A granule */
510  /* INPUTS: MODFILE, M01BB_1M_DAY, NULL, start, dimsize array, */
511  /* SC_SCAN_DATA_t.BB_1km_day */
512  /* OUTPUT: None */
513  /* RETURN: mapiStatus */
514  /* */
515  /* IF mapiStatus equals MFAIL */
516  /* THEN */
517  /* set routine to "write_scan_data" */
518  /* set msg to "The BB 1km day data could not be written to the L1A */
519  /* granule" */
520  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
521  /* CALL log_fmt_msg to report that the BB 1km day data could not be */
522  /* written to the L1A granule */
523  /* INPUTS: returnStatus, routine, msg */
524  /* OUTPUT: None */
525  /* RETURN: None */
526  /* ENDIF */
527  /* */
528  /*****************************************************************************/
529 
530  if (putMODISarray(L1A_file_ptr,M01BB_1KM_DAY,NULL,start_day,dimsize_cal_day,
531  L1A_scan->BB_1km_day) == MFAIL)
532  {
533  sprintf(msg,"The BB 1km day data could not be written to the L1A granule %s",
534  L1A_file_ptr->filename);
535  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
537  }
538 
539 
540  /*****************************************************************************/
541  /* */
542  /* Compute dimsize array for the BB 1km night data */
543  /* Compute the start for the BB 1km night data */
544  /* CALL putMODISarray to write the BB 1km night data to the L1A granule */
545  /* INPUTS: MODFILE, M01BB_1M_NITE, NULL, start, dimsize array, */
546  /* SC_SCAN_DATA_t.BB_1km_night */
547  /* OUTPUT: None */
548  /* RETURN: mapiStatus */
549  /* */
550  /* IF mapiStatus equals MFAIL */
551  /* THEN */
552  /* set routine to "write_scan_data" */
553  /* set msg to "The BB 1km night data could not be written to the L1A */
554  /* granule" */
555  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
556  /* CALL log_fmt_msg to report that the BB 1km night data could not be */
557  /* written to the L1A granule */
558  /* INPUTS: returnStatus, routine, msg */
559  /* OUTPUT: None */
560  /* RETURN: None */
561  /* ENDIF */
562  /* */
563  /*****************************************************************************/
564 
565  if (putMODISarray(L1A_file_ptr,M01BB_1KM_NITE,NULL,start_night,dimsize_cal_night,
566  L1A_scan->BB_1km_night) == MFAIL)
567  {
568  sprintf(msg,"The BB 1km night data could not be written to the L1A granule %s",
569  L1A_file_ptr->filename);
570  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
572  }
573 
574 
575  /*****************************************************************************/
576  /* */
577  /* Compute dimsize array for the SV 250m data */
578  /* Compute the start for the SV 250m data */
579  /* CALL putMODISarray to write the SV 250m data to the L1A granule */
580  /* INPUTS: MODFILE, M01SV_250M, NULL, start, dimsize array, */
581  /* SC_SCAN_DATA_t.SV_250m */
582  /* OUTPUT: None */
583  /* RETURN: mapiStatus */
584  /* */
585  /* IF mapiStatus equals MFAIL */
586  /* THEN */
587  /* set routine to "write_scan_data" */
588  /* set msg to "The SV 250m data could not be written to the L1A granule" */
589  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
590  /* CALL log_fmt_msg to report that the SV 250m data could not be written */
591  /* to the L1A granule */
592  /* INPUTS: returnStatus, routine, msg */
593  /* OUTPUT: None */
594  /* RETURN: None */
595  /* ENDIF */
596  /* */
597  /*****************************************************************************/
598 
599  if (putMODISarray(L1A_file_ptr,M01SV_250M,NULL,start_250,dimsize_cal_250,
600  L1A_scan->SV_250m) == MFAIL)
601  {
602  sprintf(msg,"The SV 250m data could not be written to the L1A granule %s",
603  L1A_file_ptr->filename);
604  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
606  }
607 
608 
609  /*****************************************************************************/
610  /* */
611  /* Compute dimsize array for the SV 500m data */
612  /* Compute the start for the SV 500m data */
613  /* CALL putMODISarray to write the SV 500m data to the L1A granule */
614  /* INPUTS: MODFILE, M01SV_500M, NULL, start, dimsize array, */
615  /* SC_SCAN_DATA_t.SV_500m */
616  /* OUTPUT: None */
617  /* RETURN: mapiStatus */
618  /* */
619  /* IF mapiStatus equals MFAIL */
620  /* THEN */
621  /* set routine to "write_scan_data" */
622  /* set msg to "The SV 500m data could not be written to the L1A granule" */
623  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
624  /* CALL log_fmt_msg to report that the SV 500m data could not be written */
625  /* to the L1A granule */
626  /* INPUTS: returnStatus, routine, msg */
627  /* OUTPUT: None */
628  /* RETURN: None */
629  /* ENDIF */
630  /* */
631  /*****************************************************************************/
632 
633  if (putMODISarray(L1A_file_ptr,M01SV_500M,NULL,start_500,dimsize_cal_500,
634  L1A_scan->SV_500m) == MFAIL)
635  {
636  sprintf(msg,"The SV 500m data could not be written to the L1A granule %s",
637  L1A_file_ptr->filename);
638  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
640  }
641 
642 
643  /*****************************************************************************/
644  /* */
645  /* Compute dimsize array for the SV 1km day data */
646  /* Compute the start for the SV 1km day data */
647  /* CALL putMODISarray to write the SV 1km day data to the L1A granule */
648  /* INPUTS: MODFILE, M01SV_1M_DAY, NULL, start, dimsize array, */
649  /* SC_SCAN_DATA_t.SV_1km_day */
650  /* OUTPUT: None */
651  /* RETURN: mapiStatus */
652  /* */
653  /* IF mapiStatus equals MFAIL */
654  /* THEN */
655  /* set routine to "write_scan_data" */
656  /* set msg to "The SV 1km day data could not be written to the L1A */
657  /* granule" */
658  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
659  /* CALL log_fmt_msg to report that the SV 1km day data could not be */
660  /* written to the L1A granule */
661  /* INPUTS: returnStatus, routine, msg */
662  /* OUTPUT: None */
663  /* RETURN: None */
664  /* ENDIF */
665  /* */
666  /*****************************************************************************/
667 
668  if (putMODISarray(L1A_file_ptr,M01SV_1KM_DAY,NULL,start_day,dimsize_cal_day,
669  L1A_scan->SV_1km_day) == MFAIL)
670  {
671  sprintf(msg,"The SV 1km day data could not be written to the L1A granule %s",
672  L1A_file_ptr->filename);
673  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
675  }
676 
677 
678  /*****************************************************************************/
679  /* */
680  /* Compute dimsize array for the SV 1km night data */
681  /* Compute the start for the SV 1km night data */
682  /* CALL putMODISarray to write the SV 1km night data to the L1A granule */
683  /* INPUTS: MODFILE, M01SV_1M_NITE, NULL, start, dimsize array, */
684  /* SC_SCAN_DATA_t.SV_1km_night */
685  /* OUTPUT: None */
686  /* RETURN: mapiStatus */
687  /* */
688  /* IF mapiStatus equals MFAIL */
689  /* THEN */
690  /* set routine to "write_scan_data" */
691  /* set msg to "The SV 1km night data could not be written to the L1A */
692  /* granule" */
693  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
694  /* CALL log_fmt_msg to report that the SV 1km night data could not be */
695  /* written to the L1A granule */
696  /* INPUTS: returnStatus, routine, msg */
697  /* OUTPUT: None */
698  /* RETURN: None */
699  /* ENDIF */
700  /* */
701  /*****************************************************************************/
702 
703  if (putMODISarray(L1A_file_ptr,M01SV_1KM_NITE,NULL,start_night,dimsize_cal_night,
704  L1A_scan->SV_1km_night) == MFAIL)
705  {
706  sprintf(msg,"The SV 1km night data could not be written to the L1A granule %s",
707  L1A_file_ptr->filename);
708  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
710  }
711 
712 
713  /*****************************************************************************/
714  /* */
715  /* IF scan_type is equal to Day */
716  /* THEN */
717  /* Compute dimsize array for the EV 250m data */
718  /* Compute the start for the EV 250m data */
719  /* CALL putMODISarray to write the EV 250m data to the L1A granule */
720  /* INPUTS: MODFILE, M01EV_250M, NULL, start, dimsize array, */
721  /* SC_SCAN_DATA_t.EV_250m */
722  /* OUTPUT: None */
723  /* RETURN: mapiStatus */
724  /* */
725  /* IF mapiStatus equals MFAIL */
726  /* THEN */
727  /* set routine to "write_scan_data" */
728  /* set msg to "The EV 250m data could not be written to the L1A */
729  /* granule" */
730  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
731  /* CALL log_fmt_msg to report that the EV 250m data could not be */
732  /* written to the L1A granule */
733  /* INPUTS: returnStatus, routine, msg */
734  /* OUTPUT: None */
735  /* RETURN: None */
736  /* ENDIF */
737  /* */
738  /*****************************************************************************/
739 
740  if (strcmp(scan_type,MD_DAY_SCAN) == 0)
741  {
742  dimsize[0] = PD_DN_NUM_250M_DETECTORS;
743  dimsize[1] = PD_DN_NUM_250M_BANDS;
745 
746  if (putMODISarray(L1A_file_ptr, M01EV_250M, NULL, start_250, dimsize,
747  L1A_scan->EV_250m) == MFAIL)
748  {
749  sprintf(msg,"The EV 250m data could not be written to the L1A granule %s",
750  L1A_file_ptr->filename);
751  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
753  }
754 
755 
756  /*****************************************************************************/
757  /* */
758  /* Compute dimsize array for the EV 500m data */
759  /* Compute the start for the EV 500m data */
760  /* CALL putMODISarray to write the EV 500m data to the L1A granule */
761  /* INPUTS: MODFILE, M01EV_500M, NULL, start, dimsize array, */
762  /* SC_SCAN_DATA_t.EV_500m */
763  /* OUTPUT: None */
764  /* RETURN: mapiStatus */
765  /* */
766  /* IF mapiStatus equals MFAIL */
767  /* THEN */
768  /* set routine to "write_scan_data" */
769  /* set msg to "The EV 500m data could not be written to the L1A */
770  /* granule" */
771  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
772  /* CALL log_fmt_msg to report that the EV 500m data could not be */
773  /* written to the L1A granule */
774  /* INPUTS: returnStatus, routine, msg */
775  /* OUTPUT: None */
776  /* RETURN: None */
777  /* ENDIF */
778  /* */
779  /*****************************************************************************/
780 
781  dimsize[0] = PD_DN_NUM_500M_DETECTORS;
782  dimsize[1] = PD_DN_NUM_500M_BANDS;
784 
785  if (putMODISarray(L1A_file_ptr, M01EV_500M, NULL, start_500, dimsize,
786  L1A_scan->EV_500m) == MFAIL)
787  {
788  sprintf(msg,"The EV 500m data could not be written to the L1A granule %s",
789  L1A_file_ptr->filename);
790  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
792  }
793 
794 
795  /*****************************************************************************/
796  /* */
797  /* Compute dimsize array for the EV 1km day data */
798  /* Compute the start for the EV 1km day data */
799  /* CALL putMODISarray to write the EV 1km day data to the L1A granule */
800  /* INPUTS: MODFILE, M01EV_1M_DAY, NULL, start, dimsize array, */
801  /* SC_SCAN_DATA_t.EV_1km_day */
802  /* OUTPUT: None */
803  /* RETURN: mapiStatus */
804  /* */
805  /* IF mapiStatus equals MFAIL */
806  /* THEN */
807  /* set routine to "write_scan_data" */
808  /* set msg to "The EV 1km day data could not be written to the L1A */
809  /* granule" */
810  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
811  /* CALL log_fmt_msg to report that the EV 1km day data could not be */
812  /* written to the L1A granule */
813  /* INPUTS: returnStatus, routine, msg */
814  /* OUTPUT: None */
815  /* RETURN: None */
816  /* ENDIF */
817  /* ENDIF */
818  /* */
819  /*****************************************************************************/
820 
821  dimsize[0] = PD_DN_NUM_1KMDAY_DETECTORS;
822  dimsize[1] = PD_DN_NUM_1KMDAY_BANDS;
824 
825  if (putMODISarray(L1A_file_ptr, M01EV_1KM_DAY, NULL, start_day, dimsize,
826  L1A_scan->EV_1km_day) == MFAIL)
827  {
828  sprintf(msg,"The EV 1km day data could not be written to the L1A granule %s",
829  L1A_file_ptr->filename);
830  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
832  }
833  }
834 
835  /*****************************************************************************/
836  /* */
837  /* Compute dimsize array for the EV 1km night data */
838  /* Compute the start for the EV 1km night data */
839  /* CALL putMODISarray to write the EV 1km night data to the L1A granule */
840  /* INPUTS: MODFILE, M01EV_1M_NITE, NULL, start, dimsize array, */
841  /* SC_SCAN_DATA_t.EV_1km_night */
842  /* OUTPUT: None */
843  /* RETURN: mapiStatus */
844  /* */
845  /* IF mapiStatus equals MFAIL */
846  /* THEN */
847  /* set routine to "write_scan_data" */
848  /* set msg to "The EV 1km night data could not be written to the L1A */
849  /* granule" */
850  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
851  /* CALL log_fmt_msg to report that the EV 1km night data could not be */
852  /* written to the L1A granule */
853  /* INPUTS: returnStatus, routine, msg */
854  /* OUTPUT: None */
855  /* RETURN: None */
856  /* ENDIF */
857  /* */
858  /*****************************************************************************/
859 
860  dimsize[0] = PD_DN_NUM_1KMNIGHT_DETECTORS;
861  dimsize[1] = PD_DN_NUM_1KMNIGHT_BANDS;
863 
864  if (putMODISarray(L1A_file_ptr,M01EV_1KM_NITE,NULL,start_night,dimsize,
865  L1A_scan->EV_1km_night) == MFAIL)
866  {
867  sprintf(msg,"The EV 1km night data could not be written to the L1A granule %s",
868  L1A_file_ptr->filename);
869  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
871  }
872 
873 
874  /*****************************************************************************/
875  /* */
876  /* Compute dimsize array for the FPA/AEM Config data */
877  /* Compute the start for the FPA/AEM Config data */
878  /* CALL putMODISarray to write the FPA/AEM Config data to the L1A granule */
879  /* INPUTS: MODFILE, M01FPA_AEM_CONFIG, NULL, start, dimsize array, */
880  /* SC_SCAN_DATA_t.fpa_aem_config */
881  /* OUTPUT: None */
882  /* RETURN: mapiStatus */
883  /* */
884  /* IF mapiStatus equals MFAIL */
885  /* THEN */
886  /* set routine to "write_scan_data" */
887  /* set msg to "The FPA/AEM Config data could not be written to the L1A */
888  /* granule" */
889  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
890  /* CALL log_fmt_msg to report that the FPA/AEM Config data could not be */
891  /* written to the L1A granule */
892  /* INPUTS: returnStatus, routine, msg */
893  /* OUTPUT: None */
894  /* RETURN: None */
895  /* ENDIF */
896  /* */
897  /*****************************************************************************/
898 
899  dimsize[0] = 1;
901  dimsize[2] = 0;
902 
903  if (putMODISarray(L1A_file_ptr,M01FPA_AEM_CONFIG,NULL,start,dimsize,
904  L1A_scan->fpa_aem_config) == MFAIL)
905  {
906  sprintf(msg,"The FPA/AEM Config data could not be written to the L1A granule %s",
907  L1A_file_ptr->filename);
908  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
910  }
911 
912 
913  /*****************************************************************************/
914  /* */
915  /* Compute dimsize array for the Science State data */
916  /* Compute the start for the Science State data */
917  /* CALL putMODISarray to write the Science State data to the L1A granule */
918  /* INPUTS: MODFILE, M01SCIENCE_STATE, NULL, start, dimsize array, */
919  /* SC_SCAN_DATA_t.science_state */
920  /* OUTPUT: None */
921  /* RETURN: mapiStatus */
922  /* */
923  /* IF mapiStatus equals MFAIL */
924  /* THEN */
925  /* set routine to "write_scan_data" */
926  /* set msg to "The Science State data could not be written to the L1A */
927  /* granule" */
928  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
929  /* CALL log_fmt_msg to report that the Science State data could not be */
930  /* written to the L1A granule */
931  /* INPUTS: returnStatus, routine, msg */
932  /* OUTPUT: None */
933  /* RETURN: None */
934  /* ENDIF */
935  /* */
936  /*****************************************************************************/
937  dimsize[1] = 0;
938 
939  if (putMODISarray(L1A_file_ptr,M01SCIENCE_STATE,NULL,start,dimsize
940  ,&L1A_scan->science_state) == MFAIL)
941  {
942  sprintf(msg,"The Science State data could not be written to the L1A granule %s",
943  L1A_file_ptr->filename);
944  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
946  }
947 
948 
949  /*****************************************************************************/
950  /* */
951  /* Compute dimsize array for the Science Abnorm data */
952  /* Compute the start for the Science Abnorm data */
953  /* CALL putMODISarray to write the Science Abnorm data to the L1A granule */
954  /* INPUTS: MODFILE, M01SCIENCE_ABNORM, NULL, start, dimsize array, */
955  /* SC_SCAN_DATA_t.science_abnorm */
956  /* OUTPUT: None */
957  /* RETURN: mapiStatus */
958  /* */
959  /* IF mapiStatus equals MFAIL */
960  /* THEN */
961  /* set routine to "write_scan_data" */
962  /* set msg to "The Science Abnorm data could not be written to the L1A */
963  /* granule" */
964  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
965  /* CALL log_fmt_msg to report that the Science Abnorm data could not be */
966  /* written to the L1A granule */
967  /* INPUTS: returnStatus, routine, msg */
968  /* OUTPUT: None */
969  /* RETURN: None */
970  /* ENDIF */
971  /* */
972  /*****************************************************************************/
973 
974  if (putMODISarray(L1A_file_ptr,M01SCIENCE_ABNORM,NULL,start,dimsize,
975  &L1A_scan->science_abnormal) == MFAIL)
976  {
977  sprintf(msg,"The Science Abnorm data could not be written to the L1A granule %s",
978  L1A_file_ptr->filename);
979  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
981  }
982 
983 
984  /*****************************************************************************/
985  /* */
986  /* Compute dimsize array for the PV & PC DCR Offset data */
987  /* Compute the start for the PV & PC DCR Offset data */
988  /* CALL putMODISarray to write the PV & PC DCR Offset data to the L1A */
989  /* granule */
990  /* INPUTS: MODFILE, M01FPA_DCR_OFFSET, NULL, start, dimsize array, */
991  /* SC_SCAN_DATA_t.fpa_dcr_offset */
992  /* OUTPUT: None */
993  /* RETURN: mapiStatus */
994  /* */
995  /* IF mapiStatus equals MFAIL */
996  /* THEN */
997  /* set routine to "write_scan_data" */
998  /* set msg to "The PV & PC DCR Offset data could not be written to the */
999  /* L1A granule" */
1000  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1001  /* CALL log_fmt_msg to report that the PV & PC DCR Offset data could not */
1002  /* be written to the L1A granule */
1003  /* INPUTS: returnStatus, routine, msg */
1004  /* OUTPUT: None */
1005  /* RETURN: None */
1006  /* ENDIF */
1007  /* */
1008  /*****************************************************************************/
1009 
1010  dimsize[1] = PD_E1P1_NUM_FPA_DCR_OFFSETS;
1011 
1012  if (putMODISarray(L1A_file_ptr,M01FPA_DCR_OFFSET,NULL,start,dimsize,
1013  L1A_scan->fpa_dcr_offset) == MFAIL)
1014  {
1015  sprintf(msg,"The PV & PC DCR Offset data could not be written to the L1A granule %s",
1016  L1A_file_ptr->filename);
1017  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1019  }
1020 
1021 
1022  /*****************************************************************************/
1023  /* */
1024  /* Compute dimsize array for the Earth Encoder Times data */
1025  /* Compute the start for the Earth Encoder Times data */
1026  /* CALL putMODISarray to write the Earth Encoder Times data to the L1A */
1027  /* granule */
1028  /* INPUTS: MODFILE, M01RAW_MIR_ENC, NULL, start, dimsize array, */
1029  /* SC_SCAN_DATA_t.raw_mir_enc */
1030  /* OUTPUT: None */
1031  /* RETURN: mapiStatus */
1032  /* */
1033  /* IF mapiStatus equals MFAIL */
1034  /* THEN */
1035  /* set routine to "write_scan_data" */
1036  /* set msg to "The Earth Encoder Times data could not be written to the */
1037  /* L1A granule" */
1038  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1039  /* CALL log_fmt_msg to report that the Earth Encoder Times data could */
1040  /* not be written to the L1A granule */
1041  /* INPUTS: returnStatus, routine, msg */
1042  /* OUTPUT: None */
1043  /* RETURN: None */
1044  /* ENDIF */
1045  /* */
1046  /*****************************************************************************/
1047 
1048  dimsize[1] = PD_E1P2_NUM_EARTH_ENCODER_TIMES;
1049 
1050  if (putMODISarray(L1A_file_ptr, M01RAW_MIR_ENC, NULL, start, dimsize,
1051  L1A_scan->raw_mir_enc) == MFAIL)
1052  {
1053  sprintf(msg,"The Mirror Encoder Times data could not be written to the L1A granule %s",
1054  L1A_file_ptr->filename);
1055  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1057  }
1058 
1059  /*****************************************************************************/
1060  /* */
1061  /* Compute dimsize array for the View Sector Definitions data */
1062  /* Compute the start for the View Sector Definitions data */
1063  /* CALL putMODISarray to write the View Sector Definitions data to the L1A */
1064  /* granule */
1065  /* INPUTS: MODFILE, M01RAW_VS_DEF, NULL, start, dimsize array, */
1066  /* SC_SCAN_DATA_t.raw_vs_def */
1067  /* OUTPUT: None */
1068  /* RETURN: mapiStatus */
1069  /* */
1070  /* IF mapiStatus equals MFAIL */
1071  /* THEN */
1072  /* set routine to "write_scan_data" */
1073  /* set msg to "The View Sector Definitions data could not be written to */
1074  /* the L1A granule" */
1075  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1076  /* CALL log_fmt_msg to report that the View Sector Definitions data could*/
1077  /* could not be written to the L1A granule */
1078  /* INPUTS: returnStatus, routine, msg */
1079  /* OUTPUT: None */
1080  /* RETURN: None */
1081  /* ENDIF */
1082  /* */
1083  /*****************************************************************************/
1084 
1086 
1087  if (putMODISarray(L1A_file_ptr,M01RAW_VS_DEF,NULL,start,dimsize,L1A_scan->raw_vs_def)
1088  == MFAIL)
1089  {
1090  sprintf(msg,"The View Sector Definitions data could not be written to the L1A granule %s",
1091  L1A_file_ptr->filename);
1092  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1094  }
1095 
1096 
1097  /*****************************************************************************/
1098  /* */
1099  /* Compute dimsize array for the View Sector Actuals data */
1100  /* Compute the start for the View Sector Actuals data */
1101  /* CALL putMODISarray to write the View Sector Actuals data to the L1A */
1102  /* granule */
1103  /* INPUTS: MODFILE, M01RAW_VS_ACT, NULL, start, dimsize array, */
1104  /* SC_SCAN_DATA_t.raw_vs_act */
1105  /* OUTPUT: None */
1106  /* RETURN: mapiStatus */
1107  /* */
1108  /* IF mapiStatus equals MFAIL */
1109  /* THEN */
1110  /* set routine to "write_scan_data" */
1111  /* set msg to "The View Sector Actuals data could not be written to the */
1112  /* L1A granule" */
1113  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1114  /* CALL log_fmt_msg to report that the View Sector Actuals data could */
1115  /* not be written to the L1A granule */
1116  /* INPUTS: returnStatus, routine, msg */
1117  /* OUTPUT: None */
1118  /* RETURN: None */
1119  /* ENDIF */
1120  /* */
1121  /*********************************************************************************/
1122 
1123  dimsize[1] = PD_E1P2_NUM_VIEW_SECTOR_ACTUALS;
1124 
1125  if (putMODISarray(L1A_file_ptr,M01RAW_VS_ACT,NULL,start,dimsize,L1A_scan->raw_vs_act)
1126  == MFAIL)
1127  {
1128  sprintf(msg,"The View Sector Actuals data could not be written to the L1A granule %s",
1129  L1A_file_ptr->filename);
1130  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1132  }
1133 
1134 
1135  /*****************************************************************************/
1136  /* */
1137  /* Compute dimsize array for the Eng Data */
1138  /* Compute the start for the Eng Data */
1139  /* CALL putMODISarray to write the Eng Data to the L1A granule */
1140  /* INPUTS: MODFILE, M01RAW_SCI_ENG, NULL, start, dimsize array, */
1141  /* SC_SCAN_DATA_t.raw_sci_eng */
1142  /* OUTPUT: None */
1143  /* RETURN: mapiStatus */
1144  /* */
1145  /* IF mapiStatus equals MFAIL */
1146  /* THEN */
1147  /* set routine to "write_scan_data" */
1148  /* set msg to "The Eng Data cuold not be written to the L1A granule" */
1149  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1150  /* CALL log_fmt_msg to report that the Eng Data could not be */
1151  /* written to the L1A granule */
1152  /* INPUTS: returnStatus, routine, msg */
1153  /* OUTPUT: None */
1154  /* RETURN: None */
1155  /* ENDIF */
1156  /* */
1157  /*****************************************************************************/
1158 
1159  dimsize[1] = SC_NUM_SCI_ENG_BYTES_IN_SDS;
1160 
1161  if (putMODISarray(L1A_file_ptr,M01RAW_SCI_ENG,NULL,start,dimsize,L1A_scan->raw_sci_eng)
1162  == MFAIL)
1163  {
1164  sprintf(msg,"The Raw Science Eng Data could not be written to the L1A granule %s",
1165  L1A_file_ptr->filename);
1166  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1168  }
1169 
1170 
1171  /*****************************************************************************/
1172  /* */
1173  /* Compute dimsize array for the Current/Prior HK Tlmy data */
1174  /* Compute the start for the Current/Prior HK Tlmy data */
1175  /* CALL putMODISarray to write the Current/Prior HK Tlmy data to the L1A */
1176  /* granule */
1177  /* INPUTS: MODFILE, M01RAW_HK_TELEM, NULL, start, dimsize array, */
1178  /* SC_SCAN_DATA_t.raw_hk_telem */
1179  /* OUTPUT: None */
1180  /* RETURN: mapiStatus */
1181  /* */
1182  /* IF mapiStatus equals MFAIL */
1183  /* THEN */
1184  /* set routine to "write_scan_data" */
1185  /* set msg to "The Current/Prior HK Tlmy data could not be written to */
1186  /* the L1A granule" */
1187  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1188  /* CALL log_fmt_msg to report that the Current/Prior HK Tlmy data could */
1189  /* not be written to the L1A granule */
1190  /* INPUTS: returnStatus, routine, msg */
1191  /* OUTPUT: None */
1192  /* RETURN: None */
1193  /* ENDIF */
1194  /* */
1195  /*****************************************************************************/
1196 
1197  dimsize[1] = PD_E2P1_NUM_HK_TELEM_BYTES;
1198 
1199  if (putMODISarray(L1A_file_ptr,M01RAW_HK_TELEM,NULL,start,dimsize,L1A_scan->raw_hk_telem)
1200  == MFAIL)
1201  {
1202  sprintf(msg,"The Current/Prior HK Tlmy data could not be written to the L1A granule %s",
1203  L1A_file_ptr->filename);
1204  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1206  }
1207 
1208 
1209  /*****************************************************************************/
1210  /* */
1211  /* Compute dimsize array for the Current/Prior S/C Ancill data */
1212  /* Compute the start for the Current/Prior S/C Ancill data */
1213  /* CALL putMODISarray to write the Current/Prior S/C Ancill data to the L1A */
1214  /* granule */
1215  /* INPUTS: MODFILE, M01RAW_SC_ANCIL, NULL, start, dimsize array, */
1216  /* SC_SCAN_DATA_t.raw_sc_ancil */
1217  /* OUTPUT: None */
1218  /* RETURN: mapiStatus */
1219  /* */
1220  /* IF mapiStatus equals MFAIL */
1221  /* THEN */
1222  /* set routine to "write_scan_data" */
1223  /* set msg to "The Current/Prior S/C Ancill data could not be written to */
1224  /* the L1A granule" */
1225  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1226  /* CALL log_fmt_msg to report that the Current/Prior S/C Ancill data */
1227  /* could not be written to the L1A granule */
1228  /* INPUTS: returnStatus, routine, msg */
1229  /* OUTPUT: None */
1230  /* RETURN: None */
1231  /* ENDIF */
1232  /* */
1233  /*****************************************************************************/
1234 
1235  dimsize[1] = PD_E2P1_NUM_SC_ANCIL_WORDS;
1236 
1237  if (putMODISarray(L1A_file_ptr,M01RAW_SC_ANCIL,NULL,start,dimsize,L1A_scan->raw_sc_ancil)
1238  == MFAIL)
1239  {
1240  sprintf(msg,"The Current/Prior S/C Ancill data could not be written to the L1A granule %s",
1241  L1A_file_ptr->filename);
1242  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1244  }
1245 
1246 
1247  /*****************************************************************************/
1248  /* */
1249  /* Compute dimsize array for the Command Parameters data */
1250  /* Compute the start for the Command Parameters data */
1251  /* CALL putMODISarray to write the Command Parameters data to the L1A */
1252  /* granule */
1253  /* INPUTS: MODFILE, M01RAW_PARAM, NULL, start, dimsize array, */
1254  /* SC_SCAN_DATA_t.raw_param */
1255  /* OUTPUT: None */
1256  /* RETURN: mapiStatus */
1257  /* */
1258  /* IF mapiStatus equals MFAIL */
1259  /* THEN */
1260  /* set routine to "write_scan_data" */
1261  /* set msg to "The Command Parameters data could not be written to the */
1262  /* L1A granule" */
1263  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1264  /* CALL log_fmt_msg to report that the Command Parameters data could not */
1265  /* be written to the L1A granule */
1266  /* INPUTS: returnStatus, routine, msg */
1267  /* OUTPUT: None */
1268  /* RETURN: None */
1269  /* ENDIF */
1270  /* */
1271  /*****************************************************************************/
1272 
1273  dimsize[1] = PD_E2P1_NUM_PARAM_BYTES;
1274 
1275  if (putMODISarray(L1A_file_ptr,M01RAW_PARAM,NULL,start,dimsize,L1A_scan->raw_param)
1276  == MFAIL)
1277  {
1278  sprintf(msg,"The Command Parameters data could not be written to the L1A granule %s",
1279  L1A_file_ptr->filename);
1280  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1282  }
1283 
1284 
1285  /*****************************************************************************/
1286  /* */
1287  /* Compute dimsize array for the PV Gains data */
1288  /* Compute the start for the PV Gains data */
1289  /* CALL putMODISarray to write the PV Gains data to the L1A granule */
1290  /* INPUTS: MODFILE, M01RAW_PV_GAINS, NULL, start, dimsize array, */
1291  /* SC_SCAN_DATA_t.raw_pv_gains */
1292  /* OUTPUT: None */
1293  /* RETURN: mapiStatus */
1294  /* */
1295  /* IF mapiStatus equals MFAIL */
1296  /* THEN */
1297  /* set routine to "write_scan_data" */
1298  /* set msg to "The PV Gains data could not be written to the L1A granule"*/
1299  /* set returnStatus to MODIS_E_ARRAY_OUTPUT_ERR */
1300  /* CALL log_fmt_msg to report that the PV Gains data could not be */
1301  /* written to the L1A granule */
1302  /* INPUTS: returnStatus, routine, msg */
1303  /* OUTPUT: None */
1304  /* RETURN: None */
1305  /* ENDIF */
1306  /* */
1307  /*****************************************************************************/
1308 
1309  dimsize[1] = PD_E2P2_NUM_PV_GAINS;
1310 
1311  if (putMODISarray(L1A_file_ptr,M01RAW_PV_GAINS,NULL,start,dimsize,L1A_scan->raw_pv_gains)
1312  == MFAIL)
1313  {
1314  sprintf(msg,"The PV Gains data could not be written to the L1A granule %s",
1315  L1A_file_ptr->filename);
1316  returnStatus = MODIS_E_ARRAY_OUTPUT_ERR;
1318  }
1319 
1320 
1321  /*****************************************************************************/
1322  /* */
1323  /* return returnStatus */
1324  /* */
1325  /*****************************************************************************/
1326 
1327  return (returnStatus);
1328 }
#define PD_DN_NUM_500M_BANDS
Definition: PD_pkt_data.h:97
integer, parameter int16
Definition: cubeio.f90:3
#define PD_DN_NUM_1KMDAY_BANDS
Definition: PD_pkt_data.h:106
SC_CAL_1KM_NIGHT SRCA_1km_night
Definition: SC_scan.h:216
#define PD_DN_NUM_250M_BANDS
Definition: PD_pkt_data.h:90
#define NULL
Definition: decode_rs.h:63
#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
#define MD_DAY_SCAN
Definition: MD_metadata.h:97
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
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
PGSt_SMF_status write_scan_data(MODFILE *L1A_file_ptr, SC_SCAN_DATA_t *L1A_scan, int16 scan_num, char *scan_type)
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 MODIS_E_ARRAY_OUTPUT_ERR
#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
#define MODIS_S_SUCCESS
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
string msg
Definition: mapgen.py:227
#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
int16 raw_mir_enc[PD_E1P2_NUM_EARTH_ENCODER_TIMES]
Definition: SC_scan.h:242