From 257432a4cb0c6951a48a23b1bd9e7a2b93f3cfca Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 15 May 2023 10:57:22 -0600 Subject: [PATCH 1/2] Per #2542, in the ContingencyTable class, update gheidke(), gheidke_ec(), gkuiper(), and gerrity() to return bad data for empty contingency tables rather than erroring out. --- src/libcode/vx_statistics/contable_stats.cc | 44 ++++++++------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index 02aa6dfbbb..9df41040a0 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -811,14 +811,11 @@ if ( Nrows != Ncols ) { const int N = total(); -if ( N == 0 ) { - - mlog << Error << "\nContingencyTable::gheidke() -> " - << "table empty!\n\n"; - - exit ( 1 ); + // + // MET #2542: return bad data for empty tables rather than erroring out + // -} +if ( N == 0 ) return ( bad_data_double ); const double DN = (double) N; int j, k, m, n; @@ -912,14 +909,11 @@ if ( ec_value < 0.0 || ec_value >= 1.0 ) { const int N = total(); -if ( N == 0 ) { - - mlog << Error << "\nContingencyTable::gheidke_ec(double) -> " - << "table empty!\n\n"; - - exit ( 1 ); + // + // MET #2542: return bad data for empty tables rather than erroring out + // -} +if ( N == 0 ) return ( bad_data_double ); int j, sum; double num, denom, ans; @@ -977,14 +971,11 @@ if ( Nrows != Ncols ) { const int N = total(); -if ( N == 0 ) { - - mlog << Error << "\nContingencyTable::gkuiper() -> " - << "table empty!\n\n"; - - exit ( 1 ); + // + // MET #2542: return bad data for empty tables rather than erroring out + // -} +if ( N == 0 ) return ( bad_data_double ); const double DN = (double) N; int j, k, m, n; @@ -1077,14 +1068,11 @@ if ( Nrows != Ncols ) { const int N = total(); -if ( N == 0 ) { - - mlog << Error << "\nContingencyTable::gerrity() -> " - << "table empty!\n\n"; - - exit ( 1 ); + // + // MET #2542: return bad data for empty tables rather than erroring out + // -} +if ( N == 0 ) return ( bad_data_double ); int j, k, m, n; const double DN = (double) N; From c4a80c08dec3260cbb76a048cc78b3fcbfa507f3 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 15 May 2023 11:05:14 -0600 Subject: [PATCH 2/2] Per #2542, modify TC-Stat config file job number 8 that was added for #2425 by adding the option. That produces output for both the AHWI and BCLP model names. The BCLP contingency table is empty which triggers this runtime error. Tweaking this newly added tests and confirming that it now runs without error demonstrate the fix. --- internal/test_unit/config/TCStatConfig_ALAL2010 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/test_unit/config/TCStatConfig_ALAL2010 b/internal/test_unit/config/TCStatConfig_ALAL2010 index 05bf63a7a1..46b630969d 100644 --- a/internal/test_unit/config/TCStatConfig_ALAL2010 +++ b/internal/test_unit/config/TCStatConfig_ALAL2010 @@ -212,7 +212,7 @@ jobs = [ "-job filter -amodel AHWI -rirw_track BDECK -rirw_thresh <=-30 -rirw_exact TRUE -dump_row ${MET_TEST_OUTPUT}/tc_stat/ALAL2010_AHWI_rw.tcst", "-job rirw -rirw_window 00 -rirw_thresh <=-15 -out_line_type CTC,CTS,MPR", "-job rirw -rirw_window 12 -rirw_thresh <=-15 -out_line_type CTC,CTS,MPR", - "-job rirw -rirw_window 12 -rirw_thresh <=-15 -out_line_type CTC,CTS -out_stat ${MET_TEST_OUTPUT}/tc_stat/ALAL2010_rirw.stat" + "-job rirw -rirw_window 12 -rirw_thresh <=-15 -out_line_type CTC,CTS -by amodel -out_stat ${MET_TEST_OUTPUT}/tc_stat/ALAL2010_rirw.stat" ]; //