35#include <libdap/util.h>
37#include <TheBESKeys.h>
40#include <BESInternalFatalError.h>
41#include "build_dmrpp_util.h"
46using namespace build_dmrpp_util;
48#define DEBUG_KEY "metadata_store,dmrpp_store,dmrpp"
51 const char *help = R
"(
52 build_dmrpp -h: Show this help
54 build_dmrpp -V: Show build versions for components that make up the program
56 build_dmrpp -f <data file> -r <dmr file> [-u <href url>] [-c <bes conf file>] [-M] [-D] [-v] [-d]
59 -f: HDF5 file to build DMR++ from
60 -r: DMR file to build DMR++ from
61 -u: The href value to use in the DMR++ for the data file
62 -c: The BES configuration file used to create the DMR file
63 -M: Add production metadata to the built DMR++
64 -D: Disable Direct IO feature
66 -v: Verbose HDF5 errors
67 -V: Show build versions for components that make up the program
68 -d: Turn on BES software debugging output)";
79int main(
int argc,
char *argv[]) {
83 string dmrpp_href_value;
84 string bes_conf_file_used_to_create_dmr;
85 bool add_production_metadata =
false;
86 bool disable_dio =
false;
89 while ((option_char = getopt(argc, argv,
"c:f:r:u:dhvVMD")) != -1) {
90 switch (option_char) {
92 cerr << basename(argv[0]) <<
"-" << CVER <<
" (bes-"<< CVER <<
", " << libdap_name() <<
"-"
93 << libdap_version() <<
")" << endl;
101 build_dmrpp_util::verbose =
true;
109 h5_file_name = optarg;
113 dmr_filename = optarg;
117 dmrpp_href_value = optarg;
121 bes_conf_file_used_to_create_dmr = optarg;
125 add_production_metadata =
true;
139 qc_input_file(h5_file_name);
141 if (dmr_filename.empty()) {
143 msg <<
"A DMR file for the granule '" << h5_file_name <<
" must also be provided." << endl;
148 build_dmrpp_from_dmr_file(
152 add_production_metadata,
153 bes_conf_file_used_to_create_dmr,
158 cerr <<
"ERROR Caught BESError. message: " << e.
get_message() << endl;
161 catch (
const std::exception &e) {
162 cerr <<
"ERROR Caught std::exception. what: " << e.what() << endl;
166 cerr <<
"ERROR Caught 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