Skip to content

Commit

Permalink
Bugfix #2897 main_v11.1 python_valid_time (#2898)
Browse files Browse the repository at this point in the history
* Per #2897, fix typos in 3 log messages. Also fix the bug in storing the valid time strings. The time string in vld_array should exactly correspond to the numeric unixtime values in vld_num_array. Therefore they need to be updated inside the same if block. The bug is that we were storing only the unique unixtime values but storing ALL of the valid time string, not just the unique ones.

* Per #2897, don’t waste time searching, just set vld_odd to n-1
  • Loading branch information
JohnHalleyGotway authored May 22, 2024
1 parent 16aac92 commit 1c1683e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/libcode/vx_pointdata_python/python_pointdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,10 @@ bool process_point_data_list(PyObject *python_point_data, MetPointDataPython &me
// get valid time index
vld_time = obs.getValidTime();
if ( !header_data->vld_num_array.has(vld_time, vld_idx) ) {
// MET #2897 keep vld_array and vld_num_array in sync
header_data->vld_array.add(obs.getValidTimeString());
header_data->vld_num_array.add(vld_time);
header_data->vld_num_array.has(vld_time, vld_idx);
vld_idx = header_data->vld_num_array.n() - 1;
}

if (!is_eq(prev_lat, lat) || !is_eq(prev_lon, lon) || !is_eq(prev_elv, elv)
Expand All @@ -364,7 +366,6 @@ bool process_point_data_list(PyObject *python_point_data, MetPointDataPython &me
header_data->sid_idx_array.add(sid);
header_data->typ_idx_array.add(typ_idx);
header_data->vld_idx_array.add(vld_idx);
header_data->vld_array.add(obs.getValidTimeString());

prev_lat = lat;
prev_lon = lon;
Expand Down Expand Up @@ -765,7 +766,7 @@ void print_met_data(MetPointObsData *obs_data, MetPointHeader *header_data,
<< header_data->vld_idx_array.n() << ", lat="
<< header_data->lat_array.n() << ", lon="
<< header_data->lon_array.n() << ", elv="
<< header_data->elv_array.n() << ", message_type="
<< header_data->elv_array.n() << ", message_type="
<< header_data->typ_array.n() << ", station_id="
<< header_data->sid_array.n() << ", valid_time="
<< header_data->vld_array.n() << ", prpt="
Expand All @@ -776,7 +777,7 @@ void print_met_data(MetPointObsData *obs_data, MetPointHeader *header_data,

log_count = (header_data->hdr_count > min_count) ? min_count : header_data->hdr_count;
mlog << Debug(debug_level) << method_name
<< "header_data: message_type,station_id,time_time,lat,lon.elv\n";
<< "header_data: message_type,station_id,time_time,lat,lon,elv\n";
for (int idx=0; idx<log_count; idx++) {
mlog << Debug(debug_level)
<< " header_data[" << idx << "] = "
Expand Down Expand Up @@ -871,7 +872,7 @@ void print_met_data(MetPointObsData *obs_data, MetPointHeader *header_data,

log_count = (obs_data->obs_cnt > min_count) ? min_count : obs_data->obs_cnt;
mlog << Debug(debug_level) << "\n" << method_name
<< "obs_data: hid,vid.level,height,value,qty\n";
<< "obs_data: hid,vid,level,height,value,qty\n";
for (int idx=0; idx<log_count; idx++) {
mlog << Debug(debug_level)
<< " obs_data[" << idx << "] = "
Expand Down

0 comments on commit 1c1683e

Please sign in to comment.