OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
Generate_NetCDF4_Luts.cpp
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: Generate_NetCDF4_Luts.cpp
4  *
5  * DESCRIPTION: Source file for generating netCDF4 LUTs from contents of PCF file.
6  *
7  *
8  * REFERENCES:
9  *
10  * REVISION HISTORY:
11  * DATE: PR# AUTHOR Description
12  * -------- ------ -------- -----------------
13  * 06-15-2015 S. Anderson
14  * 10-15-2015 S. Anderson Generation of time-dependent netCDF4 LUTs
15  *
16  * NOTES (MISCELLANEOUS) SECTION:
17  * none
18  *
19  **************************************************************************/
20 
21 #include <string>
22 #include <sstream>
23 #include "generate_nc4luts.h"
24 #include "VcstLutNetCDF4.h"
25 #include <libgen.h>
26 #include <genutils.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);
44  if (argc == 1) {
46  exit(1);
47  }
49 
50  if (clo_getBool(list, "verbose"))
51  want_verbose = 1;
52  else
53  want_verbose = 0;
54 
55  VcstLutNetCDF4* generator = new VcstLutNetCDF4();
56  generator->setHistory(VL1_get_history(argc, argv));
57 
58  string str_platform = VL1_get_group(VIIRS_PLATFORM);
59 
60  status = generator->initialize( str_platform );
61 
62  if (status != VCST_SUCCESS) {
63  return (status);
64  }
65 
66  int score = 0;
67  status = generator->create_cmngeo_lut();
68 
69  if (status != VCST_SUCCESS) {
70  cerr << "WARNING!!! Common Geolocation LUT NOT created"
71  << endl;
72  } else {
73  score++;
74  cerr << "\nNetCDF4 Common Geolocation LUT created" << endl;
75  }
76 
77  status = generator->create_geo_lut();
78 
79  if (status != VCST_SUCCESS) {
80  cerr << "WARNING!!! Geolocation LUT NOT created"
81  << endl;
82  } else {
83  score++;
84  cerr << "NetCDF4 Geolocation LUT created" << endl;
85  }
86 
87  status = generator->create_cal_static_lut();
88 
89  if (status != VCST_SUCCESS) {
90  cerr << "WARNING!!! Static Calibration LUT NOT created"
91  << endl;
92  } else {
93  score++;
94  cerr << "NetCDF4 Calibration LUT created" << endl;
95  }
96 
97  status = generator->create_rsb_dynamic_lut();
98 
99  if (status != VCST_SUCCESS) {
100  cerr
101  << "WARNING!!! Dynamic RSB Calibration LUT NOT created"
102  << endl;
103  } else {
104  score++;
105  cerr << "NetCDF4 Dynamic RSB Calibration LUT created" << endl;
106  }
107 
108  status = generator->create_dnb_dynamic_lut();
109 
110  if (status != VCST_SUCCESS) {
111  cerr
112  << "WARNING!!! Dynamic DNB Calibration LUT NOT created"
113  << endl;
114  } else {
115  score++;
116  cerr << "NetCDF4 Dynamic DNB Calibration LUT created" << endl;
117  }
118 
119  status = generator->create_straylight_dynamic_lut();
120 
121  if (status != VCST_SUCCESS) {
122  cerr
123  << "WARNING!!! Dynamic DNB Stray Light LUT NOT created"
124  << endl;
125  } else {
126  score++;
127  cerr << "NetCDF4 Dynamic DNB Stray Light LUT created" << endl;
128  }
129 
130  delete generator;
131 
132  stringstream ss;
133  ss << score;
134  string str =ss.str();
135  cerr << "\n" << str << " of 6 NetCDF4 LUTs created. \n" << endl;
136 
137  return (status);
138 }
139 
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
int main(int argc, char *argv[])
void clo_setEnablePositionOptions(int val)
Definition: clo.c:1685
void generate_nc4luts_read_options(clo_optionList_t *list, int argc, char *argv[])
void score(float xf, float y[], float f[])
void generate_nc4luts_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 clo_printUsage(clo_optionList_t *list)
Definition: clo.c:1988
int want_verbose
void setHistory(std::string history)
std::string VL1_get_group(const std::string &group)
int create_straylight_dynamic_lut()
const char * str
Definition: l1c_msi.cpp:35
const std::string VIIRS_PLATFORM
int clo_getBool(clo_optionList_t *list, const char *key)
Definition: clo.c:1375
int initialize(string platform)