Skip to content

Commit

Permalink
Per #1527, since the CommandLine class now handles the -v and -log op…
Browse files Browse the repository at this point in the history
…tions directly, remove them from all of the MET applications, including ensemble_stat, grid_stat, mode, mode_analysis, pcp_combine, point_stat, series_analysis, wavelet_stat, gen_climo_bin, ascii2nc, gen_vx_mask, grid_diag, gsid2mpr, gsidens2orank, lidar2nc, madis2nc, plot_mode_field, mtd, modis_regrid, pb2nc, plot_data_plane, plot_point_obs, point2grid, regrid_data_plane, shift_data_plane, wwmca_plot, wwmca_regrid, rmw_analysis, tc_dland, tc_gen, tc_pairs, tc_rmw, and tc_stat.
  • Loading branch information
JohnHalleyGotway committed Oct 26, 2020
1 parent aa74d36 commit 9f89878
Show file tree
Hide file tree
Showing 36 changed files with 77 additions and 850 deletions.
8 changes: 0 additions & 8 deletions met/internal_tests/basic/vx_util/test_ascii_header.cc
Expand Up @@ -31,7 +31,6 @@ StringArray ColNames;
IntArray ColOffsets;
int Dim = 0;

static void set_verbosity (const StringArray &);
static void set_name (const StringArray &);
static void set_offset (const StringArray &);
static void set_dim (const StringArray &);
Expand All @@ -50,7 +49,6 @@ int main(int argc, char * argv []) {
cline.add(set_name, "-name", 1);
cline.add(set_offset, "-offset", -1);
cline.add(set_dim, "-dim", 1);
cline.add(set_verbosity, "-v", 1);
cline.parse();

// Check for required arguments: version, data_type, line_type
Expand Down Expand Up @@ -106,12 +104,6 @@ void usage() {

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a) {
mlog.set_verbosity_level(atoi(a[0].c_str()));
}

////////////////////////////////////////////////////////////////////////

void set_name(const StringArray & a) {
ColNames.add_css(a[0]);
}
Expand Down
22 changes: 0 additions & 22 deletions met/src/tools/core/ensemble_stat/ensemble_stat.cc
Expand Up @@ -155,8 +155,6 @@ static void set_ens_mean(const StringArray & a);
static void set_obs_valid_beg(const StringArray &);
static void set_obs_valid_end(const StringArray &);
static void set_outdir(const StringArray &);
static void set_logfile(const StringArray &);
static void set_verbosity(const StringArray &);
static void set_compress(const StringArray &);

////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -220,8 +218,6 @@ void process_command_line(int argc, char **argv) {
cline.add(set_obs_valid_beg, "-obs_valid_beg", 1);
cline.add(set_obs_valid_end, "-obs_valid_end", 1);
cline.add(set_outdir, "-outdir", 1);
cline.add(set_logfile, "-log", 1);
cline.add(set_verbosity, "-v", 1);
cline.add(set_compress, "-compress", 1);

//
Expand Down Expand Up @@ -3217,24 +3213,6 @@ void set_outdir(const StringArray & a)

////////////////////////////////////////////////////////////////////////

void set_logfile(const StringArray & a)
{
ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);
}

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a)
{
mlog.set_verbosity_level(atoi(a[0].c_str()));
}

////////////////////////////////////////////////////////////////////////

void set_compress(const StringArray & a)
{
compress_level = atoi(a[0].c_str());
Expand Down
24 changes: 2 additions & 22 deletions met/src/tools/core/grid_stat/grid_stat.cc
Expand Up @@ -173,8 +173,6 @@ static void clean_up();

static void usage();
static void set_outdir(const StringArray &);
static void set_logfile(const StringArray &);
static void set_verbosity(const StringArray &);
static void set_compress(const StringArray &);
static bool read_data_plane(VarInfo* info, DataPlane& dp, Met2dDataFile* mtddf,
const ConcatString &filename);
Expand Down Expand Up @@ -219,10 +217,8 @@ void process_command_line(int argc, char **argv) {
cline.set_usage(usage);

// Add the options function calls
cline.add(set_outdir, "-outdir", 1);
cline.add(set_logfile, "-log", 1);
cline.add(set_verbosity, "-v", 1);
cline.add(set_compress, "-compress", 1);
cline.add(set_outdir, "-outdir", 1);
cline.add(set_compress, "-compress", 1);

// Parse the command line
cline.parse();
Expand Down Expand Up @@ -2958,22 +2954,6 @@ void set_outdir(const StringArray & a) {

////////////////////////////////////////////////////////////////////////

void set_logfile(const StringArray & a) {
ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);
}

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a) {
mlog.set_verbosity_level(atoi(a[0].c_str()));
}

////////////////////////////////////////////////////////////////////////

void set_compress(const StringArray & a) {
compress_level = atoi(a[0].c_str());
}
Expand Down
26 changes: 2 additions & 24 deletions met/src/tools/core/mode/mode.cc
Expand Up @@ -116,9 +116,7 @@ static void usage();

static void set_config_merge_file (const StringArray &);
static void set_outdir (const StringArray &);
static void set_logfile (const StringArray &);
static void set_verbosity (const StringArray &);
static void set_compress(const StringArray &);
static void set_compress (const StringArray &);


///////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -280,9 +278,7 @@ void process_command_line(int argc, char **argv)
// Add the options function calls
cline.add(set_config_merge_file, "-config_merge", 1);
cline.add(set_outdir, "-outdir", 1);
cline.add(set_logfile, "-log", 1);
cline.add(set_verbosity, "-v", 1);
cline.add(set_compress, "-compress", 1);
cline.add(set_compress, "-compress", 1);

// Parse the command line
cline.parse();
Expand Down Expand Up @@ -363,24 +359,6 @@ void set_outdir(const StringArray & a)

////////////////////////////////////////////////////////////////////////

void set_logfile(const StringArray & a)
{
ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);
}

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a)
{
mlog.set_verbosity_level(atoi(a[0].c_str()));
}

////////////////////////////////////////////////////////////////////////

void set_compress(const StringArray & a) {
compress_level = atoi(a[0].c_str());
}
Expand Down
34 changes: 0 additions & 34 deletions met/src/tools/core/mode_analysis/mode_analysis.cc
Expand Up @@ -89,8 +89,6 @@ static void set_column_name(const StringArray &);
static void set_dump_row(const StringArray &);
static void set_out_filename(const StringArray &);
static void set_config_filename(const StringArray &);
static void set_logfile(const StringArray &);
static void set_verbosity(const StringArray & a);

static void set_summary ();
static void set_bycase ();
Expand Down Expand Up @@ -241,8 +239,6 @@ cline.add(set_column_name, "-column", 1);
cline.add(set_dump_row, "-dump_row", 1);
cline.add(set_out_filename, "-out", 1);
cline.add(set_config_filename, "-config", 1);
cline.add(set_logfile, "-log", 1);
cline.add(set_verbosity, "-v", 1);

//
// parse the command line
Expand Down Expand Up @@ -686,33 +682,3 @@ return;


////////////////////////////////////////////////////////////////////////


void set_logfile(const StringArray & a)

{

ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);

return;

}


////////////////////////////////////////////////////////////////////////


void set_verbosity(const StringArray & a)
{

mlog.set_verbosity_level(atoi(a[0].c_str()));

return;

}

////////////////////////////////////////////////////////////////////////
28 changes: 1 addition & 27 deletions met/src/tools/core/pcp_combine/pcp_combine.cc
Expand Up @@ -122,7 +122,6 @@ enum RunCommand { sum = 0, add = 1, sub = 2, der = 3 };

// Variables for top-level command line arguments
static RunCommand run_command = sum;
static int verbosity = 2;

// Variables common to all commands
static int n_files;
Expand Down Expand Up @@ -190,8 +189,6 @@ static void set_sum(const StringArray &);
static void set_add(const StringArray &);
static void set_subtract(const StringArray &);
static void set_derive(const StringArray &);
static void set_logfile(const StringArray &);
static void set_verbosity(const StringArray &);
static void set_pcpdir(const StringArray &);
static void set_pcprx(const StringArray &);
static void set_field(const StringArray & a);
Expand Down Expand Up @@ -291,20 +288,13 @@ void process_command_line(int argc, char **argv) {
cline.add(set_name, "-name", 1);
cline.add(set_name, "-varname", 1);
cline.add(set_vld_thresh, "-vld_thresh", 1);
cline.add(set_logfile, "-log", 1);
cline.add(set_verbosity, "-v", 1);
cline.add(set_compress, "-compress", 1);

//
// Parse the command line.
//
cline.parse();

//
// Set the verbosity level.
//
mlog.set_verbosity_level(verbosity);

//
// Process the specific command arguments.
//
Expand Down Expand Up @@ -1542,7 +1532,7 @@ void usage() {
<< "(optional).\n"

<< "\t\t\"-v level\" overrides the default level of logging ("
<< verbosity << ") (optional).\n"
<< mlog.verbosity_level() << ") (optional).\n"

<< "\t\t\"-compress level\" overrides the compression level of "
<< "NetCDF variable (" << config.nc_compression()
Expand Down Expand Up @@ -1659,22 +1649,6 @@ void set_derive(const StringArray & a) {

////////////////////////////////////////////////////////////////////////

void set_logfile(const StringArray & a) {
ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);
}

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a) {
verbosity = atoi(a[0].c_str());
}

////////////////////////////////////////////////////////////////////////

void set_pcpdir(const StringArray & a) {
pcp_dir.add(a);
}
Expand Down
22 changes: 0 additions & 22 deletions met/src/tools/core/point_stat/point_stat.cc
Expand Up @@ -155,8 +155,6 @@ static void set_ncfile(const StringArray &);
static void set_obs_valid_beg_time(const StringArray &);
static void set_obs_valid_end_time(const StringArray &);
static void set_outdir(const StringArray &);
static void set_logfile(const StringArray &);
static void set_verbosity(const StringArray &);

////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -217,8 +215,6 @@ void process_command_line(int argc, char **argv) {
cline.add(set_obs_valid_beg_time, "-obs_valid_beg", 1);
cline.add(set_obs_valid_end_time, "-obs_valid_end", 1);
cline.add(set_outdir, "-outdir", 1);
cline.add(set_logfile, "-log", 1);
cline.add(set_verbosity, "-v", 1);

// Parse the command line
cline.parse();
Expand Down Expand Up @@ -2189,21 +2185,3 @@ void set_outdir(const StringArray & a)
}

////////////////////////////////////////////////////////////////////////

void set_logfile(const StringArray & a)
{
ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);
}

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a)
{
mlog.set_verbosity_level(atoi(a[0].c_str()));
}

////////////////////////////////////////////////////////////////////////
33 changes: 7 additions & 26 deletions met/src/tools/core/series_analysis/series_analysis.cc
Expand Up @@ -111,8 +111,6 @@ static void set_both_files(const StringArray &);
static void set_paired(const StringArray &);
static void set_out_file(const StringArray &);
static void set_config_file(const StringArray &);
static void set_log_file(const StringArray &);
static void set_verbosity(const StringArray &);
static void set_compress(const StringArray &);

static void parse_long_names();
Expand Down Expand Up @@ -159,8 +157,6 @@ void process_command_line(int argc, char **argv) {
cline.add(set_paired, "-paired", 0);
cline.add(set_config_file, "-config", 1);
cline.add(set_out_file, "-out", 1);
cline.add(set_log_file, "-log", 1);
cline.add(set_verbosity, "-v", 1);
cline.add(set_compress, "-compress", 1);

// Parse the command line
Expand All @@ -169,6 +165,13 @@ void process_command_line(int argc, char **argv) {
// Check for error. There should be zero arguments left.
if(cline.n() != 0) usage();

// Warn about log output
if(mlog.verbosity_level() >= 3) {
mlog << Warning << "\nRunning Series-Analysis at verbosity >= 3 "
<< "produces excessive log output and can slow the runtime "
<< "considerably.\n\n";
}

// Check that the required arguments have been set.
if(fcst_files.n() == 0) {
mlog << Error << "\nprocess_command_line() -> "
Expand Down Expand Up @@ -2285,28 +2288,6 @@ void set_config_file(const StringArray & a) {

////////////////////////////////////////////////////////////////////////

void set_log_file(const StringArray & a) {
ConcatString filename;

filename = a[0];

mlog.open_log_file(filename);
}

////////////////////////////////////////////////////////////////////////

void set_verbosity(const StringArray & a) {
mlog.set_verbosity_level(atoi(a[0].c_str()));

if(mlog.verbosity_level() >= 3) {
mlog << Warning << "\nRunning Series-Analysis at verbosity >= 3 "
<< "produces excessive log output and can slow the runtime "
<< "considerably.\n\n";
}
}

////////////////////////////////////////////////////////////////////////

void set_compress(const StringArray & a) {
compress_level = atoi(a[0].c_str());
}
Expand Down

0 comments on commit 9f89878

Please sign in to comment.