From 4814d7227461b195b42d88a1aea0f5233c1ff0f0 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 10 Mar 2022 08:56:15 -0700 Subject: [PATCH] Per #1184, fix parsing problem with optional args preceeding req ones. Also, remove stale commented out code. --- .../libcode/vx_shapedata/mode_conf_info.cc | 91 ------------------- met/src/libcode/vx_shapedata/mode_conf_info.h | 10 -- met/src/tools/core/mode/mode.cc | 33 ++++++- 3 files changed, 29 insertions(+), 105 deletions(-) diff --git a/met/src/libcode/vx_shapedata/mode_conf_info.cc b/met/src/libcode/vx_shapedata/mode_conf_info.cc index 9bae581a01..bdcd013331 100644 --- a/met/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/met/src/libcode/vx_shapedata/mode_conf_info.cc @@ -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; @@ -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; @@ -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; } @@ -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) { @@ -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; jlookup_thresh_array(conf_key_conv_thresh); -// *X obs_conv_thresh_array = obs_dict->lookup_thresh_array(conf_key_conv_thresh); - for (j=0; jlookup_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; jraw_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 @@ -637,7 +547,6 @@ PlotInfo plot_info; // Conf: shift_right -// *X shift_right = fcst_dict->lookup_int(conf_key_shift_right); return; diff --git a/met/src/libcode/vx_shapedata/mode_conf_info.h b/met/src/libcode/vx_shapedata/mode_conf_info.h index 5e6c436f62..6460b12add 100644 --- a/met/src/libcode/vx_shapedata/mode_conf_info.h +++ b/met/src/libcode/vx_shapedata/mode_conf_info.h @@ -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 @@ -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; } diff --git a/met/src/tools/core/mode/mode.cc b/met/src/tools/core/mode/mode.cc index 95c7235da6..3563cc3d82 100644 --- a/met/src/tools/core/mode/mode.cc +++ b/met/src/tools/core/mode/mode.cc @@ -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