From a34645099fb2150bd1c1db702de95089f00b9780 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 10 Nov 2022 12:28:18 -0700 Subject: [PATCH] Per #2339, first step... enhance Stat-Analysis to parse the SEEPS and SEEPS_MPR lines types. --- src/libcode/vx_stat_out/stat_columns.cc | 2 +- src/libcode/vx_statistics/pair_data_point.cc | 2 +- .../core/stat_analysis/parse_stat_line.cc | 58 +++++++++++++++++++ .../core/stat_analysis/parse_stat_line.h | 15 +++++ 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 681167fd8c..a106f389a9 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -4087,7 +4087,7 @@ void write_seeps_cols(const SeepsAggScore *seeps, at.set_entry(r, c+0, seeps->n_obs); // Total Number of Pairs at.set_entry(r, c+1, seeps->s12); // s12 - at.set_entry(r, c+2, seeps->s13); // S13 + at.set_entry(r, c+2, seeps->s13); // s13 at.set_entry(r, c+3, seeps->s21); // s21 at.set_entry(r, c+4, seeps->s23); // s23 at.set_entry(r, c+5, seeps->s31); // s31 diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 48d8b6c068..f1af6cb380 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -86,7 +86,7 @@ void PairDataPoint::clear() { if (seeps_mpr[idx]) delete seeps_mpr[idx]; } seeps_mpr.clear(); - seeps.init(); + seeps.clear(); return; } diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index a5410e2a53..95117f72ef 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -29,6 +29,8 @@ // 009 10/09/17 Halley Gotway Add GRAD line type. // 010 04/25/18 Halley Gotway Add ECNT line type. // 011 01/24/20 Halley Gotway Add RPS line type. +// 012 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR +// line types. // //////////////////////////////////////////////////////////////////////// @@ -549,3 +551,59 @@ void parse_ssvar_line(STATLine &l, SSVARInfo &ssvar_info) { } //////////////////////////////////////////////////////////////////////// + +void parse_seeps_line(STATLine &l, SeepsAggScore &agg_score) { + + agg_score.clear(); + + agg_score.n_obs = atoi(l.get_item("TOTAL")); + + agg_score.s12 = atoi(l.get_item("S12")); + agg_score.s13 = atoi(l.get_item("S13")); + agg_score.s21 = atof(l.get_item("S21")); + agg_score.s23 = atof(l.get_item("S23")); + agg_score.s31 = atof(l.get_item("S31")); + agg_score.s32 = atof(l.get_item("S32")); + + agg_score.pf1 = atof(l.get_item("PF1")); + agg_score.pf2 = atof(l.get_item("PF2")); + agg_score.pf3 = atof(l.get_item("PF3")); + + agg_score.pv1 = atof(l.get_item("PV1")); + agg_score.pv2 = atof(l.get_item("PV2")); + agg_score.pv3 = atof(l.get_item("PV3")); + + agg_score.mean_fcst = atof(l.get_item("MEAN_FCST")); + agg_score.mean_obs = atof(l.get_item("MEAN_OBS")); + + agg_score.score = atof(l.get_item("SEEPS")); + agg_score.weighted_score = agg_score.score; + + return; +} + +//////////////////////////////////////////////////////////////////////// + +void parse_seeps_mpr_line(STATLine &l, SEEPSMPRData &s_data) { + + s_data.fcst_var = l.fcst_var(); + s_data.obs_var = l.obs_var(); + + s_data.obs_sid = l.get_item("OBS_SID"); + s_data.obs_lat = atof(l.get_item("OBS_LAT")); + s_data.obs_lon = atof(l.get_item("OBS_LON")); + s_data.fcst = atof(l.get_item("FCST")); + s_data.obs = atof(l.get_item("OBS")); + s_data.obs_qc = l.get_item("OBS_QC"); + + s_data.seeps_mpr.fcst_cat = atoi(l.get_item("FCST_CAT")); + s_data.seeps_mpr.obs_cat = atoi(l.get_item("OBS_CAT")); + s_data.seeps_mpr.p1 = atof(l.get_item("P1")); + s_data.seeps_mpr.p2 = atof(l.get_item("P2")); + s_data.seeps_mpr.t1 = atof(l.get_item("T1")); + s_data.seeps_mpr.t2 = atof(l.get_item("T2")); + + return; +} + +//////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/parse_stat_line.h b/src/tools/core/stat_analysis/parse_stat_line.h index 62718981b2..8634ae6d50 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.h +++ b/src/tools/core/stat_analysis/parse_stat_line.h @@ -26,6 +26,8 @@ // 009 04/25/18 Halley Gotway Add ECNT line type. // 010 01/24/20 Halley Gotway Add RPS line type. // 011 09/28/22 Prestopnik MET #2227 Remove namespace std +// 012 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR +// line types. // //////////////////////////////////////////////////////////////////////// @@ -45,6 +47,7 @@ #include "vx_analysis_util.h" #include "vx_util.h" #include "vx_statistics.h" +#include "seeps.h" //////////////////////////////////////////////////////////////////////// @@ -102,6 +105,15 @@ struct ORANKData { NumArray ens_na; }; +// SEEPS Matched Pair (SEEPS_MPR) data structure +struct SEEPSMPRData { + ConcatString fcst_var; + ConcatString obs_var; + ConcatString obs_sid, obs_qc; + double obs_lat, obs_lon, fcst, obs; + SeepsScore seeps_mpr; +}; + //////////////////////////////////////////////////////////////////////// extern void parse_fho_ctable (STATLine &, TTContingencyTable &); @@ -128,6 +140,9 @@ extern void parse_relp_line (STATLine &, RELPData &); extern void parse_orank_line (STATLine &, ORANKData &); extern void parse_ssvar_line (STATLine &, SSVARInfo &); +extern void parse_seeps_line (STATLine &, SeepsAggScore &); +extern void parse_seeps_mpr_line(STATLine &, SEEPSMPRData &); + //////////////////////////////////////////////////////////////////////// #endif // __PARSE_STAT_LINE_H__