Skip to content

Commit

Permalink
Per #1673, update grid_stat to mask out bad data between the fcst/obs…
Browse files Browse the repository at this point in the history
… fields before computing distance maps. This will change existing unit test results! Also store the count of valid data values in the full verification domain.
  • Loading branch information
JohnHalleyGotway committed Aug 4, 2021
1 parent d36789b commit e299004
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions met/src/tools/core/grid_stat/grid_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,13 @@ void process_scores() {
DataPlane fcst_dp_dmap, obs_dp_dmap;
pd.extend(grid.nx()*grid.ny());

// Mask out missing data between the fields for a fair comparison
DataPlane fcst_dp_mm = fcst_dp;
DataPlane obs_dp_mm = obs_dp;
mask_bad_data(fcst_dp_mm, obs_dp_mm);
mask_bad_data(obs_dp_mm, fcst_dp_mm);
int n_good_data = obs_dp_mm.n_good_data();

// Loop over the categorical thresholds
for(k=0; k<conf_info.vx_opt[i].fcat_ta.n(); k++) {

Expand All @@ -1233,7 +1240,7 @@ void process_scores() {

// Apply the current mask
get_mask_points(conf_info.vx_opt[i], mask_mp,
&fcst_dp, &obs_dp,
&fcst_dp_mm, &obs_dp_mm,
&cmn_dp, 0, 0, pd);

// Process percentile thresholds
Expand All @@ -1249,7 +1256,7 @@ void process_scores() {
fcst_dp_thresh.is_empty() ||
conf_info.vx_opt[i].fcat_ta[k].need_perc()) {

fcst_dp_thresh = fcst_dp;
fcst_dp_thresh = fcst_dp_mm;
fcst_dp_thresh.threshold(conf_info.vx_opt[i].fcat_ta[k]);
fcst_dp_dmap = distance_map(fcst_dp_thresh);

Expand All @@ -1268,7 +1275,7 @@ void process_scores() {
obs_dp_thresh.is_empty() ||
conf_info.vx_opt[i].ocat_ta[k].need_perc()) {

obs_dp_thresh = obs_dp;
obs_dp_thresh = obs_dp_mm;
obs_dp_thresh.threshold(conf_info.vx_opt[i].ocat_ta[k]);
obs_dp_dmap = distance_map(obs_dp_thresh);

Expand Down Expand Up @@ -1299,7 +1306,8 @@ void process_scores() {
conf_info.vx_opt[i].baddeley_max_dist,
conf_info.vx_opt[i].fom_alpha,
conf_info.vx_opt[i].zhu_weight,
conf_info.vx_opt[i].beta_value_fx((double) (grid.nx()*grid.ny())));
conf_info.vx_opt[i].beta_value_fx((double) n_good_data),
n_good_data);

// Compute DMAP statistics
dmap_info.set(conf_info.vx_opt[i].fcat_ta[k],
Expand Down

0 comments on commit e299004

Please sign in to comment.