Skip to content

Commit

Permalink
Bugfix #2897 develop python_valid_time (#2899)
Browse files Browse the repository at this point in the history
* Per #2897, fix typos in 2 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, minor change to formatting of log message

* MET #2897, don’t waste time searching, just set the index to n - 1

* Per #2897, remove unused add_prec_point_obs(...) function

* Per #2897, update add_point_obs(...) logic for DEBUG(9) to print very detailed log messages about what obs are being rejected and which are being used for each verification task.

* Per #2897, refine the 'using' log message to make the wording consistent with the summary rejection reason counts log message

* Per #2897, update the User's Guide about -v 9 for Point-Stat

---------

Co-authored-by: j-opatz <jopatz@ucar.edu>
Co-authored-by: MET Tools Test Account <met_test@seneca.rap.ucar.edu>
  • Loading branch information
3 people authored May 22, 2024
1 parent 889f1b2 commit 663fda7
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 79 deletions.
5 changes: 5 additions & 0 deletions docs/Users_Guide/appendixA.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ Q. How can I understand the number of matched pairs?
in the configuration file. So all of the 1166 observations are rejected
for the same reason.

In addition, running point_stat with at least verbosity level 9 (-v 9)
will result in a log message being printed to explain why each
observation is skipped or retained for each verification task.
This level of detail is intended only for debugging purposes.

Q. What types of NetCDF files can MET read?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion docs/Users_Guide/point-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Practical Information

The Point-Stat tool is used to perform verification of a gridded model field using point observations. The gridded model field to be verified must be in one of the supported file formats. The point observations must be formatted as the NetCDF output of the point reformatting tools described in :numref:`reformat_point`. The Point-Stat tool provides the capability of interpolating the gridded forecast data to the observation points using a variety of methods as described in :numref:`matching-methods`. The Point-Stat tool computes a number of continuous statistics on the matched pair data as well as discrete statistics once the matched pair data have been thresholded.

If no matched pairs are found for a particular verification task, a report listing counts for reasons why the observations were not used is written to the log output at the default verbosity level of 2. If matched pairs are found, this report is written at verbosity level 3. Inspecting these rejection reason counts is the first step in determining why Point-Stat found no matched pairs. The order of the log messages matches the order in which the processing logic is applied. Start from the last log message and work your way up, considering each of the non-zero rejection reason counts.
If no matched pairs are found for a particular verification task, a report listing counts for reasons why the observations were not used is written to the log output at the default verbosity level of 2. If matched pairs are found, this report is written at verbosity level 3. Inspecting these rejection reason counts is the first step in determining why Point-Stat found no matched pairs. The order of the log messages matches the order in which the processing logic is applied. Start from the last log message and work your way up, considering each of the non-zero rejection reason counts. Verbosity level 9 prints a very detailed explanation about why each observation is used or skipped for each verification task.

point_stat Usage
----------------
Expand Down
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 @@ -350,8 +350,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 @@ -363,7 +365,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 @@ -763,7 +764,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 @@ -774,7 +775,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 @@ -869,7 +870,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
Loading

0 comments on commit 663fda7

Please sign in to comment.