OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
Generate_OBC.cpp
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: Generate_OBC.cpp
4  *
5  * DESCRIPTION: Source file for application to generate OBC file.
6  *
7  *
8  * REFERENCES:
9  *
10  * REVISION HISTORY:
11  * DATE: PR# AUTHOR Description
12  * -------- ------ -------- -----------------
13  * 12-29-2014 S. Anderson
14  *
15  * NOTES (MISCELLANEOUS) SECTION:
16  * none
17  *
18  **************************************************************************/
19 #include "viirs_obc.h"
20 
21 #include <VcstParamsReader.h>
22 #include <VcstCmnConsts.h>
23 #include <libgen.h>
24 #include <genutils.h>
25 #include <VcstCmnGeo.h>
26 #include <VcstObc.h>
27 
28 //-----------------------------------------------------------------------------
29 //
30 // Main Function
31 //
32 //-----------------------------------------------------------------------------
33 
34 int main(int argc, char* argv[]) {
35  int status = 0;
36 
39 
40  //char softwareVersion[200];
41  //sprintf(softwareVersion, "%d.%d.%d-r%d", L3MAPGEN_VERSION_MAJOR, L3MAPGEN_VERSION_MINOR,
42  // L3MAPGEN_VERSION_PATCH_LEVEL, SVN_REVISION);
43  viirs_obc_init_options(list, "3.2.2");
44  if (argc == 1) {
46  exit(1);
47  }
48  viirs_obc_read_options(list, argc, argv);
49 
50  if (clo_getBool(list, "verbose"))
51  want_verbose = 1;
52  else
53  want_verbose = 0;
54 
55  VcstObc* vcstObc = new VcstObc();
56  vcstObc->history_ = VL1_get_history(argc, argv);
57 
58  vector<string> sourcesList;
59  sourcesList.push_back("static_lut_file");
60  sourcesList.push_back("rsb_dynamic_lut_file");
61  sourcesList.push_back("cmn_lut_file");
62  sourcesList.push_back("polar_wander_file");
63  vcstObc->source_files_ = VL1_get_source(sourcesList);
64  vcstObc->setFilters(true);
65 
66  status = vcstObc->initialize(CURRENT);
67  if (status != VCST_SUCCESS) {
68  std::cerr << "Main:: OBC initialization failure" << std::endl;
69  exit(EXIT_FAILURE);
70  }
71 
72  status = vcstObc->process_bands();
73  if (status != VCST_SUCCESS) {
74  std::cerr << "Main:: OBC processing failure" << std::endl;
75  exit(EXIT_FAILURE);
76  }
77 
78  status = vcstObc->write_obc_data();
79  if (status != VCST_SUCCESS) {
80  std::cerr << "Main:: OBC file write failure" << std::endl;
81  exit(EXIT_FAILURE);
82  }
83 
84  delete vcstObc;
85 
86  std::cerr << "OBC data processed for " << VL1_get_option("obcfile") << "\n"
87  << std::endl;
88 
89  return (status);
90 }
91 
const void setFilters(const bool bFilters)
Definition: VcstObc.h:395
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 write_obc_data()
string history_
Definition: VcstObc.h:60
int process_bands()
int initialize(GRAN_SEQ_ENUM gran_seq)
std::string VL1_get_history(int argc, char *argv[])
clo_optionList_t * clo_createList()
Definition: clo.c:532
void viirs_obc_read_options(clo_optionList_t *list, int argc, char *argv[])
void viirs_obc_init_options(clo_optionList_t *list, const char *softwareVersion)
void clo_printUsage(clo_optionList_t *list)
Definition: clo.c:1988
int want_verbose
@ CURRENT
int main(int argc, char *argv[])
string source_files_
Definition: VcstObc.h:61
int clo_getBool(clo_optionList_t *list, const char *key)
Definition: clo.c:1375
std::string VL1_get_option(const std::string &name)