Skip to content

Commit

Permalink
Feature #3000 point2grid_warning (#3001)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
JohnHalleyGotway authored Oct 21, 2024
1 parent a9f21fa commit a3142a1
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions src/tools/other/point2grid/point2grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 "
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2090,7 +2091,7 @@ static void get_grid_mapping_latlon(
vector<int> 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;
Expand Down Expand Up @@ -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";
}
}
Expand Down Expand Up @@ -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";
}
Expand All @@ -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";
}
Expand Down Expand Up @@ -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";
}
}
}
Expand All @@ -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";
}
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit a3142a1

Please sign in to comment.