diff --git a/met/src/libcode/vx_tc_util/prob_gen_info.cc b/met/src/libcode/vx_tc_util/prob_gen_info.cc index 77ef2b9007..732df86384 100644 --- a/met/src/libcode/vx_tc_util/prob_gen_info.cc +++ b/met/src/libcode/vx_tc_util/prob_gen_info.cc @@ -77,8 +77,8 @@ void ProbGenInfo::clear() { Initials.clear(); GenOrDis.clear(); - GenTime = (unixtime) 0; - + GenesisTime = (unixtime) 0; + GenesisLead = 0; BestGen = (const GenesisInfo *) 0; return; @@ -93,7 +93,8 @@ void ProbGenInfo::dump(ostream &out, int indent_depth) const { out << prefix << "Initials = \"" << Initials.contents() << "\"\n"; out << prefix << "GenOrDis = \"" << GenOrDis.contents() << "\"\n"; - out << prefix << "GenTime = " << unix_to_yyyymmdd_hhmmss(GenTime) << "\n"; + out << prefix << "GenesisTime = " << unix_to_yyyymmdd_hhmmss(GenesisTime) << "\n"; + out << prefix << "GenesisLead = " << sec_to_hhmmss(GenesisLead) << "\n"; out << prefix << "BestGen = " << (BestGen ? "set" : "(nul)") << "\n"; out << flush; @@ -111,7 +112,8 @@ ConcatString ProbGenInfo::serialize() const { << ", ProbGenInfo: " << "Initials = \"" << Initials << "\"" << ", GenOrDis = \"" << GenOrDis << "\"" - << ", GenTime = " << unix_to_yyyymmdd_hhmmss(GenTime) + << ", GenesisTime = " << unix_to_yyyymmdd_hhmmss(GenesisTime) + << ", GenesisLead = " << sec_to_hhmmss(GenesisLead) << ", BestGen = " << (BestGen ? "set" : "(nul)") << "\n"; return(s); @@ -135,11 +137,11 @@ void ProbGenInfo::assign(const ProbGenInfo &p) { ProbInfoBase::assign(p); - Initials = p.Initials; - GenOrDis = p.GenOrDis; - GenTime = p.GenTime; - - BestGen = p.BestGen; + Initials = p.Initials; + GenOrDis = p.GenOrDis; + GenesisTime = p.GenesisTime; + GenesisLead = p.GenesisLead; + BestGen = p.BestGen; return; } @@ -155,6 +157,14 @@ void ProbGenInfo::set_best_gen(const GenesisInfo *bg) { //////////////////////////////////////////////////////////////////////// +int ProbGenInfo::genesis_fhr() const { + return(is_bad_data(GenesisLead) ? + bad_data_int : + nint((double) GenesisLead/sec_per_hour)); +} + +//////////////////////////////////////////////////////////////////////// + void ProbGenInfo::initialize(const ATCFProbLine &l, double dland) { clear(); @@ -165,9 +175,11 @@ void ProbGenInfo::initialize(const ATCFProbLine &l, double dland) { GenOrDis = l.get_item(ProbGenOrDisOffset); // Store an empty string as unixtime 0 - GenTime = (l.get_item(ProbGenTimeOffset).empty() ? - (unixtime) 0 : - parse_time(l.get_item(ProbGenTimeOffset).c_str())); + GenesisTime = (l.get_item(ProbGenTimeOffset).empty() ? + (unixtime) 0 : + parse_time(l.get_item(ProbGenTimeOffset).c_str())); + GenesisLead = (GenesisTime == 0 ? bad_data_int : + GenesisTime - InitTime); BestGen = (const GenesisInfo *) 0; @@ -184,7 +196,7 @@ bool ProbGenInfo::is_match(const ATCFProbLine &l) const { (unixtime) 0 : parse_time(l.get_item(ProbGenTimeOffset).c_str())); - return(GenTime == gen_ut); + return(GenesisTime == gen_ut); } //////////////////////////////////////////////////////////////////////// @@ -225,8 +237,8 @@ bool ProbGenInfo::is_match(const TrackPoint &p, const double rad, const int beg, const int end) const { // Check for matching in time and space - return(p.valid() >= (GenTime + beg) && - p.valid() <= (GenTime + end) && + return(p.valid() >= (GenesisTime + beg) && + p.valid() <= (GenesisTime + end) && gc_dist(Lat, Lon, p.lat(), p.lon()) <= rad); } diff --git a/met/src/libcode/vx_tc_util/prob_gen_info.h b/met/src/libcode/vx_tc_util/prob_gen_info.h index 7ee0d75eb8..9e09749fa4 100644 --- a/met/src/libcode/vx_tc_util/prob_gen_info.h +++ b/met/src/libcode/vx_tc_util/prob_gen_info.h @@ -36,7 +36,8 @@ class ProbGenInfo : public ProbInfoBase { // Probability of Genesis specific values ConcatString Initials; ConcatString GenOrDis; - unixtime GenTime; + unixtime GenesisTime; + int GenesisLead; // Pointer to the matching BEST genesis event const GenesisInfo * BestGen; @@ -64,10 +65,12 @@ class ProbGenInfo : public ProbInfoBase { // get stuff // - const ConcatString & initials() const; - const ConcatString & gen_or_dis() const; - unixtime gen_time() const; - const GenesisInfo * best_gen() const; + const ConcatString & initials() const; + const ConcatString & gen_or_dis() const; + unixtime genesis_time() const; + int genesis_lead() const; + int genesis_fhr() const; + const GenesisInfo * best_gen() const; // // do stuff @@ -86,10 +89,11 @@ class ProbGenInfo : public ProbInfoBase { //////////////////////////////////////////////////////////////////////// -inline const ConcatString & ProbGenInfo::initials() const { return(Initials); } -inline const ConcatString & ProbGenInfo::gen_or_dis() const { return(GenOrDis); } -inline unixtime ProbGenInfo::gen_time() const { return(GenTime); } -inline const GenesisInfo * ProbGenInfo::best_gen() const { return(BestGen); } +inline const ConcatString & ProbGenInfo::initials() const { return(Initials); } +inline const ConcatString & ProbGenInfo::gen_or_dis() const { return(GenOrDis); } +inline unixtime ProbGenInfo::genesis_time() const { return(GenesisTime); } +inline int ProbGenInfo::genesis_lead() const { return(GenesisLead); } +inline const GenesisInfo * ProbGenInfo::best_gen() const { return(BestGen); } ////////////////////////////////////////////////////////////////////////