Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #3054 main_v12.0 parusr #3068

Merged
merged 4 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/libcode/vx_statistics/pair_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -707,20 +707,21 @@ void PairBase::calc_obs_summary(){
// iterate over the keys in the unique station id map
for(int i=0; i<map_key.n(); i++) {

station_values_t svt = map_val[map_key[i]];
station_values_t * svt = &map_val[map_key[i]];

// parse the single key string
char** mat = nullptr;
if( 5 != regex_apply("^([^:]+):([^:]+):([^:]+):([^:]+)$", 5,
map_key[i].c_str(), mat) ){
if(5 != regex_apply("^([^:]+):([^:]+):([^:]+):([^:]+)$", 5,
map_key[i].c_str(), mat) ){
mlog << Error << "\nPairBase::calc_obs_summary() -> "
<< "regex_apply failed to parse '"
<< map_key[i] << "'\n\n";
exit(1);
}

string msg_key = str_format("%s:%s:%s:%s", mat[1], mat[2], mat[3],
mat[4]).text();
string msg_key = str_format("%s:%s:%s:%s",
mat[1], mat[2],
mat[3], mat[4]).text();

ob_val_t ob;

Expand Down Expand Up @@ -754,21 +755,22 @@ void PairBase::calc_obs_summary(){
}

// Store summarized value in the map
svt.summary_val = ob.val;

typ_sa.add (svt.typ.c_str());
sid_sa.add (svt.sid.c_str());
lat_na.add (svt.lat);
lon_na.add (svt.lon);
x_na.add (svt.x);
y_na.add (svt.y);
wgt_na.add (svt.wgt);
svt->summary_val = ob.val;

typ_sa.add (svt->typ.c_str());
sid_sa.add (svt->sid.c_str());
lat_na.add (svt->lat);
lon_na.add (svt->lon);
x_na.add (svt->x);
y_na.add (svt->y);
wgt_na.add (svt->wgt);
vld_ta.add (ob.ut);
lvl_na.add (svt.lvl);
elv_na.add (svt.elv);
lvl_na.add (svt->lvl);
elv_na.add (svt->elv);
o_na.add (ob.val);
o_qc_sa.add (ob.qc.c_str());
ClimoPntInfo cpi(svt.fcmn, svt.fcsd, svt.ocmn, svt.ocsd);
ClimoPntInfo cpi(svt->fcmn, svt->fcsd,
svt->ocmn, svt->ocsd);
add_climo(ob.val, cpi);

// Increment the number of pairs
Expand Down
6 changes: 3 additions & 3 deletions src/tools/other/pb2nc/pb2nc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
// 019 07/21/23 Prestopnik, J. MET #2615 Add #include <array> to compile
// successfully using gcc12
// 020 08/26/24 Halley Gotway MET #2938 Silence center time warnings
// 021 01/30/25 Halley Gotway MET #3054 Fix PARUSR BUFRLIB error
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -2444,10 +2445,9 @@ void process_pbfile_metadata(int i_pb) {

int bufr_var_index = 0;
bool has_prepbufr_vars = false;
const char * tmp_var_name;
bufr_obs_name_arr.clear();
for (index=0; index<prepbufr_vars.n(); index++) {
tmp_var_name = prepbufr_vars[index].c_str();
const string tmp_var_name = prepbufr_vars[index].c_str();
if (do_all_vars || bufr_target_variables.has(tmp_var_name, false)) {
if (tableB_vars.has(tmp_var_name)) {
bufr_obs_name_arr.add(tmp_var_name);
Expand All @@ -2460,7 +2460,7 @@ void process_pbfile_metadata(int i_pb) {
bufr_derive_cfgs.clear();
if (has_prepbufr_vars) {
for (int vIdx=0; vIdx< prepbufr_derive_vars.n(); vIdx++) {
tmp_var_name = prepbufr_derive_vars[vIdx].c_str();
const string tmp_var_name = prepbufr_derive_vars[vIdx].c_str();
bufr_derive_cfgs.push_back(derive_var_cfg(tmp_var_name));
if (do_all_vars || bufr_target_variables.has(tmp_var_name)) {
// Set the variable index if requested
Expand Down