OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
remember.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "PGS_SMF.h"
3 #include "PGS_MODIS_35005.h"
4 #include "hdf.h"
5 #include "hdfi.h"
6 #include "VU_vdata_utility.h"
7 
8 void remember (char *Vdata_name,
9  int32 Vdata_id )
10 
11 /*
12 !C************************************************************************
13 
14 !Description: Stores the Vdata name/id pair in the id_table for future
15  reference.
16 
17 !Input Parameters:
18  char *Vdata_name ** The Vdata name to store **
19  int32 Vdata_id ** The Vdata id to store **
20 
21 !Output Parameters:
22  None
23 
24 Return Values:
25  None
26 
27 Externally Defined:
28  PGS_SMF_status (PGS_SMF.h)
29  int32 (hdfi.h)
30  VU_INCREMENT (VU_vdata_utility.h)
31  MODIS_E_MAX_VDATAS_EXCEEDED (MODIS_35003.t)
32  MODIS_E_ID_TABLE_OVERFLOW (MODIS_35003.t)
33  FAIL (hdf.h)
34  global_VU_VDATA_ID (level1a)
35  global_VU_ID_TABLE_READY (level1a)
36 
37 Called By:
38  create_Vdata
39 
40 Routines Called:
41  initialize_id_table
42  attached_Vdata_counter
43  get_empty_slot
44  log_fmt_msg
45 
46 !Revision History:
47  Revision 2.0 1997/10/01 20:45 EDT
48  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
49  Originated Code.
50 
51  Revision 1.1 1997/09/03 10:55
52  Tom Johnson/GSC (johnson@ltpmail.gsfc.nasa.gov)
53  Incorporate walkthrough comments
54 
55  Revision 1.0 1997/07/14 15:58 EDT
56  David Catozzi/SAIC/GSC (cato@ltpmail.gsfc.nasa.gov)
57  Original design.
58 
59 !Team-unique Header:
60  This software is developed by the MODIS Science
61  Data Support Team (SDST) for the National Aeronautics
62  and Space Administration (NASA), Goddard Space Flight
63  Center (GSFC), under contract NAS5-32373.
64 
65 !References and Credits:
66  None
67 
68 !Design Notes:
69  None
70 
71 !END************************************************************************
72 */
73 
74  {
75  /**************************************************************************/
76  /* */
77  /* Declare the global variables. */
78  /* */
79  /**************************************************************************/
80 
81  extern VU_ID_TABLE global_VU_VDATA_ID[VU_MAX_NUMBER_OF_VDATAS];
82 
83  extern int global_VU_ID_TABLE_READY;
84 
85 
86  /**************************************************************************/
87  /* */
88  /* Declare the local variables and initialize them. */
89  /* */
90  /**************************************************************************/
91  /* */
92  /* Set routine to "remember" */
93  /* */
94  /**************************************************************************/
95 
96  char *routine = "remember"; /* Variable to hold routine name */
97 
98  char msg[300]; /* Variable to hold error message */
99 
100  int16 number_attached_Vdatas;
101 
102  int16 empty_slot_index;
103 
104 
105  /**************************************************************************/
106  /* */
107  /* {if this is the first entry then initialize the id table} */
108  /* IF ( global_VU_ID_TABLE_READY equals False ) */
109  /* THEN */
110  /* CALL initialize_id_table to prepare the id table for use */
111  /* INPUTS: None */
112  /* OUTPUTS: None */
113  /* RETURNS: None */
114  /* ENDIF */
115  /* */
116  /* CALL attached_Vdata_counter to increment the number of attached Vdatas */
117  /* INPUTS: VU_INCREMENT */
118  /* OUTPUTS: None */
119  /* RETURNS: number_attached_Vdatas */
120  /* */
121  /* IF ( number_attached_Vdatas equals FAIL ) */
122  /* THEN */
123  /* Set Status to MODIS_E_MAX_VDATAS_EXCEEDED */
124  /* set msg to "Program Error: Attempting to attach more than */
125  /* VU_MAX_NUMBER_OF_VDATAS Vdatas to the file" */
126  /* CALL log_fmt_msg to report the attempt to attach more that the */
127  /* maximum number of Vdatas to the file */
128  /* INPUTS: Status, routine, msg */
129  /* OUTPUTS: None */
130  /* RETURNS: None */
131  /* ENDIF */
132  /* */
133  /**************************************************************************/
134 
137 
138  number_attached_Vdatas = attached_Vdata_counter(VU_INCREMENT);
139  if (number_attached_Vdatas == FAIL) {
140  sprintf(msg, "Vdata Name: %s", Vdata_name);
142  }
143 
144 
145 
146  /**************************************************************************/
147  /* */
148  /* CALL get_empty_slot to get an empty id_table slot to use */
149  /* INPUTS: None */
150  /* OUTPUTS: None */
151  /* RETURNS: empty_slot_index */
152  /* */
153  /* IF ( empty_slot_index equals FAIL ) */
154  /* THEN */
155  /* set Status to MODIS_E_ID_TABLE_OVERFLOW */
156  /* set msg to "Program Error: Attempting to insert into a full id */
157  /* table." */
158  /* CALL log_fmt_msg to report the attempt to insert into a full id */
159  /* table */
160  /* INPUTS: Status, routine, msg */
161  /* OUTPUTS: None */
162  /* RETURNS: None */
163  /* ELSE */
164  /* set global_VU_VDATA_ID[empty_slot_index].id to Vdata_id */
165  /* set global_VU_VDATA_ID[empty_slot_index].name to Vdata_name */
166  /* ENDIF */
167  /* */
168  /**************************************************************************/
169 
170 
171  if ((empty_slot_index = get_empty_slot()) == FAIL){
172  sprintf(msg, "No empty slots for Vdata %s exist", Vdata_name);
174  }
175  else {
176  global_VU_VDATA_ID[empty_slot_index].id = Vdata_id;
177  strcpy(global_VU_VDATA_ID[empty_slot_index].name, Vdata_name);
178  }
179 
180  } /* End of routine remember */
integer, parameter int16
Definition: cubeio.f90:3
#define VU_MAX_NUMBER_OF_VDATAS
#define VU_INCREMENT
#define MODIS_E_MAX_VDATAS_EXCEEDED
#define FAIL
Definition: ObpgReadGrid.h:18
void remember(char *Vdata_name, int32 Vdata_id)
Definition: remember.c:8
int16 attached_Vdata_counter(int16 action)
#define MODIS_E_ID_TABLE_OVERFLOW
int16 get_empty_slot(void)
Definition: get_empty_slot.c:6
VU_ID_TABLE global_VU_VDATA_ID[VU_MAX_NUMBER_OF_VDATAS]
Definition: level1a.c:36
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
void initialize_id_table(void)
int global_VU_ID_TABLE_READY
Definition: level1a.c:26
string msg
Definition: mapgen.py:227
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")