From a3142a1b00abdfa8c5988383ee665d71bf08680e Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 21 Oct 2024 16:45:08 -0600 Subject: [PATCH] Feature #3000 point2grid_warning (#3001) * Per #3000, change 9 warning messages to Debug(2) log messages to minimize the number of warning messages Point2Grid writes. However, do retain the warnings about problems writing the grid mapping output file. * Per #3000 very minor whitespace diffs --- src/tools/other/point2grid/point2grid.cc | 47 ++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index e527b6dd33..cd24f6bac9 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -22,7 +22,8 @@ // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main // 003 10-03-23 Prestopnik MET #2227 Remove namespace std and netCDF from header files // 004 05-20-24 Howard Soh MET #2867 Fix -qc ADP bug. -// 004 06-24-24 Halley Gotway MET #2880 Filter obs_quality. +// 005 06-24-24 Halley Gotway MET #2880 Filter obs_quality. +// 006 10-21-24 Halley Gotway MET #3000 Reduce warnings. // //////////////////////////////////////////////////////////////////////// @@ -864,8 +865,8 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI } } if (empty_input) { - mlog << Warning << "\n" << method_name - << error_msg << "\tBut ignored because of empty input\n\n"; + mlog << Debug(2) << method_name + << error_msg << "\tBut ignored because of empty input\n"; } else { mlog << Error << "\n" << method_name @@ -1060,7 +1061,7 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI if (1 < data_count) { mlog << Debug(9) << method_name - << " to_value:" << to_value + << " to_value: " << to_value << " at " << x_idx << "," << y_idx << ", max: " << dataArray.max() << ", min: " << dataArray.min() @@ -1159,14 +1160,14 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI log_msg << "."; if (0 == var_count) { if (0 == filtered_count) { - mlog << Warning << "\n" << method_name + mlog << Debug(2) << method_name << "No valid data for the variable [" - << vinfo->name() << "]\n\n"; + << vinfo->name() << "]\n"; } else { - mlog << Warning << "\n" << method_name + mlog << Debug(2) << method_name << "No valid data after filtering.\n\t" - << log_msg << "\n\n"; + << log_msg << "\n"; } } else { @@ -1644,8 +1645,8 @@ static void regrid_nc_variable(NcFile *nc_in, Met2dDataFile *fr_mtddf, << "]\n"; if (to_cell_cnt == 0) { - mlog << Warning << "\n" << method_name - << " There are no matching cells between input and the target grid.\n\n"; + mlog << Debug(2) << method_name + << "There are no matching cells between input and the target grid.\n"; } mlog << Debug(LEVEL_FOR_PERFORMANCE) << method_name << "took " @@ -2025,8 +2026,8 @@ static bool get_grid_mapping(const Grid &to_grid, IntArray *cellMapping, int obs_count = obs_index_array.n(); if (0 == obs_count) { - mlog << Warning << "\n" << method_name - << "no valid point observation data!\n\n"; + mlog << Debug(2) << method_name + << "no valid point observation data!\n"; return status; } @@ -2054,8 +2055,8 @@ static bool get_grid_mapping(const Grid &to_grid, IntArray *cellMapping, } if (0 == count_in_grid) - mlog << Warning << "\n" << method_name - << "no valid point observation data within to grid\n\n"; + mlog << Debug(2) << method_name + << "no valid point observation data within to grid\n"; else { status = true; mlog << Debug(3) << method_name << "count in grid: " << count_in_grid @@ -2090,7 +2091,7 @@ static void get_grid_mapping_latlon( vector mapping_indices(data_size, bad_data_int); to_grid.xy_to_latlon(0, 0, to_ll_lat, to_ll_lon); - mlog << Debug(5) << method_name << " to_grid ll corner: (" << to_ll_lon << ", " << to_ll_lat << ")\n"; + mlog << Debug(5) << method_name << "to_grid ll corner: (" << to_ll_lon << ", " << to_ll_lat << ")\n"; //Count the number of cells to be mapped to TO_GRID //Following the logic at DataPlane::two_to_one(int x, int y) n = y*Nx + x; @@ -2118,7 +2119,7 @@ static void get_grid_mapping_latlon( double to_lat; double to_lon; to_grid.xy_to_latlon(idx_x, idx_y, to_lat, to_lon); - mlog << Debug(15) << method_name << " index: [" << xIdx << "," << yIdx << "] to " << coord_offset + mlog << Debug(15) << method_name << "index: [" << xIdx << "," << yIdx << "] to " << coord_offset << " (" << lon << ", " << lat << ") to (" << rescale_lon(-1*to_lon) << ", " << to_lat << ")\n"; } } @@ -2392,7 +2393,7 @@ static void get_grid_mapping(const Grid &fr_grid, const Grid &to_grid, IntArray if (!is_eq(latitudes[idx], tmp_lats[idx], loose_tol)) { lat_mis_matching_count++; mlog << Warning << "\n" << method_name - << "diff lat at " << idx << " binary-computing: " + << "diff lat at " << idx << " binary-computing: " << latitudes[idx] << " - " << tmp_lats[idx] << " = " << (latitudes[idx]-tmp_lats[idx]) << "\n\n"; } @@ -2403,7 +2404,7 @@ static void get_grid_mapping(const Grid &fr_grid, const Grid &to_grid, IntArray if (!is_eq(longitudes[idx], tmp_lons[idx], loose_tol)) { lon_mis_matching_count++; mlog << Warning << "\n" << method_name - << "diff lon at " << idx << " binary-computing: " + << "diff lon at " << idx << " binary-computing: " << longitudes[idx] << " - " << tmp_lons[idx] << " = " << (longitudes[idx]-tmp_lons[idx]) << "\n\n"; } @@ -2622,10 +2623,10 @@ static void regrid_goes_variable(NcFile *nc_in, const VarInfo *vinfo, } } else { - mlog << Warning << "\n" << method_name + mlog << Debug(2) << method_name << "QC var name (" << qc_var_name << " for " << GET_NC_NAME(var_adp) - << ") does not exist.\n\n"; + << ") does not exist.\n"; } } } @@ -2641,7 +2642,7 @@ static void regrid_goes_variable(NcFile *nc_in, const VarInfo *vinfo, mlog << Debug(3) << method_name << "found QC var: " << qc_var_name << ".\n"; } else { - mlog << Warning << "\n" << method_name + mlog << Debug(2) << method_name << "QC var name (" << qc_var_name << ") does not exist.\n"; } @@ -2839,8 +2840,8 @@ static void regrid_goes_variable(NcFile *nc_in, const VarInfo *vinfo, } if (to_cell_count == 0) { - mlog << Warning << "\n" << method_name - << "No valid data!\n\n"; + mlog << Debug(2) << method_name + << "No valid data!\n"; } mlog << Debug(LEVEL_FOR_PERFORMANCE) << method_name << "took "