Skip to content

Commit

Permalink
Per #1714, fix an error in the logic of GenesisInfo::is_match(const G…
Browse files Browse the repository at this point in the history
…enesisInfo &,...). I was using the index of the current GenesisInfo object instead of the one from the input argument. Fix this by adding GenesisInfo::genesis() member function to return a reference the TrackPoint for Genesis.
  • Loading branch information
John Halley Gotway committed Apr 8, 2021
1 parent f9457f6 commit f35a777
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions met/src/libcode/vx_tc_util/genesis_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ void GenesisInfo::set_dland(double d) {

bool GenesisInfo::set(const TrackInfo &ti,
const GenesisEventInfo &event_info) {

// Initialize
clear();

Expand Down Expand Up @@ -298,6 +299,12 @@ int GenesisInfo::genesis_fhr() const {

////////////////////////////////////////////////////////////////////////

const TrackPoint * GenesisInfo::genesis() const {
return(is_bad_data(GenesisIndex) ? 0 : &(Point[GenesisIndex]));
}

////////////////////////////////////////////////////////////////////////

bool GenesisInfo::is_match(const TrackPoint &p, const double rad,
const int beg, const int end) const {

Expand All @@ -312,8 +319,10 @@ bool GenesisInfo::is_match(const TrackPoint &p, const double rad,
bool GenesisInfo::is_match(const GenesisInfo &gi, const double rad,
const int beg, const int end) const {

return(is_bad_data(GenesisIndex) ? false :
is_match(gi[GenesisIndex], rad, beg, end));
// Input genesis point
const TrackPoint *p = gi.genesis();

return(p ? is_match(*p, rad, beg, end) : false);
}

////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions met/src/libcode/vx_tc_util/genesis_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class GenesisInfo : public TrackInfo {
// get stuff
//

const TrackPoint *genesis() const;

double lat() const;
double lon() const;
double dland() const;
Expand Down
4 changes: 1 addition & 3 deletions met/src/tools/tc_utils/tc_gen/tc_gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,7 @@ int find_genesis_match(const GenesisInfo &fcst_gi,
const TrackInfoArray &ota,
bool point2track, double rad,
int beg, int end) {
int i, j;
int i_best = bad_data_int;
int i_oper = bad_data_int;
int i, j, i_best, i_oper;

ConcatString case_cs;
case_cs << fcst_gi.technique() << " "
Expand Down

0 comments on commit f35a777

Please sign in to comment.