Skip to content

Commit

Permalink
#1618 Added calls numpbmsg_new_ before calling openpb_
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Jan 19, 2021
1 parent 8ed52c2 commit f235c7e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions met/src/tools/other/pb2nc/pb2nc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ static NcFile *f_out = (NcFile *) 0;

extern "C" {
void numpbmsg_(int *, int *);
void numpbmsg_new_(const char *, int *, int *);
void openpb_(const char *, int *);
void closepb_(int *);
void readpb_(int *, int *, int *, double[mxr8pm],
Expand Down Expand Up @@ -2050,14 +2051,14 @@ void process_pbfile_metadata(int i_pb) {
<< "Invalid file ID [" << unit << "] between 1 and 99.\n\n";
}

// Open the blocked temp PrepBufr file for reading
openpb_(blk_file.c_str(), &unit);

// Compute the number of PrepBufr records in the current file.
numpbmsg_(&unit, &npbmsg);
numpbmsg_new_(blk_file.c_str(), &unit, &npbmsg);
mlog << Debug(1) << method_name << " -> "
<< "the number of records: " << npbmsg << "\n";

// Open the blocked temp PrepBufr file for reading
openpb_(blk_file.c_str(), &unit);

// Use the number of records requested by the user if there
// are enough present.
if(nmsg >= 0 && nmsg <= npbmsg) {
Expand Down

0 comments on commit f235c7e

Please sign in to comment.