OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
afrt_phs.cpp
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * NAME: afrt_phs.cpp
4 *
5 * DESCRIPTION: Source file to run Ahmad Frazier Top Of Atmosphere calculation
6 *
7 * REFERENCES:
8 *
9 * REVISION HISTORY:
10 * DATE: PR# AUTHOR Description
11 * -------- ------ -------- -----------------
12 * 05-02-2018 S. Anderson
13 *
14 * NOTES (MISCELLANEOUS) SECTION:
15 * none
16 *
17 **************************************************************************/
18 
19 #include <genutils.h>
20 #include <AfrtOptions.h>
21 #include <AfrtProcess.h>
22 #include <afrt_input.h>
23 
24 //-----------------------------------------------------------------------------
25 //
26 // Main Function
27 //
28 //-----------------------------------------------------------------------------
29 
30 int main(int argc, char* argv[])
31 {
32  int status = 0;
33 
36 
37  //char softwareVersion[200];
38  //sprintf(softwareVersion, "%d.%d.%d-r%d", L3MAPGEN_VERSION_MAJOR, L3MAPGEN_VERSION_MINOR,
39  // L3MAPGEN_VERSION_PATCH_LEVEL, SVN_REVISION);
40  afrt_init_options(list, "2.0");
41  if(argc == 1) {
43  exit(1);
44  }
45  afrt_read_options(list, argc, argv);
46 
47  if(clo_getBool(list, "verbose"))
48  want_verbose = 1;
49  else
50  want_verbose = 0;
51 
52  AfrtProcess* generator = new AfrtProcessPhs();
53  generator->setHistory(afrt_get_history(argc, argv));
54 
55  status = generator->initialize();
56 
57  if ( status != RT_SUCCESS ) {
58  return(status);
59  }
60 
61  status = generator->process();
62 
63  if ( status != RT_SUCCESS ) {
64  return(status);
65  }
66 
68  NcFile* nc_output = generator->open_nc4(ofile);
69  if (nc_output == 0L) {
70  std::cerr << "Failed to open NetCDF output file" << std::endl;
71  status = RT_FAIL;
72  } else {
73  status = generator->write_nc4(nc_output);
74  delete nc_output;
75  }
76  delete generator;
77 
78  if ( status != RT_SUCCESS ) {
79  std::cerr << "PHS NetCDF tables NOT created" << std::endl;
80  } else {
81  std::cerr << "\nPHS NetCDF tables created. \n" << std::endl;
82  }
83 
84  return(status);
85 }
86 
virtual int initialize()
int main(int argc, char *argv[])
Definition: afrt_phs.cpp:30
int status
Definition: l1_czcs_hdf.c:32
#define L(lambda, T)
Definition: PreprocessP.h:185
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
NcFile * open_nc4(string ofile)
virtual int write_nc4(NcFile *ncout)
clo_optionList_t * clo_createList()
Definition: clo.c:532
std::string afrt_get_option(const std::string &name)
const int RT_FAIL
Definition: AfrtConstants.h:35
void clo_printUsage(clo_optionList_t *list)
Definition: clo.c:1988
const int RT_SUCCESS
Definition: AfrtConstants.h:34
int want_verbose
void afrt_read_options(clo_optionList_t *list, int argc, char *argv[])
Definition: afrt_input.cpp:54
const std::string OFILE_PHS
Definition: AfrtOptions.cpp:46
void afrt_init_options(clo_optionList_t *list, const char *softwareVersion)
Definition: afrt_input.cpp:20
string afrt_get_history(int argc, char *argv[])
virtual int process()
int clo_getBool(clo_optionList_t *list, const char *key)
Definition: clo.c:1375
void setHistory(std::string history)
Definition: AfrtProcess.h:516