Skip to content

Commit

Permalink
Per #3020, add missing GridStatNcOutInfo::do_seeps flag and use it to…
Browse files Browse the repository at this point in the history
… determine if SEEPS information should be written to the Grid-Stat NetCDF matched pairs output file.
  • Loading branch information
JohnHalleyGotway committed Nov 15, 2024
1 parent 4e6a889 commit a3229ac
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
36 changes: 25 additions & 11 deletions src/tools/core/grid_stat/grid_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
// 056 01/29/24 Halley Gotway MET #2801 Configure time difference warnings.
// 057 07/05/24 Halley Gotway MET #2924 Support forecast climatology.
// 058 10/03/24 Halley Gotway MET #2887 Compute weighted contingency tables.
// 059 11/15/24 Halley Gotway MET #3020 SEEPS NetCDF output.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -1267,23 +1268,36 @@ void process_scores() {
SeepsAggScore seeps_agg;
int month, day, year, hour, minute, second;

// Compute SEEPS statistics
unix_to_mdyhms(fcst_dp.valid(), month, day, year, hour, minute, second);
compute_aggregated_seeps_grid(fcst_dp_smooth, obs_dp_smooth,
seeps_dp, seeps_dp_fcat, seeps_dp_ocat,
&seeps_agg, month, hour,
conf_info.seeps_p1_thresh, conf_info.seeps_climo_name);

write_nc("SEEPS_MPR_SCORE", seeps_dp,
i, mthd, pnts,
conf_info.vx_opt[i].interp_info.field);
write_nc("SEEPS_MPR_FCAT", seeps_dp_fcat,
i, mthd, pnts,
conf_info.vx_opt[i].interp_info.field);
write_nc("SEEPS_MPR_OCAT", seeps_dp_ocat,
i, mthd, pnts,
conf_info.vx_opt[i].interp_info.field);
write_seeps_row(shc, &seeps_agg, conf_info.output_flag[i_seeps],
stat_at, i_stat_row, txt_at[i_seeps], i_txt_row[i_seeps]);
// Write out SEEPS
if(conf_info.vx_opt[i].output_flag[i_seeps] != STATOutputType::None &&
seeps_agg.n_obs > 0) {

write_seeps_row(shc, &seeps_agg,
conf_info.output_flag[i_seeps],
stat_at, i_stat_row,
txt_at[i_seeps], i_txt_row[i_seeps]);
}

// MET #3020
// Write out the SEEPS data if requested in the config file
if(conf_info.vx_opt[i].nc_info.do_seeps) {
write_nc("SEEPS_MPR_SCORE", seeps_dp,
i, mthd, pnts,
conf_info.vx_opt[i].interp_info.field);
write_nc("SEEPS_MPR_FCAT", seeps_dp_fcat,
i, mthd, pnts,
conf_info.vx_opt[i].interp_info.field);
write_nc("SEEPS_MPR_OCAT", seeps_dp_ocat,
i, mthd, pnts,
conf_info.vx_opt[i].interp_info.field);
}
}

// Compute gradient statistics if requested in the config file
Expand Down
12 changes: 8 additions & 4 deletions src/tools/core/grid_stat/grid_stat_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ void GridStatConfInfo::process_flags() {
if(vx_opt[i].nc_info.do_diff) nc_info.do_diff = true;
if(vx_opt[i].nc_info.do_climo) nc_info.do_climo = true;
if(vx_opt[i].nc_info.do_climo_cdp) nc_info.do_climo_cdp = true;
if(vx_opt[i].nc_info.do_seeps) nc_info.do_seeps = true;
if(vx_opt[i].nc_info.do_weight) nc_info.do_weight = true;
if(vx_opt[i].nc_info.do_nbrhd) nc_info.do_nbrhd = true;
if(vx_opt[i].nc_info.do_fourier) nc_info.do_fourier = true;
Expand Down Expand Up @@ -987,6 +988,7 @@ void GridStatVxOpt::parse_nc_info(Dictionary &odict) {
nc_info.do_diff = d->lookup_bool(conf_key_diff_flag);
nc_info.do_climo = d->lookup_bool(conf_key_climo_flag);
nc_info.do_climo_cdp = d->lookup_bool(conf_key_climo_cdp_flag);
nc_info.do_seeps = d->lookup_bool(conf_key_seeps_flag);
nc_info.do_weight = d->lookup_bool(conf_key_weight);
nc_info.do_nbrhd = d->lookup_bool(conf_key_nbrhd);
nc_info.do_fourier = d->lookup_bool(conf_key_fourier);
Expand Down Expand Up @@ -1310,10 +1312,10 @@ void GridStatNcOutInfo::clear() {

bool GridStatNcOutInfo::all_false() const {

bool status = do_latlon || do_raw || do_diff ||
do_climo || do_climo_cdp || do_weight ||
do_nbrhd || do_fourier || do_gradient ||
do_distance_map || do_apply_mask;
bool status = do_latlon || do_raw || do_diff ||
do_climo || do_climo_cdp || do_seeps ||
do_weight || do_nbrhd || do_fourier ||
do_gradient || do_distance_map || do_apply_mask;

return !status;
}
Expand All @@ -1327,6 +1329,7 @@ void GridStatNcOutInfo::set_all_false() {
do_diff = false;
do_climo = false;
do_climo_cdp = false;
do_seeps = false;
do_weight = false;
do_nbrhd = false;
do_fourier = false;
Expand All @@ -1346,6 +1349,7 @@ void GridStatNcOutInfo::set_all_true() {
do_diff = true;
do_climo = true;
do_climo_cdp = true;
do_seeps = true;
do_weight = true;
do_nbrhd = true;
do_fourier = true;
Expand Down
1 change: 1 addition & 0 deletions src/tools/core/grid_stat/grid_stat_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct GridStatNcOutInfo {
bool do_diff;
bool do_climo;
bool do_climo_cdp;
bool do_seeps;
bool do_weight;
bool do_nbrhd;
bool do_fourier;
Expand Down

0 comments on commit a3229ac

Please sign in to comment.