Skip to content

Commit

Permalink
Per #2366, add Debug(3) messages about matching U/V fields. Also, pri…
Browse files Browse the repository at this point in the history
…nt a warning message if multiple matches are found. Should this be an error instead?
  • Loading branch information
JohnHalleyGotway committed Dec 6, 2022
1 parent 8b2339a commit a7214d0
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/tools/core/grid_stat/grid_stat_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand All @@ -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
Expand Down
38 changes: 38 additions & 0 deletions src/tools/core/point_stat/point_stat_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand All @@ -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
Expand Down

0 comments on commit a7214d0

Please sign in to comment.