OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
create_eng_data_vdata_array_field.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_field ( char *field_name,
8  uint16 num_bits,
9  uint16 start_bit_pos,
10  uint16 order,
11  uint16 type,
12  EN_VDATA_TYPE_t *eng_data,
13  uint16 curr_eng_data_index,
14  uint16 *curr_field_index )
15 
16 /*
17 !C************************************************************************
18 
19 !Description: This function is a helper function to parse_eng_data_list().
20  A field is created in the current structure. Its value is
21  initialized to EN_INITIAL_FIELD_VALUE (or
22  EN_INITIAL_LAST_VALID_SCAN_VALUE if it is the LAST_VALID_SCAN
23  field).
24 
25 !Input Parameters:
26  char *field_name ** The name of the Vdata
27  field to create **
28 
29  uint16 num_bits ** The field's bit length **
30 
31  uint16 start_bit_pos ** The field's start bit
32  position within the
33  eng packet **
34 
35  uint16 curr_eng_data_index ** The eng_data index of
36  the Vdata currently being
37  created **
38 
39 !Output Parameters:
40  None
41 
42 !Input/Output Parameters:
43  EN_VDATA_TYPE_t *eng_data ** The eng_data array
44  structure (a new field
45  is added) **
46 
47  uint16 *curr_field_index ** The field index (at which
48  to place the newly created
49  field) within the Vdata
50  currently being created
51  (this is incremented) **
52 Return Values:
53  None
54 
55 Externally Defined:
56  EN_VDATA_TYPE_t (EN_eng_data.h)
57  EN_FIELD_TYPE_t (EN_eng_data.h)
58  EN_INITIAL_LAST_VALID_SCAN_VALUE (EN_eng_data.h)
59  EN_INITIAL_FIELD_VALUE (EN_eng_data.h)
60 
61 Called By:
62  parse_eng_data_list
63  create_eng_data_vdata_array
64 
65 Routines Called:
66  log_fmt_msg
67 
68 !Revision History:
69  Revision 2.0 1998/10/26 10:16 EST
70  John Seaton/SAIC/GSC (seaton@ltpmail.gsfc.nasa.gov)
71  Added order and type fields to handle Vdatas with
72  different orders and types.
73 
74  Revision 1.0 1997/07/16 15:58 EDT
75  David Catozzi/SAIC/GSC (cato@ltpmail.gsfc.nasa.gov)
76  Original design.
77 
78 !Team-unique Header:
79  This software is developed by the MODIS Science
80  Data Support Team (SDST) for the National Aeronautics
81  and Space Administration (NASA), Goddard Space Flight
82  Center (GSFC), under contract NAS5-32373.
83 
84 !References and Credits:
85  None
86 
87 !Design Notes:
88  Vdata fields are created in the order they appear in the
89  eng_data_list file so that the correct fields are associated
90  with the correct vdatas.
91 
92 !END************************************************************************
93 */
94 
95 
96 {
97  /***************************************************************************/
98  /* */
99  /* Declare and Initialize Local Variables */
100  /* */
101  /***************************************************************************/
102 
103  EN_VDATA_TYPE_t *vdata;
104  EN_FIELD_TYPE_t *field;
105  char *routine = "create_eng_data_vdata_array_field";
106 
107  /***************************************************************************/
108  /* Check for NULL input paramaters */
109  /***************************************************************************/
110  if ((field_name == NULL) ||
111  (eng_data == NULL) ||
112  (curr_field_index == NULL)) {
113  log_fmt_msg(MODIS_E_NULL_POINTER, routine, " ");
114  return;
115  }
116 
117  vdata = &(eng_data[curr_eng_data_index]);
118  field = &(vdata->field[*curr_field_index]);
119 
120  /***************************************************************************/
121  /* Set Vdata field members */
122  /***************************************************************************/
123  strcpy(field->field_name, field_name);
124  field->num_bits = num_bits;
125  field->start_bit_pos = start_bit_pos;
126  field->order = order;
127  field->type = type;
128 
129 
130  /***************************************************************************/
131  /* Initialize field structure value to 0 ot 65535 if LAST_VALID_SCAN field */
132  /***************************************************************************/
133  if (strcmp(field_name, EN_LAST_VALID_SCAN) == 0)
135  else
136  field->value = EN_INITIAL_FIELD_VALUE;
137 
138 
139  /***************************************************************************/
140  /* increment curr_field_index and eng_data[curr_eng_data_index].num_fields*/
141  /***************************************************************************/
142  (*curr_field_index)++;
143  vdata->num_fields++;
144 
145 }
EN_FIELD_TYPE_t field[EN_MAX_FIELDS_PER_VDATA]
Definition: EN_eng_data.h:125
#define EN_LAST_VALID_SCAN
Definition: EN_eng_data.h:77
#define NULL
Definition: decode_rs.h:63
uint16 start_bit_pos
Definition: EN_eng_data.h:109
#define EN_INITIAL_LAST_VALID_SCAN_VALUE
Definition: EN_eng_data.h:74
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)
char field_name[EN_MAX_FIELD_NAME_LENGTH]
Definition: EN_eng_data.h:107
#define EN_INITIAL_FIELD_VALUE
Definition: EN_eng_data.h:79
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
#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")