34#include <libdap/util.h>
36#include <TheBESKeys.h>
39#include <BESInternalFatalError.h>
41#include "build_dmrpp_util_h4.h"
47using namespace build_dmrpp_util_h4;
50#define DEBUG_KEY "metadata_store,dmrpp_store,dmrpp"
53 const char *help = R
"(
54 build_dmrpp -h: Show this help
56 build_dmrpp -V: Show build versions for components that make up the program
58 build_dmrpp -f <data file> -r <dmr file> [-u <href url>]: As above, but uses the DMR
59 read from the given file.
63 -d: Turn on BES software debugging output
64 -M: Add information about the build_dmrpp software, incl versions, to the built DMR++
65 -D: Disable the generation of HDF-EOS2/HDF4 missing latitude/longitude)";
76int main(
int argc,
char *argv[]) {
80 string dmrpp_href_value;
81 string bes_conf_file_used_to_create_dmr;
82 bool add_production_metadata =
false;
83 bool disable_missing_data =
false;
86 while ((option_char = getopt(argc, argv,
"c:f:r:u:dhvVMD")) != -1) {
87 switch (option_char) {
89 cerr << basename(argv[0]) <<
"-" << CVER <<
" (bes-"<< CVER <<
", " << libdap_name() <<
"-"
90 << libdap_version() <<
")" << endl;
94 build_dmrpp_util_h4::verbose =
true;
102 h4_file_name = optarg;
106 dmr_filename = optarg;
110 dmrpp_href_value = optarg;
114 bes_conf_file_used_to_create_dmr = optarg;
118 add_production_metadata =
true;
122 disable_missing_data =
true;
139 qc_input_file(h4_file_name);
141 if (dmr_filename.empty()){
143 msg <<
"A DMR file for the granule '" << h4_file_name <<
"' must also be provided." << endl;
149 build_dmrpp_from_dmr_file(
153 add_production_metadata,
154 disable_missing_data,
155 bes_conf_file_used_to_create_dmr,
159 string command =
"./h4mapwriter/h4mapwriter " + h4_file_name;
160 system(command.c_str());
169 catch (
const std::exception &e) {
170 cerr <<
"std::exception: " << e.what() << endl;
174 cerr <<
"Unknown error." << endl;
static void SetUp(const std::string &values)
Sets up debugging for the bes.
Base exception class for the BES with basic string message.
std::string get_message() const
get the error message for this exception
exception thrown if an internal error is found and is fatal to the BES