OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
Geolocate_Viirs_Driver.cpp
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: Geolocate_Viirs_Driver.cpp
4  *
5  * DESCRIPTION: Source file for calibration wrapper application designed to read in L1A file, perform
6  * calibration, and write out results.
7  *
8  *
9  * REFERENCES:
10  *
11  * REVISION HISTORY:
12  * DATE: PR# AUTHOR Description
13  * -------- ------ -------- -----------------
14  * 01-29-2015 S. Anderson
15  *
16  * NOTES (MISCELLANEOUS) SECTION:
17  * none
18  *
19  **************************************************************************/
20 #include "geolocate_viirs.h"
21 
22 #include <VcstViirsGeo.h>
23 #include <VcstParamsReader.h>
24 #include <VcstCmnConsts.h>
25 #include <VcstLogger.h>
26 #include <libgen.h>
27 #include <genutils.h>
28 
29 //-----------------------------------------------------------------------------
30 //
31 // Main Function
32 //
33 //-----------------------------------------------------------------------------
34 
35 int main(int argc, char* argv[]) {
36 
37  int status = 0;
38 
41 
42  //char softwareVersion[200];
43  //sprintf(softwareVersion, "%d.%d.%d-r%d", L3MAPGEN_VERSION_MAJOR, L3MAPGEN_VERSION_MINOR,
44  // L3MAPGEN_VERSION_PATCH_LEVEL, SVN_REVISION);
46  if (argc == 1) {
48  exit(1);
49  }
50 
52 
53  if (!clo_isSet(list, "geofile_img")
54  && !clo_isSet(list, "geofile_mod")
55  && !clo_isSet(list, "geofile_dnb")) {
56  std::cerr << "-E- At least one output geofile (geofile_img, geofile_mod or geofile_dnb)\n should be specified." << endl;
57  exit(EXIT_FAILURE);
58  }
59  if (clo_isSet(list, "geofile_dnb") && !clo_isSet(list, "geofile_img")) {
60  std::cerr << "-E- Sorry, you must also output a geofile_img to make a geofile_dnb." << endl;
61  exit(EXIT_FAILURE);
62  }
63 
64  if (clo_getBool(list, "verbose"))
65  want_verbose = 1;
66  else
67  want_verbose = 0;
68 
69  std::cerr << "\nMain:: Geolocating L1A " << VL1_get_option("ifile") << std::endl;
70 
71  VcstViirsGeo* vcstGeo = new VcstViirsGeo();
72  vcstGeo->history_ = VL1_get_history(argc, argv);
73 
74  vector<string> sourcesList;
75  sourcesList.push_back("cmn_lut_file");
76  sourcesList.push_back("geo_lut_file");
77  sourcesList.push_back("polar_wander_file");
78  vcstGeo->source_files_ = VL1_get_source(sourcesList);
79 
80  status = vcstGeo->initialize();
81  if (status != VCST_SUCCESS) {
82  std::cerr << "Main::Geolocation initialization failure" << std::endl;
83  exit(EXIT_FAILURE);
84  }
85 
86  status = vcstGeo->geolocate();
87  if (status != VCST_SUCCESS) {
88  std::cerr << "Main:: Geolocation processing failure for " << argv[1] << std::endl;
89  exit(EXIT_FAILURE);
90  }
91 
92  delete vcstGeo;
93 
94  std::cerr << "Geolocation completed.\n" << std::endl;
95 
96  return (status);
97 }
98 
const int VCST_SUCCESS
Definition: VcstCmnConsts.h:46
int status
Definition: l1_czcs_hdf.c:32
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
Definition: CMakeLists.txt:7
void clo_setEnablePositionOptions(int val)
Definition: clo.c:1685
std::string VL1_get_source(std::vector< std::string > sourcesList)
int clo_isSet(clo_optionList_t *list, const char *key)
Definition: clo.c:2270
void geolocate_viirs_init_options(clo_optionList_t *list, const char *softwareVersion)
std::string VL1_get_history(int argc, char *argv[])
clo_optionList_t * clo_createList()
Definition: clo.c:532
void geolocate_viirs_read_options(clo_optionList_t *list, int argc, char *argv[])
void clo_printUsage(clo_optionList_t *list)
Definition: clo.c:1988
int main(int argc, char *argv[])
int want_verbose
string source_files_
Definition: VcstViirsGeo.h:184
int initialize()
int clo_getBool(clo_optionList_t *list, const char *key)
Definition: clo.c:1375
string history_
Definition: VcstViirsGeo.h:183
std::string VL1_get_option(const std::string &name)