From a7214d0570678eb3734ae72d950fcdf85672801a Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 6 Dec 2022 14:36:46 -0700 Subject: [PATCH] Per #2366, add Debug(3) messages about matching U/V fields. Also, print a warning message if multiple matches are found. Should this be an error instead? --- .../core/grid_stat/grid_stat_conf_info.cc | 38 +++++++++++++++++++ .../core/point_stat/point_stat_conf_info.cc | 38 +++++++++++++++++++ 2 files changed, 76 insertions(+) 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 c0ce745735..301e6cb0d9 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -189,10 +189,29 @@ void GridStatConfInfo::process_config(GrdFileType ftype, vx_opt[j].obs_info->is_v_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { + mlog << Debug(3) << "U-wind field array entry " << i+1 + << " matches V-wind field array entry " << j+1 << ".\n"; + + // Print warning about multiple matches + if(vx_opt[i].fcst_info->uv_index() >= 0 || + vx_opt[i].obs_info->uv_index() >= 0) { + mlog << Warning << "\nGridStatConfInfo::process_config() -> " + << "For U-wind, found multiple matching V-wind field array entries! " + << "Set the \"level\" strings to differentiate between them.\n\n"; + } + vx_opt[i].fcst_info->set_uv_index(j); vx_opt[i].obs_info->set_uv_index(j); } } + + // No match found + if(vx_opt[i].fcst_info->uv_index() < 0 || + vx_opt[i].obs_info->uv_index() < 0) { + mlog << Debug(3) << "U-wind field array entry " << i+1 + << " has no matching V-wind field array entry.\n"; + } + } // Process v-wind else if(vx_opt[i].fcst_info->is_v_wind() && @@ -204,10 +223,29 @@ void GridStatConfInfo::process_config(GrdFileType ftype, vx_opt[j].obs_info->is_u_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { + mlog << Debug(3) << "V-wind field array entry " << i+1 + << " matches U-wind field array entry " << j+1 << ".\n"; + + // Print warning about multiple matches + if(vx_opt[i].fcst_info->uv_index() >= 0 || + vx_opt[i].obs_info->uv_index() >= 0) { + mlog << Warning << "\nGridStatConfInfo::process_config() -> " + << "For V-wind, found multiple matching U-wind field array entries! " + << "Set the \"level\" strings to differentiate between them.\n\n"; + } + vx_opt[i].fcst_info->set_uv_index(j); vx_opt[i].obs_info->set_uv_index(j); } } + + // No match found + if(vx_opt[i].fcst_info->uv_index() < 0 || + vx_opt[i].obs_info->uv_index() < 0) { + mlog << Debug(3) << "V-wind field array entry " << i+1 + << " has no matching U-wind field array entry.\n"; + } + } } // end for i } // end if 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 b9dc8a2cc3..96033d7962 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -183,10 +183,29 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { vx_opt[j].vx_pd.obs_info->is_v_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { + mlog << Debug(3) << "U-wind field array entry " << i+1 + << " matches V-wind field array entry " << j+1 << ".\n"; + + // Print warning about multiple matches + if(vx_opt[i].vx_pd.fcst_info->uv_index() >= 0 || + vx_opt[i].vx_pd.obs_info->uv_index() >= 0) { + mlog << Warning << "\nPointStatConfInfo::process_config() -> " + << "For U-wind, found multiple matching V-wind field array entries! " + << "Set the \"level\" strings to differentiate between them.\n\n"; + } + vx_opt[i].vx_pd.fcst_info->set_uv_index(j); vx_opt[i].vx_pd.obs_info->set_uv_index(j); } } + + // No match found + if(vx_opt[i].vx_pd.fcst_info->uv_index() < 0 || + vx_opt[i].vx_pd.obs_info->uv_index() < 0) { + mlog << Debug(3) << "U-wind field array entry " << i+1 + << " has no matching V-wind field array entry.\n"; + } + } // Process v-wind else if(vx_opt[i].vx_pd.fcst_info->is_v_wind() && @@ -198,10 +217,29 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { vx_opt[j].vx_pd.obs_info->is_u_wind() && vx_opt[i].is_uv_match(vx_opt[j])) { + mlog << Debug(3) << "V-wind field array entry " << i+1 + << " matches U-wind field array entry " << j+1 << ".\n"; + + // Print warning about multiple matches + if(vx_opt[i].vx_pd.fcst_info->uv_index() >= 0 || + vx_opt[i].vx_pd.obs_info->uv_index() >= 0) { + mlog << Warning << "\nPointStatConfInfo::process_config() -> " + << "For U-wind, found multiple matching V-wind field array entries! " + << "Set the \"level\" strings to differentiate between them.\n\n"; + } + vx_opt[i].vx_pd.fcst_info->set_uv_index(j); vx_opt[i].vx_pd.obs_info->set_uv_index(j); } } + + // No match found + if(vx_opt[i].vx_pd.fcst_info->uv_index() < 0 || + vx_opt[i].vx_pd.obs_info->uv_index() < 0) { + mlog << Debug(3) << "V-wind field array entry " << i+1 + << " has no matching U-wind field array entry.\n"; + } + } } // end for i } // end if