Skip to content

Commit

Permalink
Per #1638, apply the same 3 fixes to the main_v9.1 branch to be inclu…
Browse files Browse the repository at this point in the history
…ded in the next bugfix release for met-9.1. (#1640)
  • Loading branch information
JohnHalleyGotway authored Jan 26, 2021
1 parent 76253a9 commit 310aa1f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion met/src/basic/vx_util/data_plane_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ DataPlane subtract(const DataPlane &dp1, const DataPlane &dp2) {

DataPlane normal_cdf(const DataPlane &dp, const DataPlane &mn,
const DataPlane &sd) {
DataPlane cdf = dp;
DataPlane cdf = mn;
double v;

// Check grid dimensions
Expand Down
35 changes: 33 additions & 2 deletions met/src/libcode/vx_statistics/pair_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1026,9 +1026,40 @@ NumArray derive_climo_prob(const NumArray &mn_na, const NumArray &sd_na,
n_mn = mn_na.n_valid();
n_sd = sd_na.n_valid();

// For CDP threshold types, the climo_prob is constant.
// For CDP threshold types, the climo probability is constant
if(othresh.get_ptype() == perc_thresh_climo_dist) {
climo_prob.add_const(othresh.get_pvalue()/100.0, n_mn);

// Climo probability varies based on the threshold type
switch(othresh.get_type()) {

case thresh_lt:
case thresh_le:
prob = othresh.get_pvalue()/100.0;
break;

case thresh_eq:
prob = 0.0;
break;

case thresh_ne:
prob = 1.0;
break;

case thresh_gt:
case thresh_ge:
prob = 1.0 - othresh.get_pvalue()/100.0;
break;

default:
mlog << Error << "\n\nderive_climo_prob() -> "
<< "climatological threshold \"" << othresh.get_str()
<< "\" cannot be converted to a probability!\n\n";
exit(1);
break;
}

// Add constant climo probability value
climo_prob.add_const(prob, n_mn);
}
// If both mean and standard deviation were provided, use them to
// derive normal climatological probabilities for the current event
Expand Down
2 changes: 1 addition & 1 deletion met/src/tools/core/grid_stat/grid_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ void process_scores() {
conf_info.vx_opt[i].interp_info.field);
}
if(conf_info.vx_opt[i].nc_info.do_climo && !cmn_dp.is_empty() && !csd_dp.is_empty()) {
write_nc((string)"CLIMO_CDF", normal_cdf(cmn_dp, csd_dp, obs_dp),
write_nc((string)"CLIMO_CDF", normal_cdf(obs_dp, cmn_dp, csd_dp),
i, mthd, pnts, conf_info.vx_opt[i].interp_info.field);
}

Expand Down

0 comments on commit 310aa1f

Please sign in to comment.