From f42b6b11341e8ce1811acbbf7162413b70dc9bcf Mon Sep 17 00:00:00 2001 From: johnhg Date: Thu, 18 Mar 2021 23:04:48 -0600 Subject: [PATCH] Bugfix 1716 main_v9.1 perc_thresh (#1721) * Per #1716, committing the same bugfix to the main_v9.1 branch for inclusion in the 9.1.3 bugfix release. * Per #1716, change SFP50 example to SFP33.3 to show an example of using floating point percentile values. --- met/data/config/README | 2 +- met/src/basic/vx_config/my_config_scanner.cc | 78 ++++++++++---------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/met/data/config/README b/met/data/config/README index e09413030b..55c0c77edd 100644 --- a/met/data/config/README +++ b/met/data/config/README @@ -53,7 +53,7 @@ The configuration file language supports the following data types: - In the Gen-Vx-Mask "-thresh" command line option. - The following percentile threshold types are supported: - "SFP" for a percentile of the sample forecast values. - e.g. ">SFP50" means greater than the 50-th forecast percentile. + e.g. ">SFP33.3" means greater than the 33.3-rd forecast percentile. - "SOP" for a percentile of the sample observation values. e.g. ">SOP75" means greater than the 75-th observation percentile. - "SCP" for a percentile of the sample climatology values. diff --git a/met/src/basic/vx_config/my_config_scanner.cc b/met/src/basic/vx_config/my_config_scanner.cc index 57246913cf..1acae0582b 100644 --- a/met/src/basic/vx_config/my_config_scanner.cc +++ b/met/src/basic/vx_config/my_config_scanner.cc @@ -169,6 +169,8 @@ static bool replace_env(ConcatString &); static bool is_fort_thresh_no_spaces(); +static bool is_simple_perc_thresh(); + static int do_simple_perc_thresh(); @@ -370,6 +372,8 @@ if ( is_float_v2() ) { if ( do_float() ) return ( token(FLOAT) ); } if ( is_fort_thresh_no_spaces() ) { return ( do_fort_thresh() ); } +if ( is_simple_perc_thresh() ) { return ( do_simple_perc_thresh() ); } + int t; if ( is_id() ) { t = do_id(); return ( token(t) ); } @@ -533,7 +537,6 @@ if ( is_lhs ) { strncpy(configlval.text, configtext, max_id_length); return ( if ( strcmp(configtext, "print" ) == 0 ) { return ( PRINT ); } - // // boolean? // @@ -554,17 +557,13 @@ for (j=0; jlookup(configtext); if ( e && (e->is_number()) && (! is_lhs) ) { - // cout << "=================== id = \"" << configtext << "\" is_lhs = " << (is_lhs ? "true" : "false") << "\n"; - - // cout << "do_id() -> \n"; - // e->dump(cout); - if ( e->type() == IntegerType ) { set_int(configlval.nval, e->i_value()); @@ -613,28 +607,20 @@ if ( e && (! is_lhs) && (e->type() == UserFunctionType) ) { } - /////////////////////////////////////////////////////////////////////// - - - - // // fortran threshold without spaces? (example: "le150") // -if ( (strncmp(configtext, "lt", 2) == 0) && is_number(configtext + 2, max_id_length - 2) ) { return ( do_fort_thresh() ); } - for (j=0; j " @@ -1482,11 +1493,8 @@ if ( index < 0 ) { } - configlval.pc_info.perc_index = index; -// configlval.pc_info.is_simple = true; -configlval.pc_info.value = value; -// configlval.pc_info.value2 = bad_data_double;; +configlval.pc_info.value = value; return ( SIMPLE_PERC_THRESH ); @@ -1495,9 +1503,3 @@ return ( SIMPLE_PERC_THRESH ); //////////////////////////////////////////////////////////////////////// - - - - - -