OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
forget.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 forget (char *Vdata_name)
9 
10 /*
11 !C************************************************************************
12 
13 !Description: Removes the Vdata name/id pair from the id_table.
14 
15 !Input Parameters:
16  char *Vdata_name ** The Vdata name to remove **
17 
18 !Output Parameters:
19  None
20 
21 Return Values:
22  None
23 
24 Externally Defined:
25  int16 (hdfi.h)
26  VU_EMPTY (VU_vdata_utility.h)
27  VU_DECREMENT (VU_vdata_utility.h)
28  MODIS_W_ID_TABLE_UNINITIALIZED (PGS_MODIS_35005.t)
29  MODIS_W_VDATA_NOT_FOUND_IN_TABLE (PGS_MODIS_35005.t)
30  MODIS_W_NEGATIVE_VDATA_COUNTER (PGS_MODIS_35005.t)
31  FAIL (hdf.h)
32  global_VU_VDATA_ID (level1a)
33  global_VU_ID_TABLE_READY (level1a)
34 
35 Called By:
36  close_Vdata
37 
38 Routines Called:
39  log_fmt_msg
40  get_index
41  attached_Vdata_counter
42 
43 !Revision History:
44  Revision 2.0 1997/10/01 21:23 EDT
45  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
46  Originated Code.
47 
48  Revision 1.1 1997/09/03 10:55
49  Tom Johnson/GSC (johnson@ltpmail.gsfc.nasa.gov)
50  Incorporate walkthrough comments
51 
52  Revision 1.0 1997/07/14 15:58 EDT
53  David Catozzi/SAIC/GSC (cato@ltpmail.gsfc.nasa.gov)
54  Original design.
55 
56 !Team-unique Header:
57  This software is developed by the MODIS Science
58  Data Support Team (SDST) for the National Aeronautics
59  and Space Administration (NASA), Goddard Space Flight
60  Center (GSFC), under contract NAS5-32373.
61 
62 !References and Credits:
63  None
64 
65 !Design Notes:
66  None
67 
68 !END************************************************************************
69 */
70 
71  {
72  /**************************************************************************/
73  /* */
74  /* Declare the global variables. */
75  /* */
76  /**************************************************************************/
77 
78  extern VU_ID_TABLE global_VU_VDATA_ID[VU_MAX_NUMBER_OF_VDATAS];
79 
80  extern int global_VU_ID_TABLE_READY;
81 
82 
83  /**************************************************************************/
84  /* */
85  /* Declare the local variables and initialize them. */
86  /* */
87  /**************************************************************************/
88  /* */
89  /* Set routine to "forget" */
90  /* */
91  /**************************************************************************/
92 
93  char *routine = "forget"; /* Variable to hold routine name */
94 
95  char msg[300]; /* Variable to hold error message */
96 
97  int16 this_Vdata_index;
98 
99  int16 number_attached_Vdatas;
100 
101 
102 
103  /**************************************************************************/
104  /* */
105  /* {first ensure that the id table has been initialized} */
106  /* IF ( global_VU_ID_TABLE_READY equals False ) */
107  /* THEN */
108  /* CALL log_fmt_msg to report that the id table was not initialized */
109  /* INPUTS: Status, routine, msg */
110  /* OUTPUTS: None */
111  /* RETURNS: None */
112  /* */
113  /**************************************************************************/
114 
117  "Warning: forget called before the id_table was initialized");
118 
119 
120  /**************************************************************************/
121  /* */
122  /* ELSE */
123  /* CALL get_index to get the Vdata index */
124  /* INPUTS: Vdata_name */
125  /* OUTPUTS: None */
126  /* RETURNS: this_Vdata_index */
127  /* */
128  /* IF ( this_Vdata_index equals FAIL ) */
129  /* THEN */
130  /* set msg to "Vdata Name: <name> */
131  /* CALL log_fmt_msg to report that the Vdata was not found in the */
132  /* id table */
133  /* INPUTS: Status, routine, msg */
134  /* OUTPUTS: None */
135  /* RETURNS: None */
136  /* ENDIF */
137  /* */
138  /**************************************************************************/
139 
140  else {
141  if ((this_Vdata_index = get_index(Vdata_name)) == FAIL){
142  sprintf(msg, "Vdata Name: %s", Vdata_name);
144  }
145 
146  /**************************************************************************/
147  /* */
148  /* CALL attached_Vdata_counter to decrement the number of attached */
149  /* Vdatas */
150  /* INPUTS: VU_DECREMENT */
151  /* OUTPUTS: None */
152  /* RETURNS: number_attached_Vdatas */
153  /* */
154  /* IF ( number_attached_Vdatas equals FAIL ) */
155  /* THEN */
156  /* set Status to MODIS_W_NEGATIVE_VDATA_CTR */
157  /* CALL log_fmt_msg to report that the Vdata counter is negative */
158  /* INPUTS: Status, routine, Attempting to decrement */
159  /* attached_Vdata counter to a negative value */
160  /* OUTPUTS: None */
161  /* RETURNS: None */
162  /* ENDIF */
163  /* */
164  /* {remove the item from the id table} */
165  /* set global_VU_VDATA_ID[this_Vdata_index].id to VU_EMPTY */
166  /* set global_VU_VDATA_ID[this_Vdata_index].name to "EMPTY_SLOT" */
167  /* ENDIF */
168  /* */
169  /**************************************************************************/
170 
171  number_attached_Vdatas = attached_Vdata_counter(VU_DECREMENT);
172  if (number_attached_Vdatas == FAIL) {
174  "Attempting to decrement attached_Vdata counter to a negative value");
175  }
176 
177  global_VU_VDATA_ID[this_Vdata_index].id = VU_EMPTY;
178  strcpy(global_VU_VDATA_ID[this_Vdata_index].name, EN_EMPTY_SLOT);
179  }
180 
181  } /* End of routine forget */
integer, parameter int16
Definition: cubeio.f90:3
#define VU_MAX_NUMBER_OF_VDATAS
#define MODIS_W_NEGATIVE_VDATA_CTR
#define FAIL
Definition: ObpgReadGrid.h:18
int16 attached_Vdata_counter(int16 action)
#define VU_EMPTY
VU_ID_TABLE global_VU_VDATA_ID[VU_MAX_NUMBER_OF_VDATAS]
Definition: level1a.c:36
#define MODIS_W_ID_TABLE_NOT_INIT
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
#define VU_DECREMENT
int global_VU_ID_TABLE_READY
Definition: level1a.c:26
int16 get_index(char *Vdata_name)
Definition: get_index.c:6
#define MODIS_W_VDATA_NOT_IN_TABLE
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")
#define EN_EMPTY_SLOT
Definition: EN_eng_data.h:83
void forget(char *Vdata_name)
Definition: forget.c:8