Skip to content

Commit

Permalink
Merge pull request #2400 from dtcenter/bugfix_2387_pb2nc_obs_count
Browse files Browse the repository at this point in the history
Bugfix 2387 pb2nc obs count
  • Loading branch information
hsoh-u authored Jan 13, 2023
2 parents 1741cae + 8eff3d6 commit 0163b9b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/libcode/vx_nc_obs/nc_obs_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(str_format("%i", data_buf.pb_hdr_data_offset));
log_message.add(", raw_hdr_cnt: ");
log_message.add(raw_hdr_cnt);
log_message.add(str_format("%i", raw_hdr_cnt));
}

mlog << Debug(7) << method_name << " buf_size: " << buf_size
Expand Down
24 changes: 13 additions & 11 deletions src/tools/other/pb2nc/pb2nc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ int met_main(int argc, char *argv[]) {
process_pbfile(i);
}

mlog << Debug(2)
<< "\nTotal Observations retained or derived\t= " << n_total_obs << "\n";


if (do_summary) {
TimeSummaryInfo summaryInfo = conf_info.getSummaryInfo();
summary_obs->summarizeObs(summaryInfo);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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++;

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

0 comments on commit 0163b9b

Please sign in to comment.