From 889dfb2d1334be006c7e8075257a32afa8664a53 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 10 Jan 2023 15:38:24 -0700 Subject: [PATCH 1/4] #2387 Convert integer to string for log message --- src/libcode/vx_nc_obs/nc_obs_util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_nc_obs/nc_obs_util.cc b/src/libcode/vx_nc_obs/nc_obs_util.cc index 8f5a019280..e40f65c8db 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.cc +++ b/src/libcode/vx_nc_obs/nc_obs_util.cc @@ -1013,9 +1013,9 @@ void NetcdfObsVars::write_header_to_nc(NcDataBuffer &data_buf, ConcatString log_message; if (is_prepbufr) { log_message.add(", pb_hdr_data_offset: "); - log_message.add(data_buf.pb_hdr_data_offset); + log_message.add(std::to_string(data_buf.pb_hdr_data_offset)); log_message.add(", raw_hdr_cnt: "); - log_message.add(raw_hdr_cnt); + log_message.add(std::to_string(raw_hdr_cnt)); } mlog << Debug(7) << method_name << " buf_size: " << buf_size From 2ca846af5894684a84f303de7e4afd1494d66fad Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 10 Jan 2023 15:40:08 -0700 Subject: [PATCH 2/4] #2387 Do not increase n_file_obs when n_derived_obs is increased --- src/tools/other/pb2nc/pb2nc.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index 07f6f57a33..a333b89277 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -445,6 +445,10 @@ int met_main(int argc, char *argv[]) { process_pbfile(i); } + mlog << Debug(2) + << "\nTotal Observations retained\t\t= " << n_total_obs << "\n"; + + if (do_summary) { TimeSummaryInfo summaryInfo = conf_info.getSummaryInfo(); summary_obs->summarizeObs(summaryInfo); @@ -948,8 +952,8 @@ void process_pbfile(int i_pb) { } // Initialize counts - n_derived_obs = 0; - i_ret = n_file_obs = i_msg = 0; + n_derived_obs = n_file_obs = 0; + i_ret = i_msg = 0; rej_typ = rej_sid = rej_vld = rej_grid = rej_poly = 0; rej_elv = rej_pb_rpt = rej_in_rpt = rej_itp = rej_nobs = 0; @@ -1581,7 +1585,6 @@ void process_pbfile(int i_pb) { OBS_BUFFER_SIZE); // Increment the current and total observations counts - n_file_obs++; n_total_obs++; n_derived_obs++; @@ -1985,7 +1988,7 @@ void process_pbfile(int i_pb) { if(mlog.verbosity_level() > 0) cout << "\n" << flush; mlog << Debug(2) - << "Total Messages processed\t\t= " << npbmsg << "\n" + << "Messages processed\t\t\t= " << npbmsg << "\n" << "Rejected based on message type\t\t= " << rej_typ << "\n" << "Rejected based on station id\t\t= " @@ -2006,9 +2009,9 @@ void process_pbfile(int i_pb) { << rej_itp << "\n" << "Rejected based on zero observations\t= " << rej_nobs << "\n" - << "Total Messages retained\t\t= " + << "Messages retained\t\t\t= " << i_msg << "\n" - << "Total observations retained or derived\t= " + << "Observations retained or derived\t= " << (n_file_obs + n_derived_obs) << "\n"; if (cal_cape) { @@ -2073,11 +2076,10 @@ void process_pbfile(int i_pb) { << "Saved the derived variables only. No " << (is_prepbufr ? "PrepBufr" : "Bufr") << " messages retained from file: " << pbfile[i_pb] << "\n"; - else - mlog << Warning << "\n" << method_name - << "No " << (is_prepbufr ? "PrepBufr" : "Bufr") - << " messages retained from file: " - << pbfile[i_pb] << "\n\n"; + else mlog << Warning << "\n" << method_name + << "No " << (is_prepbufr ? "PrepBufr" : "Bufr") + << " messages retained from file: " + << pbfile[i_pb] << "\n\n"; } return; From 1dcff94cc2d89a0cf9e876f9b4d149c7671c32c0 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 10 Jan 2023 16:50:50 -0700 Subject: [PATCH 3/4] #2387 Corrected a log message --- src/tools/other/pb2nc/pb2nc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index a333b89277..4e780a3f03 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -446,7 +446,7 @@ int met_main(int argc, char *argv[]) { } mlog << Debug(2) - << "\nTotal Observations retained\t\t= " << n_total_obs << "\n"; + << "\nTotal Observations retained or derived\t= " << n_total_obs << "\n"; if (do_summary) { From 8eff3d6967be286ec43ce0f0f50ed75ed347fa90 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 10 Jan 2023 16:51:27 -0700 Subject: [PATCH 4/4] #2387 Changed to_string to str_format --- src/libcode/vx_nc_obs/nc_obs_util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_nc_obs/nc_obs_util.cc b/src/libcode/vx_nc_obs/nc_obs_util.cc index e40f65c8db..72e2a37d89 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.cc +++ b/src/libcode/vx_nc_obs/nc_obs_util.cc @@ -1013,9 +1013,9 @@ void NetcdfObsVars::write_header_to_nc(NcDataBuffer &data_buf, ConcatString log_message; if (is_prepbufr) { log_message.add(", pb_hdr_data_offset: "); - log_message.add(std::to_string(data_buf.pb_hdr_data_offset)); + log_message.add(str_format("%i", data_buf.pb_hdr_data_offset)); log_message.add(", raw_hdr_cnt: "); - log_message.add(std::to_string(raw_hdr_cnt)); + log_message.add(str_format("%i", raw_hdr_cnt)); } mlog << Debug(7) << method_name << " buf_size: " << buf_size