Skip to content

Commit

Permalink
Per #2279, working on debug and warning messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Oct 11, 2024
1 parent a0c1dc4 commit b086ae0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 118 deletions.
114 changes: 0 additions & 114 deletions internal/test_unit/t

This file was deleted.

3 changes: 3 additions & 0 deletions src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ struct MaskSID {
// Mask name
ConcatString name;

// Boolean for non-default weights
bool has_weights;

// Vector of SID name and corresponding weights
std::vector<std::pair<std::string,double>> sid_list;

Expand Down
11 changes: 7 additions & 4 deletions src/basic/vx_config/config_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ StringArray parse_conf_message_type(Dictionary *dict, bool error_out) {

void MaskSID::clear() {
name.clear();
has_weights = false;
sid_list.clear();
}

Expand All @@ -626,6 +627,7 @@ bool MaskSID::operator==(const MaskSID &v) const {
MaskSID &MaskSID::operator=(const MaskSID &a) noexcept {
if(this != &a) {
name = a.name;
has_weights = a.has_weights;
sid_list = a.sid_list;
}
return *this;
Expand All @@ -641,17 +643,18 @@ int MaskSID::n() const {

void MaskSID::add(const string &text) {
ConcatString sid(text);
double wgt = 1.0;
double weight = 1.0;

// Check for optional weight
StringArray sa(sid.split("("));
if(sa.n() > 1) {
sid = sa[0];
wgt = stod(sa[1]);
weight = stod(sa[1]);
has_weights = true;
}

// Store the pair
sid_list.push_back(pair<string,double>(sid,wgt));
// Store the station ID, weight pair
sid_list.push_back(pair<string,double>(sid,weight));

return;
}
Expand Down
13 changes: 13 additions & 0 deletions src/libcode/vx_statistics/pair_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,19 @@ void PairBase::set_point_weight(const PointWeightType wgt_flag) {
if(wgt_flag == PointWeightType::SID &&
mask_sid_ptr != nullptr) {

mlog << Debug(4)
<< "Applying point weights for the \""
<< mask_sid_ptr->name << "\" station ID masking region.\n";

// Print warning if no weights are provided
if(!mask_sid_ptr->has_weights) {
mlog << Warning << "\n" << method_name
<< "station ID point weighting requested but no weights "
<< "were defined in the \"" << mask_sid_ptr->name
<< "\" station ID mask. Using default weights of "
<< default_weight << ".\n\n";
}

// Loop through the point observations
for(int i_obs=0; i_obs<n_obs; i_obs++) {

Expand Down

0 comments on commit b086ae0

Please sign in to comment.