OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
GEO_get_version_metadata.c
Go to the documentation of this file.
1 #include "PGS_SMF.h"
2 #include "version.h"
3 #include "GEO_output.h"
4 #include "PGS_MODIS_35251.h"
5 
6 PGSt_SMF_status GEO_get_version_metadata(
7  version_metadata_struct *version_metadata)
8 
9 /***********************************************************************
10 !C
11 
12 !Description: Routine for loading most of the elements of version_metadata.
13 
14 !Input Parameters:
15  None
16 
17 !Output Parameters:
18  version_metadata A structure to be filled in with the
19  version metadata.
20 
21 Return Parameters:
22  MODIS_E_BAD_INPUT_ARG If version_metadata is NULL
23  MODIS_E_GEO If either function call fails.
24  PGS_S_SUCCESS Otherwise
25 
26 Externally Defined:
27  MODIS_E_BAD_INPUT_ARG "PGS_MODIS_35251.h"
28  MODIS_E_GEO "PGS_MODIS_35251.h"
29  PGS_S_SUCCESS "PGS_SMF.h"
30  PROCESSVERSION "version.h"
31 
32 Called by:
33  GEO_write_granule_metadata
34 
35 Routines Called:
36  modsmf To log status messages.
37  PGS_PC_GetConfigData To retrieve runtime configuration parameters.
38 
39 !Revision History:
40 $Log: GEO_get_version_metadata.c,v $
41 Revision 4.3 2003/08/12 19:03:30 kuyper
42 Corrected initialization of retval.
43 
44 Revision 4.2 2003/08/07 14:50:26 kuyper
45 Changed handling of errors to simplify testing.
46 
47 Revision 4.1 2003/08/05 18:52:54 kuyper
48 Added processing metadata fields.
49 
50 Revision 3.1 2002/06/13 23:02:32 kuyper
51 Removed unnecessary NCSA acknowledgement.
52 
53 Revision 1.1 2001/01/18 13:56:37 vlin
54 Initial revision
55 
56 
57 Requirements
58  PR03-F-1-3
59  PR03-F-1.3.1
60  PR03-F-4.1-1
61  PR03-I-1
62  PR03-I-2
63  PR03-S-1
64 
65 !Team-unique Header:
66  This software is developed by the MODIS Science Data Support
67  Team for the National Aeronautics and Space Administration,
68  Goddard Space Flight Center, under contract NAS5-32373.
69 
70 References and Credits
71 
72 !END*********************************************************************/
73 
74 #define LOCALVERSIONID_LUN 600001
75 #define PGEVERSION_LUN 800500
76 #define PROCESSINGENVIRONMENT_LUN 800550
77 #define REPROCESSINGACTUAL_LUN 800600
78 #define REPROCESSINGPLANNED_LUN 800605
79 
80 {
81  const char *env_list[] = {"OSTYPE", "HOST", "REVISION", "MACHINE"};
82 #define NUM_ENVS (sizeof env_list/sizeof env_list[0])
83  const char *val;
84  int env;
85  char msgbuf[128] = "";
86  PGSt_SMF_status retval=PGS_S_SUCCESS;
87  char filefunc[] = __FILE__ ", GEO_get_version_metadata";
88 
89  if (version_metadata == NULL){
90  modsmf(MODIS_E_BAD_INPUT_ARG, ".", filefunc);
91  return MODIS_E_BAD_INPUT_ARG;
92  }
93 
94  (void)strncpy(version_metadata->processversion, PROCESSVERSION,
95  sizeof(PROCESSVERSION));
96 
97  if(PGS_PC_GetConfigData(LOCALVERSIONID_LUN,version_metadata->localversionid)
98  != PGS_S_SUCCESS)
99  {
100  sprintf(msgbuf, "PGS_PC_GetConfigData(%d)", LOCALVERSIONID_LUN);
101  modsmf(MODIS_E_GEO, msgbuf, filefunc);
102  version_metadata->localversionid[0] = '\0';
103  retval = MODIS_E_GEO;
104  }
105 
106  if(PGS_PC_GetConfigData(PGEVERSION_LUN,version_metadata->pgeversion)
107  != PGS_S_SUCCESS)
108  {
109  sprintf(msgbuf, "PGS_PC_GetConfigData(%d)", PGEVERSION_LUN);
110  modsmf(MODIS_E_GEO, msgbuf, filefunc);
111  version_metadata->pgeversion[0] = '\0';
112  retval = MODIS_E_GEO;
113  }
114 
115  if(PGS_PC_GetConfigData(PROCESSINGENVIRONMENT_LUN,
116  version_metadata->processingenvironment) != PGS_S_SUCCESS)
117  {
118  version_metadata->processingenvironment[0] = '\0';
119  for(env=0; env<NUM_ENVS; env++)
120  {
121  val = getenv(env_list[env]);
122  if(val)
123  {
124  if(version_metadata->processingenvironment[0])
125  strncat(version_metadata->processingenvironment, " ",
126  sizeof(version_metadata->processingenvironment));
127  strncat(version_metadata->processingenvironment, val,
128  sizeof(version_metadata->processingenvironment));
129  }
130  }
131  version_metadata->processingenvironment
132  [sizeof(version_metadata->processingenvironment)-1] = '\0';
133  }
134 
135  if(PGS_PC_GetConfigData(REPROCESSINGACTUAL_LUN,
136  version_metadata->reprocessingactual) != PGS_S_SUCCESS)
137  {
138  sprintf(msgbuf, "PGS_PC_GetConfigData(%d)", REPROCESSINGACTUAL_LUN);
139  modsmf(MODIS_E_GEO, msgbuf, filefunc);
140  version_metadata->reprocessingactual[0] = '\0';
141  retval = MODIS_E_GEO;
142  }
143 
144  if(PGS_PC_GetConfigData(REPROCESSINGPLANNED_LUN,
145  version_metadata->reprocessingplanned) != PGS_S_SUCCESS)
146  {
147  sprintf(msgbuf, "PGS_PC_GetConfigData(%d)", REPROCESSINGPLANNED_LUN);
148  modsmf(MODIS_E_GEO, msgbuf, filefunc);
149  version_metadata->reprocessingplanned[0] = '\0';
150  retval = MODIS_E_GEO;
151  }
152 
153  return retval;
154 }
#define NULL
Definition: decode_rs.h:63
#define MODIS_E_BAD_INPUT_ARG
char processingenvironment[PGSd_PC_VALUE_LENGTH_MAX]
char reprocessingplanned[PGSd_PC_VALUE_LENGTH_MAX]
#define REPROCESSINGACTUAL_LUN
#define PROCESSINGENVIRONMENT_LUN
#define REPROCESSINGPLANNED_LUN
#define MODIS_E_GEO
#define PGEVERSION_LUN
#define LOCALVERSIONID_LUN
#define PROCESSVERSION
Definition: version.h:112
PGSt_SMF_status GEO_get_version_metadata(version_metadata_struct *version_metadata)
def env(self)
Definition: setupenv.py:7
#define NUM_ENVS
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second and prod_ix set to PARAM_TYPE_INT name_prefix is compared with the beginning of the product name If name_suffix is not empty the it must match the end of the product name The characters right after the prefix are read as an integer and prod_ix is set to that number strncpy(l2prod->name_prefix, "myprod", UNITLEN)
char reprocessingactual[PGSd_PC_VALUE_LENGTH_MAX]
msiBandIdx val
Definition: l1c_msi.cpp:34