diff --git a/met/internal_tests/libcode/vx_series_data/test_series_data.cc b/met/internal_tests/libcode/vx_series_data/test_series_data.cc index f2396821cd..69b0ec000a 100644 --- a/met/internal_tests/libcode/vx_series_data/test_series_data.cc +++ b/met/internal_tests/libcode/vx_series_data/test_series_data.cc @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) { double delta = (max - min) / nbin; double width = 10; - vector pdf; + vector pdf; init_pdf(nbin, pdf); diff --git a/met/src/libcode/vx_series_data/series_pdf.cc b/met/src/libcode/vx_series_data/series_pdf.cc index 994dc16618..9e89cccb7f 100644 --- a/met/src/libcode/vx_series_data/series_pdf.cc +++ b/met/src/libcode/vx_series_data/series_pdf.cc @@ -22,7 +22,7 @@ void init_pdf( int n, - vector& pdf) { + vector& pdf) { for(int k = 0; k < n; k++) { pdf.push_back(0); @@ -35,7 +35,7 @@ void init_pdf( double min, double max, double delta, - vector& pdf) { + vector& pdf) { int n = (max - min) / delta; for(int k = 0; k < n; k++) { @@ -48,7 +48,7 @@ void init_pdf( void init_joint_pdf( int n_A, int n_B, - vector& pdf) { + vector& pdf) { for(int k = 0; k < n_A * n_B; k++) { pdf.push_back(0); @@ -60,7 +60,7 @@ void init_joint_pdf( void update_pdf( double min, double delta, - vector& pdf, + vector& pdf, const DataPlane& dp, const MaskPlane& mp) { @@ -86,7 +86,7 @@ void update_joint_pdf( double min_B, double delta_A, double delta_B, - vector& pdf, + vector& pdf, const DataPlane& dp_A, const DataPlane& dp_B, const MaskPlane& mp) { @@ -115,7 +115,7 @@ void update_joint_pdf( void print_pdf( double min, double delta, - const vector& pdf) { + const vector& pdf) { for(int k = 0; k < pdf.size(); k++) { double bin_min = min + k * delta; @@ -132,7 +132,7 @@ void write_nc_pdf( const VarInfo& info, double min, double delta, - const vector& pdf) { + const vector& pdf) { vector bin_min; vector bin_max; diff --git a/met/src/libcode/vx_series_data/series_pdf.h b/met/src/libcode/vx_series_data/series_pdf.h index 7a200357d5..de0100c820 100644 --- a/met/src/libcode/vx_series_data/series_pdf.h +++ b/met/src/libcode/vx_series_data/series_pdf.h @@ -30,7 +30,7 @@ using namespace netCDF; void init_pdf( int n, - vector& pdf); + vector& pdf); //////////////////////////////////////////////////////////////////////// @@ -38,21 +38,21 @@ void init_pdf( double min, double max, double delta, - vector& pdf); + vector& pdf); //////////////////////////////////////////////////////////////////////// void init_joint_pdf( int n_A, int n_B, - vector& pdf); + vector& pdf); //////////////////////////////////////////////////////////////////////// void update_pdf( double min, double delta, - vector& pdf, + vector& pdf, const DataPlane&, const MaskPlane&); @@ -65,7 +65,7 @@ void update_joint_pdf( double min_B, double delta_A, double delta_B, - vector& pdf, + vector& pdf, const DataPlane&, const DataPlane&, const MaskPlane&); @@ -75,7 +75,7 @@ void update_joint_pdf( void print_pdf( double min, double delta, - const vector& pdf); + const vector& pdf); //////////////////////////////////////////////////////////////////////// @@ -84,7 +84,7 @@ void write_nc_pdf( const VarInfo& info, double min, double delta, - const vector& pdf); + const vector& pdf); //////////////////////////////////////////////////////////////////////// diff --git a/met/src/tools/other/grid_diag/grid_diag.cc b/met/src/tools/other/grid_diag/grid_diag.cc index c72a81aba3..1569335d3d 100644 --- a/met/src/tools/other/grid_diag/grid_diag.cc +++ b/met/src/tools/other/grid_diag/grid_diag.cc @@ -17,6 +17,7 @@ // 000 10/01/19 Fillmore New // 001 07/28/20 Halley Gotway Updates for #1391. // 002 03/04/21 Halley Gotway Bugfix #1694. +// 003 08/20/21 Halley Gotway Bugfix #1886 for integer overflow. // //////////////////////////////////////////////////////////////////////// @@ -426,7 +427,7 @@ void setup_histograms(void) { << "Initializing " << data_info->magic_str_attr() << " histogram with " << n_bins << " bins from " << min << " to " << max << ".\n"; - histograms[i_var_str] = vector(); + histograms[i_var_str] = vector(); init_pdf(n_bins, histograms[i_var_str]); } // for i_var } @@ -456,7 +457,7 @@ void setup_joint_histograms(void) { << "Initializing " << data_info->magic_str_attr() << "_" << joint_info->magic_str_attr() << " joint histogram with " << n_bins << " x " << n_joint_bins << " bins.\n"; - joint_histograms[ij_var_str] = vector(); + joint_histograms[ij_var_str] = vector(); init_joint_pdf(n_bins, n_joint_bins, joint_histograms[ij_var_str]); @@ -568,7 +569,7 @@ void setup_nc_file(void) { ConcatString hist_name("hist_"); hist_name.add(var_name); NcDim var_dim = data_var_dims[i_var]; - NcVar hist_var = add_var(nc_out, hist_name, ncInt, var_dim, + NcVar hist_var = add_var(nc_out, hist_name, ncInt64, var_dim, deflate_level); hist_vars.push_back(hist_var); @@ -602,7 +603,7 @@ void setup_nc_file(void) { dims.push_back(var_dim); dims.push_back(joint_dim); - NcVar hist_var = add_var(nc_out, hist_name, ncInt, dims, + NcVar hist_var = add_var(nc_out, hist_name, ncInt64, dims, deflate_level); joint_hist_vars.push_back(hist_var); @@ -620,7 +621,7 @@ void write_nc_var_int(const char *var_name, const char *long_name, int n) { // Add the variable - NcVar var = add_var(nc_out, var_name, ncInt); + NcVar var = add_var(nc_out, var_name, ncInt64); add_att(&var, "long_name", long_name); if(!put_nc_data(&var, &n)) { @@ -650,7 +651,7 @@ void write_histograms(void) { VarInfo *data_info = conf_info.data_info[i_var]; NcVar hist_var = hist_vars[i_var]; - int *hist = histograms[i_var_str].data(); + long long *hist = histograms[i_var_str].data(); hist_var.putVar(hist); } @@ -676,7 +677,7 @@ void write_joint_histograms(void) { << "VAR" << i_var << "_" << "VAR" << j_var; - int *hist = joint_histograms[ij_var_str].data(); + long long *hist = joint_histograms[ij_var_str].data(); offsets.clear(); counts.clear(); diff --git a/met/src/tools/other/grid_diag/grid_diag.h b/met/src/tools/other/grid_diag/grid_diag.h index 419d6b8f50..e595ed7e96 100644 --- a/met/src/tools/other/grid_diag/grid_diag.h +++ b/met/src/tools/other/grid_diag/grid_diag.h @@ -110,8 +110,8 @@ vector var_mins; vector var_maxs; // Variable histogram map -map > histograms; -map > joint_histograms; +map > histograms; +map > joint_histograms; map > bin_mins; map > bin_maxs; map > bin_mids;