diff --git a/src/tools/core/grid_stat/grid_stat_conf_info.cc b/src/tools/core/grid_stat/grid_stat_conf_info.cc index 2a5f447972..c0ce745735 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -185,12 +185,8 @@ void GridStatConfInfo::process_config(GrdFileType ftype, // Search for corresponding v-wind for(j=0; jis_v_wind() && - vx_opt[j].obs_info->is_v_wind() && - vx_opt[i].fcst_info->req_level_name() == - vx_opt[j].fcst_info->req_level_name() && - vx_opt[i].obs_info->req_level_name() == - vx_opt[j].obs_info->req_level_name() && + if(vx_opt[j].fcst_info->is_v_wind() && + vx_opt[j].obs_info->is_v_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { vx_opt[i].fcst_info->set_uv_index(j); @@ -204,12 +200,8 @@ void GridStatConfInfo::process_config(GrdFileType ftype, // Search for corresponding u-wind for(j=0; jis_u_wind() && - vx_opt[j].obs_info->is_u_wind() && - vx_opt[i].fcst_info->req_level_name() == - vx_opt[j].fcst_info->req_level_name() && - vx_opt[i].obs_info->req_level_name() == - vx_opt[j].obs_info->req_level_name() && + if(vx_opt[j].fcst_info->is_u_wind() && + vx_opt[j].obs_info->is_u_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { vx_opt[i].fcst_info->set_uv_index(j); @@ -904,6 +896,20 @@ void GridStatVxOpt::parse_nc_info(Dictionary &odict) { bool GridStatVxOpt::is_uv_match(const GridStatVxOpt &v) const { bool match = true; + // + // Check that requested forecast and observation levels match. + // Requested levels are empty for python embedding. + // + if( ( fcst_info->req_level_name().nonempty() || + v.fcst_info->req_level_name().nonempty()) && + !( fcst_info->req_level_name() == + v.fcst_info->req_level_name())) match = false; + + else if( ( obs_info->req_level_name().nonempty() || + v.obs_info->req_level_name().nonempty()) && + !( obs_info->req_level_name() == + v.obs_info->req_level_name())) match = false; + // // The following do not impact matched pairs: // desc, var_name, var_suffix, @@ -917,12 +923,10 @@ bool GridStatVxOpt::is_uv_match(const GridStatVxOpt &v) const { // hss_ec_value, rank_corr_flag, output_flag, nc_info // - if(!(mask_grid == v.mask_grid ) || - !(mask_poly == v.mask_poly ) || - !(mask_name == v.mask_name ) || - !(interp_info == v.interp_info)) { - match = false; - } + else if(!(mask_grid == v.mask_grid ) || + !(mask_poly == v.mask_poly ) || + !(mask_name == v.mask_name ) || + !(interp_info == v.interp_info)) match = false; return(match); } diff --git a/src/tools/core/point_stat/point_stat_conf_info.cc b/src/tools/core/point_stat/point_stat_conf_info.cc index 7b811ce17a..b9dc8a2cc3 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -179,12 +179,8 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { // Search for corresponding v-wind for(j=0; jis_v_wind() && - vx_opt[j].vx_pd.obs_info->is_v_wind() && - vx_opt[i].vx_pd.fcst_info->req_level_name() == - vx_opt[j].vx_pd.fcst_info->req_level_name() && - vx_opt[i].vx_pd.obs_info->req_level_name() == - vx_opt[j].vx_pd.obs_info->req_level_name() && + if(vx_opt[j].vx_pd.fcst_info->is_v_wind() && + vx_opt[j].vx_pd.obs_info->is_v_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { vx_opt[i].vx_pd.fcst_info->set_uv_index(j); @@ -198,12 +194,8 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { // Search for corresponding u-wind for(j=0; jis_u_wind() && - vx_opt[j].vx_pd.obs_info->is_u_wind() && - vx_opt[i].vx_pd.fcst_info->req_level_name() == - vx_opt[j].vx_pd.fcst_info->req_level_name() && - vx_opt[i].vx_pd.obs_info->req_level_name() == - vx_opt[j].vx_pd.obs_info->req_level_name() && + if(vx_opt[j].vx_pd.fcst_info->is_u_wind() && + vx_opt[j].vx_pd.obs_info->is_u_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { vx_opt[i].vx_pd.fcst_info->set_uv_index(j); @@ -704,6 +696,20 @@ void PointStatVxOpt::clear() { bool PointStatVxOpt::is_uv_match(const PointStatVxOpt &v) const { bool match = true; + // + // Check that requested forecast and observation levels match. + // Requested levels are empty for python embedding. + // + if( ( vx_pd.fcst_info->req_level_name().nonempty() || + v.vx_pd.fcst_info->req_level_name().nonempty()) && + !( vx_pd.fcst_info->req_level_name() == + v.vx_pd.fcst_info->req_level_name())) match = false; + + else if( ( vx_pd.obs_info->req_level_name().nonempty() || + v.vx_pd.obs_info->req_level_name().nonempty()) && + !( vx_pd.obs_info->req_level_name() == + v.vx_pd.obs_info->req_level_name())) match = false; + // // The following do not impact matched pairs: // fcat_ta, ocat_ta, @@ -714,22 +720,20 @@ bool PointStatVxOpt::is_uv_match(const PointStatVxOpt &v) const { // rank_corr_flag, output_flag // - if(!(beg_ds == v.beg_ds ) || - !(end_ds == v.end_ds ) || - !(land_flag == v.land_flag ) || - !(topo_flag == v.topo_flag ) || - !(mask_grid == v.mask_grid ) || - !(mask_poly == v.mask_poly ) || - !(mask_sid == v.mask_sid ) || - !(mask_llpnt == v.mask_llpnt ) || - !(mask_name == v.mask_name ) || - !(interp_info == v.interp_info ) || - !(msg_typ == v.msg_typ ) || - !(duplicate_flag == v.duplicate_flag) || - !(obs_summary == v.obs_summary ) || - !(obs_perc == v.obs_perc )) { - match = false; - } + else if(!(beg_ds == v.beg_ds ) || + !(end_ds == v.end_ds ) || + !(land_flag == v.land_flag ) || + !(topo_flag == v.topo_flag ) || + !(mask_grid == v.mask_grid ) || + !(mask_poly == v.mask_poly ) || + !(mask_sid == v.mask_sid ) || + !(mask_llpnt == v.mask_llpnt ) || + !(mask_name == v.mask_name ) || + !(interp_info == v.interp_info ) || + !(msg_typ == v.msg_typ ) || + !(duplicate_flag == v.duplicate_flag) || + !(obs_summary == v.obs_summary ) || + !(obs_perc == v.obs_perc )) match = false; return(match); }