Skip to content

Commit

Permalink
Per #1184, fix parsing problem with optional args preceeding req ones…
Browse files Browse the repository at this point in the history
…. Also, remove stale commented out code.
  • Loading branch information
JohnHalleyGotway committed Mar 10, 2022
1 parent db2debf commit 4814d72
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 105 deletions.
91 changes: 0 additions & 91 deletions met/src/libcode/vx_shapedata/mode_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ void ModeConfInfo::init_from_scratch()

{

// Initialize pointers
// fcst_info = (VarInfo *) 0;
// obs_info = (VarInfo *) 0;

N_fields = 0;

Field_Index = 0;
Expand Down Expand Up @@ -95,30 +91,6 @@ void ModeConfInfo::clear()
fcst_multivar_logic.clear();
obs_multivar_logic.clear();

// fcst_conv_radius_array.clear();
// obs_conv_radius_array.clear();

// fcst_conv_radius = bad_data_int;
// obs_conv_radius = bad_data_int;

// fcst_conv_thresh_array.clear();
// obs_conv_thresh_array.clear();

// fcst_merge_thresh_array.clear();
// obs_merge_thresh_array.clear();

// fcst_conv_thresh.clear();
// obs_conv_thresh.clear();

// fcst_vld_thresh = bad_data_double;
// obs_vld_thresh = bad_data_double;

// fcst_filter_attr_map.clear();
// obs_filter_attr_map.clear();

// fcst_merge_flag = MergeType_None;
// obs_merge_flag = MergeType_None;

match_flag = MatchType_None;

max_centroid_dist = bad_data_double;
Expand Down Expand Up @@ -176,11 +148,7 @@ void ModeConfInfo::clear()

quilt = false;


// Deallocate memory
// if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) 0; }
// if(obs_info) { delete obs_info; obs_info = (VarInfo *) 0; }

if ( fcst_array ) { delete [] fcst_array; fcst_array = 0; }
if ( obs_array ) { delete [] obs_array; obs_array = 0; }

Expand Down Expand Up @@ -268,24 +236,12 @@ PlotInfo plot_info;
fcst_dict = conf.lookup_dictionary(conf_key_fcst);
obs_dict = conf.lookup_dictionary(conf_key_obs);


// X
read_fields (fcst_array, fcst_dict, ftype, 'F'); // the order is important here
read_fields ( obs_array, obs_dict, otype, 'O'); // the order is important here

Fcst = fcst_array; // + 0
Obs = obs_array; // + 0

// Allocate new VarInfo objects

// *X fcst_info = info_factory.new_var_info(ftype);
// *X obs_info = info_factory.new_var_info(otype);

// Set the dictionaries

// *X fcst_info->set_dict(*(fcst_dict->lookup_dictionary(conf_key_field)));
// *X obs_info->set_dict(*(obs_dict->lookup_dictionary(conf_key_field)));

// Dump the contents of the VarInfo objects

if(mlog.verbosity_level() >= 5) {
Expand All @@ -310,22 +266,6 @@ PlotInfo plot_info;
}
}

// Conf: fcst.raw_thresh and obs.raw_thresh are deprecated

// *X if ( fcst_dict->lookup(conf_key_raw_thresh) ||
// *X obs_dict->lookup(conf_key_raw_thresh) ) {
// *X mlog << Error << "\nModeConfInfo::process_config() -> "
// *X << "the \"" << conf_key_raw_thresh << "\" entry is deprecated in MET "
// *X << met_version << "! Use \"" << conf_key_censor_thresh << "\" and \""
// *X << conf_key_censor_val << "\" instead.\n\n";
// *X exit(1);
// *X }

// Conf: fcst.conv_radius and obs.conv_radius

// *X fcst_conv_radius_array = fcst_dict->lookup_int_array(conf_key_conv_radius);
// *X obs_conv_radius_array = obs_dict->lookup_int_array(conf_key_conv_radius);

for (j=0; j<N_fields; ++j) {

if ( fcst_array[j].conv_radius_array.n_elements() != obs_array[j].conv_radius_array.n_elements() ) {
Expand Down Expand Up @@ -370,11 +310,6 @@ PlotInfo plot_info;

}

// Conf: fcst.conv_thresh and obs.conv_thresh

// *X fcst_conv_thresh_array = fcst_dict->lookup_thresh_array(conf_key_conv_thresh);
// *X obs_conv_thresh_array = obs_dict->lookup_thresh_array(conf_key_conv_thresh);

for (j=0; j<N_fields; ++j) {

if ( fcst_array[j].conv_thresh_array.n_elements() != obs_array[j].conv_thresh_array.n_elements() ) {
Expand All @@ -388,35 +323,13 @@ PlotInfo plot_info;

}


for (j=0; j<N_fields; ++j) {

if ( fcst_array[j].conv_thresh_array.n_elements() == 1 ) fcst_array[j].conv_thresh = fcst_array[j].conv_thresh_array[0];
if ( obs_array[j].conv_thresh_array.n_elements() == 1 ) obs_array[j].conv_thresh = obs_array[j].conv_thresh_array[0];

}

// Conf: fcst.vld_thresh and obs.vld_thresh

// *X fcst_vld_thresh = fcst_dict->lookup_double(conf_key_vld_thresh);
// *X obs_vld_thresh = obs_dict->lookup_double(conf_key_vld_thresh);

// Conf: fcst.filter_attr_name and fcst.filter_attr_thresh
// obs.filter_attr_name and obs.filter_attr_thresh

// *X fcst_filter_attr_map = parse_conf_filter_attr_map(fcst_dict);
// *X obs_filter_attr_map = parse_conf_filter_attr_map(obs_dict);

// Conf: fcst.merge_flag and obs.merge_flag

// *X fcst_merge_flag = int_to_mergetype(fcst_dict->lookup_int(conf_key_merge_flag));
// *X obs_merge_flag = int_to_mergetype(obs_dict->lookup_int(conf_key_merge_flag));

// Conf: fcst.merge_thresh and obs.merge_thresh

// *X fcst_merge_thresh_array = fcst_dict->lookup_thresh_array(conf_key_merge_thresh);
// *X obs_merge_thresh_array = obs_dict->lookup_thresh_array(conf_key_merge_thresh);

for (j=0; j<N_fields; ++j) {

if ( fcst_array[j].need_merge_thresh() && (fcst_array[j].merge_thresh_array.n_elements() != fcst_array[j].conv_thresh_array.n_elements()) ) {
Expand Down Expand Up @@ -598,13 +511,10 @@ PlotInfo plot_info;

// Conf: fcst_raw_plot

// *X
fcst_array->raw_pi = parse_conf_plot_info(conf.lookup_dictionary(conf_key_fcst_raw_plot));

// Conf: obs_raw_plot

// *X

obs_array->raw_pi = parse_conf_plot_info(conf.lookup_dictionary(conf_key_obs_raw_plot));

// Conf: object_plot
Expand Down Expand Up @@ -637,7 +547,6 @@ PlotInfo plot_info;

// Conf: shift_right

// *X
shift_right = fcst_dict->lookup_int(conf_key_shift_right);

return;
Expand Down
10 changes: 0 additions & 10 deletions met/src/libcode/vx_shapedata/mode_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ class ModeConfInfo {
bool plot_valid_flag; // Zoom up plot to the sub-region of valid data
bool plot_gcarc_flag; // Plot lines as great-circle arcs
bool ps_plot_flag; // Flag for the output PostScript image file
// bool nc_pairs_flag; // output NetCDF file
bool ct_stats_flag; // Flag for the output contingency table statistics file

FieldType mask_missing_flag; // Mask missing data between fcst and obs
Expand Down Expand Up @@ -234,18 +233,9 @@ class ModeConfInfo {
inline int ModeConfInfo::n_conv_radii() const { return ( Fcst->conv_radius_array.n_elements() ); } // should be the same as
// obs_conv_radius_array.n_elements()


inline int ModeConfInfo::n_conv_threshs() const { return ( Fcst->conv_thresh_array.n_elements() ); } // should be the same as
// obs_conv_thresh_array.n_elements()


// inline int ModeConfInfo::n_fcst_merge_threshs () const { return ( fcst->merge_thresh_array.n_elements() ); }
// inline int ModeConfInfo::n_obs_merge_threshs () const { return ( obs->merge_thresh_array.n_elements() ); }


// inline bool ModeConfInfo::need_fcst_merge_thresh () const { return ( (fcst->merge_flag == MergeType_Both) || (fcst->merge_flag == MergeType_Thresh) ); }
// inline bool ModeConfInfo::need_obs_merge_thresh () const { return ( ( obs->merge_flag == MergeType_Both) || ( obs->merge_flag == MergeType_Thresh) ); }

inline int ModeConfInfo::get_compression_level() { return conf.nc_compression(); }

inline int ModeConfInfo::field_index() const { return Field_Index; }
Expand Down
33 changes: 29 additions & 4 deletions met/src/tools/core/mode/mode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,41 @@ int main(int argc, char * argv [])

{

if ( argc == 1 ) both_usage();

int j;
int j, n;
int status;
ModeConfInfo config;
StringArray Argv;
string s;
bool has_field_index = false;
const char * const user_config_filename = argv[3];
const char * user_config_filename = 0;

for (j=0,n=0; j<argc; ++j) {

//
// all options take exactly one argument
//

if ( argv[j][0] == '-' ) j++;
else n++;

//
// the config file is the 4th required argv item
//

if ( n == 4 ) {

user_config_filename = argv[j];
break;

}

}

//
// check for enough required arguments
//

if ( !user_config_filename ) both_usage();

for (j=0; j<argc; ++j) {

Expand Down

0 comments on commit 4814d72

Please sign in to comment.