OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
close_Vdata.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 
7 
8 PGSt_SMF_status close_Vdata ( char *Vdata_name )
9 
10 /*
11 !C************************************************************************
12 
13 !Description: This function detaches the specified Vdata from the
14  currently open hdf file.
15 
16 !Input Parameters:
17  char *Vdata_name ** The name of the Vdata to close **
18 
19 !Output Parameters:
20  None
21 
22 Return Values:
23  MODIS_S_SUCCESS (PGS_MODIS_35005.h)
24  FAIL (hdf.h)
25 
26 Externally Defined:
27  int32 (hdfi.h)
28 
29 Called By:
30  end_eng_data_access_to_file
31 
32 Routines Called:
33  recall_id
34  VSdetach
35  forget
36  log_fmt_msg
37 
38 !Revision History:
39  Revision 2.0 1997/10/01 16:45 EDT
40  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
41  Originated Code.
42 
43  Revision 1.1 1997/09/03 10:55
44  Tom Johnson/GSC (johnson@ltpmail.gsfc.nasa.gov)
45  Incorporate walkthrough comments
46 
47  Revision 1.0 1997/07/14 15:58 EDT
48  David Catozzi/SAIC/GSC (cato@ltpmail.gsfc.nasa.gov)
49  Original design.
50 
51 !Team-unique Header:
52  This software is developed by the MODIS Science
53  Data Support Team (SDST) for the National Aeronautics
54  and Space Administration (NASA), Goddard Space Flight
55  Center (GSFC), under contract NAS5-32373.
56 
57 !References and Credits:
58  HDF portions developed at the National Center for
59  Supercomputing Applications at the University of Illinois
60  at Urbana-Champaign.
61 
62 !Design Notes:
63  None
64 
65 !END************************************************************************
66 */
67 
68  {
69  /**************************************************************************/
70  /* */
71  /* Declare the local variables and initialize them. */
72  /* */
73  /**************************************************************************/
74  /* */
75  /* Set routine to "close_Vdata" */
76  /* Set returnStatus to MODIS_S_SUCCESS */
77  /* declare Vdata_id to be variables of type int32 */
78  /* */
79  /**************************************************************************/
80 
81  PGSt_SMF_status returnStatus; /* SMF-style message returned by function */
82 
83  char *routine = "close_Vdata";
84 
85  char msg[300];
86 
87  int32 Vdata_id;
88 
89 
90  returnStatus = MODIS_S_SUCCESS;
91 
92 
93  /**************************************************************************/
94  /* */
95  /* CALL recall_id to get the Vdata_id for this Vdata */
96  /* INPUTS: Vdata_name */
97  /* OUTPUTS: None */
98  /* RETURNS: Vdata_id */
99  /* */
100  /* IF Vdata_id is not equal to FAIL */
101  /* THEN */
102  /* CALL VSdetach to detach the Vdata from the file */
103  /* INPUTS: Vdata_id */
104  /* OUTPUTS: None */
105  /* RETURNS: None */
106  /* */
107  /* CALL forget to remove the Vdata's name/id pair from the lookup table*/
108  /* INPUTS: Vdata_name */
109  /* OUTPUTS: None */
110  /* RETURNS: None */
111  /* */
112  /**************************************************************************/
113 
114  Vdata_id = recall_id(Vdata_name);
115  if (Vdata_id != FAIL) {
116  VSdetach(Vdata_id);
117  forget(Vdata_name);
118  }
119 
120 
121  /**************************************************************************/
122  /* */
123  /* ELSE */
124  /* Set Status to MODIS_E_RECALL_ID */
125  /* Set msg to "Vdata Name: <vdata name>" */
126  /* Set routine to "close_Vdata" */
127  /* CALL log_fmt_msg to report that the Vdata id could not be retrieved */
128  /* INPUTS: Status, routine, msg */
129  /* OUTPUT: None */
130  /* RETURN: None */
131  /* */
132  /* Set returnStatus to FAIL */
133  /* ENDIF */
134  /* */
135  /* RETURN returnStatus */
136  /* */
137  /**************************************************************************/
138 
139  else {
140  sprintf(msg, "Vdata Name: %s", Vdata_name);
141  log_fmt_msg (MODIS_E_RECALL_ID, routine, msg);
142 
143  returnStatus = FAIL;
144  }
145 
146  return returnStatus;
147 
148  } /* End of routine close_Vdata.c */
PGSt_SMF_status close_Vdata(char *Vdata_name)
Definition: close_Vdata.c:8
#define FAIL
Definition: ObpgReadGrid.h:18
#define MODIS_E_RECALL_ID
int32 recall_id(char *Vdata_name)
Definition: recall_id.c:8
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
#define MODIS_S_SUCCESS
string msg
Definition: mapgen.py:227
void forget(char *Vdata_name)
Definition: forget.c:8