OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
create_eng_data_vdata_array.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "EN_eng_data.h"
3 #include "hdfi.h"
4 #include "PGS_MODIS_35005.h"
5 
6 
7 void create_eng_data_vdata_array (char *eng_data_name,
8  EN_VDATA_TYPE_t *eng_data,
9  uint16 *curr_eng_data_index,
10  uint16 *curr_field_index)
11 /*
12 !C************************************************************************
13 
14 !Description: This function is a helper function to parse_eng_data_list().
15  An element of an array is created in the eng_data structure.
16  A field called LAST_VALID_SCAN is added as its first field.
17 
18 !Input Parameters:
19  char *eng_data_name ** The name of the Vdata
20  to create **
21 
22 !Output Parameters:
23  None
24 
25 !Input/Output Parameters:
26  EN_VDATA_TYPE_t *eng_data ** The eng_data array
27  structure (a new Vdata
28  is added) **
29 
30  uint16 *curr_field_index ** The field index (at which
31  to place the newly created
32  field) within the Vdata
33  currently being created
34  (this is reset and
35  incremented) **
36 
37  uint16 *curr_eng_data_index ** The eng_data index of the
38  Vdata currently being
39  created (this is
40  incremented) **
41 
42 Return Values:
43  None
44 
45 Externally Defined:
46  PGS_TRUE (PGS_SMF.h)
47  PGS_FALSE (PGS_SMF.h)
48  uint16 (hdfi.h)
49  EN_VDATA_TYPE_t (EN_eng_data.h)
50  PGSt_booean (PGS_TYPES.h)
51  MODIS_E_NULL_POINTER (PGS_MODIS_35005.h)
52 
53 Called By:
54  parse_eng_data_list
55 
56 Routines Called:
57  create_eng_data_vdata_array_field
58  log_fmt_msg
59 
60 !Revision History:
61  Revision 2.0 1998/10/26 10:03 EST
62  John Seaton/SAIC/GSC (seaton@ltpmail.gsfc.nasangov)
63  Added logic not to create LAST_VALID_SCAN field
64  for Current/Prior S/C Ancillary Data Vdatas.
65 
66  Revision 1.0 1997/07/16 15:58 EDT
67  David Catozzi/SAIC/GSC (cato@ltpmail.gsfc.nasa.gov)
68  Original design.
69 
70 !Team-unique Header:
71  This software is developed by the MODIS Science
72  Data Support Team (SDST) for the National Aeronautics
73  and Space Administration (NASA), Goddard Space Flight
74  Center (GSFC), under contract NAS5-32373.
75 
76 !References and Credits:
77  None
78 
79 !Design Notes:
80  Vdatas are created in the order they appear in the
81  eng_data_list file so that the correct indexes correspond
82  to the correct Vdatas (as expected in other routines).
83 
84 !END************************************************************************
85 */
86 
87 {
88  /***************************************************************************/
89  /* */
90  /* Declare and Initialize Local Variables */
91  /* */
92  /***************************************************************************/
93 
94  static PGSt_boolean first_vdata = PGS_TRUE; /* first vdata (first time */
95  /* in routine) flag */
96 
97  EN_VDATA_TYPE_t *vdata;
98  char *routine = "create_eng_data_vdata_array";
99 
100  /***************************************************************************/
101 
102  /***************************************************************************/
103  /* IF NULL parameters passed in to procedure */
104  /* THEN */
105  /* CALL log_fmt_msg to print NULL paramaters error message in LogStatus */
106  /* INPUTS: MODIS_E_NULL_POINTER, "create_eng_data_vdata_array", " " */
107  /* OUTPUTS: None */
108  /* RETURNS: None */
109  /* */
110  /* return */
111  /* ENDIF */
112  /***************************************************************************/
113 
114  if ((eng_data_name == NULL) ||
115  (eng_data == NULL) ||
116  (curr_eng_data_index == NULL) ||
117  (curr_field_index == NULL)) {
118  log_fmt_msg(MODIS_E_NULL_POINTER, routine, " ");
119  return;
120  }
121 
122  /***************************************************************************/
123  /* */
124  /* IF this is NOT the first vdata (i.e. if this isn't */
125  /* the first call to this function) */
126  /* THEN */
127  /* increment curr_eng_data_index */
128  /* ENDIF */
129  /* */
130  /***************************************************************************/
131 
132  if (first_vdata != PGS_TRUE)
133  (*curr_eng_data_index)++;
134 
135  first_vdata = PGS_FALSE;
136 
137 
138  /***************************************************************************/
139  /* */
140  /* set curr_field_index to 0 */
141  /* set eng_data[curr_eng_data_index].vdata_name to eng_data_name */
142  /* set eng_data[curr_eng_data_index].num_fields to 0 */
143  /* */
144  /* set field_name to "LAST_VALID_SCAN" */
145  /* set num_bits to 0 */
146  /* set start_bit_pos to 0 */
147  /* IF eng_data_name NOT equal to Current S/C Ancillary Data Vdata AND */
148  /* eng_data_name NOT equal to Prior S/C Ancillary Data Vdata */
149  /* THEN */
150  /* CALL create_eng_data_vdata_array_field to create the first field */
151  /* 'LAST_VALID_SCAN', which is mandatory for all Vdatas. */
152  /* INPUTS: field_name, num_bits, start_bit_pos, eng_data, */
153  /* curr_eng_data_index, curr_field_index */
154  /* OUTPUTS: eng_data, curr_field_index */
155  /* RETURN: None */
156  /* */
157  /***************************************************************************/
158 
159  *curr_field_index = 0;
160 
161  vdata = &(eng_data[(int)*curr_eng_data_index]);
162  strcpy(vdata->vdata_name, eng_data_name);
163  vdata->num_fields = 0;
164 
165  if ((strcmp(eng_data_name, "Current S/C Ancillary Data") != 0) &&
166  (strcmp(eng_data_name, "Prior S/C Ancillary Data") != 0))
168  eng_data, *curr_eng_data_index, curr_field_index);
169 
170 }
#define EN_LAST_VALID_SCAN
Definition: EN_eng_data.h:77
#define NULL
Definition: decode_rs.h:63
void create_eng_data_vdata_array_field(char *field_name, uint16 num_bits, uint16 start_bit_pos, uint16 order, uint16 type, EN_VDATA_TYPE_t *eng_data, uint16 curr_eng_data_index, uint16 *curr_field_index)
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
char vdata_name[EN_MAX_VDATA_NAME_LENGTH]
Definition: EN_eng_data.h:123
void create_eng_data_vdata_array(char *eng_data_name, EN_VDATA_TYPE_t *eng_data, uint16 *curr_eng_data_index, uint16 *curr_field_index)
#define MODIS_E_NULL_POINTER
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")