Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #2856 main_v11.1 ens_climo #2917

Merged
merged 10 commits into from
Jun 20, 2024
Merged
21 changes: 20 additions & 1 deletion .github/jobs/set_job_controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
input_data_version=${branch_name:6}
fi

# check for main_vX.Y in the branch name
elif [[ "${branch_name}" =~ .*(main_v)([0-9]+\.[0-9]+).* ]]; then

truth_data_version=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
input_data_version=${BASH_REMATCH[2]}

fi

# check commit messages for skip or force keywords
Expand Down Expand Up @@ -87,14 +93,27 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then

elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then

branch_name=`cut -d "/" -f3 <<< "${GITHUB_REF}"`

# check for main_vX.Y in the branch name
if [[ "${branch_name}" =~ .*(main_v)([0-9]+\.[0-9]+).* ]]; then

truth_data_version=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
input_data_version=${BASH_REMATCH[2]}

fi

if [ "${force_tests}" == "true" ]; then

run_diff=true

fi

fi

# if updating truth or running diff, run unit tests
if [ "$run_update_truth" == "true" ] || [ "$run_diff" == "true" ]; then
if [ "$run_update_truth" == "true" ] ||
[ "$run_diff" == "true" ]; then

run_unit_tests=true

Expand Down
8 changes: 5 additions & 3 deletions src/libcode/vx_stat_out/stat_columns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3335,11 +3335,13 @@ void write_pjc_cols(const PCTInfo &pct_info,
col++;

at.set_entry(r, col, // OY_TP
pct_info.pct.event_count_by_row(i)/(double) n);
(n == 0 ? bad_data_double :
pct_info.pct.event_count_by_row(i)/(double) n));
col++;

at.set_entry(r, col, // ON_TP
pct_info.pct.nonevent_count_by_row(i)/(double) n);
(n == 0 ? bad_data_double :
pct_info.pct.nonevent_count_by_row(i)/(double) n));
col++;

at.set_entry(r, col, // CALIBRATION
Expand Down Expand Up @@ -3430,7 +3432,7 @@ void write_eclv_cols(const TTContingencyTable &ct,
//
// Economic Cost/Loss Value
// Dump out the ECLV line:
// TOTAL, BASER, BASER_VALUE,
// TOTAL, BASER, VALUE_BASER,
// N_PNT, [CL_], [VALUE_] (for each point)
//
at.set_entry(r, c+0, // Total Number of pairs
Expand Down
9 changes: 7 additions & 2 deletions src/libcode/vx_statistics/contable_nx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,20 @@ return ( x );

double Nx2ContingencyTable::baser() const {

return ( (double) event_col_total()/n() );
double v;

if( n() == 0 ) v = bad_data_double;
else v = (double) event_col_total()/n();

return ( v );
}


////////////////////////////////////////////////////////////////////////


double Nx2ContingencyTable::baser_ci(double alpha,
double &cl, double &cu) const {
double &cl, double &cu) const {
double v;

v = baser();
Expand Down
2 changes: 2 additions & 0 deletions src/libcode/vx_statistics/contable_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ double TTContingencyTable::sedi_ci(double alpha,
double TTContingencyTable::cost_loss(double r) const {
double num, den, h, m, f, b, v;

if(n() == 0) return(bad_data_double);

// Total proportion of hits, misses, false alarms, and observations
h = (double) fy_oy() / n();
m = (double) fn_oy() / n();
Expand Down
3 changes: 3 additions & 0 deletions src/tools/core/ensemble_stat/ensemble_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
// 038 09/06/22 Halley Gotway MET #1908 Remove ensemble processing logic.
// 039 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic.
// 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files
// 041 06/17/24 Halley Gotway MET #2856 Reinitialize climo_cdf pointer
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -2221,6 +2222,7 @@ void do_pct_cat_thresh(const EnsembleStatVxOpt &vx_opt,

// Re-initialize
pd_pnt.erase();
pd_pnt.set_climo_cdf_info_ptr(&vx_opt.cdf_info);

// Process the observations
for(i_obs=0; i_obs<pd_ens.n_obs; i_obs++) {
Expand Down Expand Up @@ -2319,6 +2321,7 @@ void do_pct_cdp_thresh(const EnsembleStatVxOpt &vx_opt,

// Re-initialize
pd_pnt.erase();
pd_pnt.set_climo_cdf_info_ptr(&vx_opt.cdf_info);

// Process the observations
for(i_obs=0; i_obs<pd_ens.n_obs; i_obs++) {
Expand Down
18 changes: 9 additions & 9 deletions src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1112,28 +1112,28 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const {
case(i_prc):

// Maximum number of PCT, PJC, and PRC lines possible =
// Point Vx: Message Types * Masks * Interpolations * Categorical Thresholds
// Grid Vx: Masks * Interpolations * Categorical Thresholds
// Point Vx: Message Types * Masks * Interpolations * Categorical Thresholds * Climo CDF Bins
// Grid Vx: Masks * Interpolations * Categorical Thresholds * Climo CDF Bins
n = (get_n_msg_typ() + 1) * get_n_mask() * get_n_interp() *
get_n_prob_cat_thresh();
max(fcat_ta.n(), 1) * cdf_info.cdf_ta.n();
break;

case(i_pstd):

// Maximum number of PSTD lines possible =
// Point Vx: Message Types * Masks * Interpolations * Categorical Thresholds * Alphas
// Grid Vx: Masks * Interpolations * Categorical Thresholds * Alphas
// Point Vx: Message Types * Masks * Interpolations * Categorical Thresholds * Climo CDF Bins * Alphas
// Grid Vx: Masks * Interpolations * Categorical Thresholds * Climo CDF Bins * Alphas
n = (get_n_msg_typ() + 1) * get_n_mask() * get_n_interp() *
get_n_prob_cat_thresh() * get_n_ci_alpha();
max(fcat_ta.n(), 1) * cdf_info.cdf_ta.n() * get_n_ci_alpha();
break;

case(i_eclv):

// Maximum number of ECLV lines possible =
// Point Vx: Message Types * Masks * Interpolations * Probability Thresholds
// Grid Vx: Masks * Interpolations * Probability Thresholds
// Point Vx: Message Types * Masks * Interpolations * Probability Thresholds * Climo CDF Bins
// Grid Vx: Masks * Interpolations * Probability Thresholds * Climo CDF Bins
n = (get_n_msg_typ() + 1) * get_n_mask() * get_n_interp() *
get_n_prob_cat_thresh() * get_n_prob_cat_thresh();
get_n_prob_cat_thresh() * get_n_prob_cat_thresh() * cdf_info.cdf_ta.n();
break;

default:
Expand Down