OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
end_Vdata_access_to_file.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 "VU_vdata_utility.h"
5 #include "hdf.h"
6 #include "hdfi.h"
7 
8 PGSt_SMF_status end_Vdata_access_to_file (MODFILE *L1A_file)
9 
10 /*
11 !C************************************************************************
12 
13 !Description: This function checks to see that all of the Vdata have been
14  detached from the file.
15 
16 !Input Parameters:
17  None
18 
19 !Output Parameters:
20  None
21 
22 !Input/Output Parameters:
23  MODFILE *L1A_file ** Level 1A file **
24 
25 Return Values:
26  MODIS_S_SUCCESS (PGS_MODIS_35005.h)
27  MODIS_E_ATTACHED_VDATAS (PGS_MODIS_35005.h)
28  FAIL (hdf.h)
29 
30 Externally Defined:
31  PGSt_SMF_status (PGS_SMF.h)
32  int16 (hdfi.h)
33  global_H_ID (level1a)
34 
35 Called By:
36  end_eng_access_to_file
37 
38 Routines Called:
39  log_fmt_msg
40  attached_Vdata_counter
41 
42 !Revision History:
43  Revision 2.0 1997/10/01 12:45 EDT
44  Timi Adelekan/SAIC/GSC (adelekan@ltpmail.gsfc.nasa.gov)
45  Originated Code.
46 
47  Revision 1.1 1997/09/03 10:55
48  Tom Johnson/GSC (johnson@ltpmail.gsfc.nasa.gov)
49  Incorporate walkthrough comments
50 
51  Revision 1.0 1997/07/14 15:58 EDT
52  David Catozzi/SAIC/GSC (cato@ltpmail.gsfc.nasa.gov)
53  Original design.
54 
55 !Team-unique Header:
56  This software is developed by the MODIS Science
57  Data Support Team (SDST) for the National Aeronautics
58  and Space Administration (NASA), Goddard Space Flight
59  Center (GSFC), under contract NAS5-32373.
60 
61 !References and Credits:
62  None
63 
64 !Design Notes:
65  None
66 
67 !END************************************************************************
68 */
69 
70  {
71  /**************************************************************************/
72  /* */
73  /* Declare the global variables. */
74  /* */
75  /**************************************************************************/
76 
77  extern int32 global_H_ID;
78 
79 
80  /**************************************************************************/
81  /* */
82  /* Declare the local variables and initialize them. */
83  /* */
84  /**************************************************************************/
85  /* */
86  /* Set routine to "end_Vdata_access_to_file" */
87  /* */
88  /* Set returnStatus to MODIS_S_SUCCESS */
89  /* */
90  /**************************************************************************/
91 
92  PGSt_SMF_status returnStatus; /* SMF-style message returned by function */
93 
94  char *routine = "end_Vdata_access_to_file";
95 
96  char msg[300];
97 
98  int16 num_attached_Vdatas;
99 
100 
101  returnStatus = MODIS_S_SUCCESS;
102 
103 
104  /**************************************************************************/
105  /* */
106  /* CHECK TO SEE IF ALL Vdatas HAVE BEEN UNATTACHED */
107  /* */
108  /**************************************************************************/
109  /* */
110  /* CALL attached_Vdata_counter to get the number of attached Vdatas */
111  /* INPUTS: VU_REPORT */
112  /* OUTPUTS: None */
113  /* RETURNS: num_attached_Vdatas */
114  /* */
115  /* IF ( num_attached_Vdatas > 0 ) */
116  /* THEN */
117  /* set Status to MODIS_E_ATTACHED_VDATAS */
118  /* set msg to "Attempting to close the hdf file with Vdata(s) still */
119  /* attached." */
120  /* CALL log_fmt_msg to report that there are still Vdata attached to */
121  /* the HDF file */
122  /* INPUTS: Status, routine, msg */
123  /* OUTPUTS: None */
124  /* RETURN: None */
125  /* */
126  /* set returnStatus to FAIL */
127  /* ELSE */
128  /* set global_H_ID to NULL */
129  /* ENDIF */
130  /* */
131  /* return returnStatus */
132  /* */
133  /**************************************************************************/
134 
135  num_attached_Vdatas = attached_Vdata_counter(VU_REPORT);
136 
137  if ( num_attached_Vdatas > 0 ) {
138  sprintf(msg, "Number of Vdata(s) still attached: %d", num_attached_Vdatas);
140 
141  returnStatus = FAIL;
142  }
143  else {
144  L1A_file->hdf_id = global_H_ID;
145  /* global_H_ID = NULL; */
146  }
147 
148  return returnStatus;
149 
150  } /* End of routine end_Vdata_access_to_file */
integer, parameter int16
Definition: cubeio.f90:3
#define FAIL
Definition: ObpgReadGrid.h:18
#define MODIS_E_ATTACHED_VDATAS
int32 global_H_ID
Definition: level1a.c:27
#define VU_REPORT
int16 attached_Vdata_counter(int16 action)
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
PGSt_SMF_status end_Vdata_access_to_file(MODFILE *L1A_file)
#define MODIS_S_SUCCESS
string msg
Definition: mapgen.py:227