Skip to content

Commit

Permalink
Per #2321, fix tc_stat parsing of the TCDIAG TRACK_SOURCE and FIELD_S…
Browse files Browse the repository at this point in the history
…OURCE columns.
  • Loading branch information
JohnHalleyGotway committed Nov 16, 2022
1 parent cadbf57 commit e817729
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/libcode/vx_tc_util/track_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ inline void TrackInfo::set_init(const unixtime u) { InitTime = u;
inline void TrackInfo::set_valid_min(const unixtime u) { MinValidTime = u; }
inline void TrackInfo::set_valid_max(const unixtime u) { MaxValidTime = u; }
inline void TrackInfo::set_diag_source(DiagType t) { DiagSource = t; }
inline void TrackInfo::set_track_source(const char *s) { TrackSource = s; }
inline void TrackInfo::set_field_source(const char *s) { FieldSource = s; }
inline void TrackInfo::set_diag_name(const StringArray &s) { DiagName = s; }

inline const ConcatString & TrackInfo::storm_id() const { return(StormId); }
Expand Down
38 changes: 30 additions & 8 deletions src/libcode/vx_tc_util/track_pair_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,21 +471,43 @@ void TrackPairInfo::add_tcdiag_line(const TCStatLine &l) {
// Name of diagnostics read
StringArray diag_name;

// Diagnostic source type
DiagType t = string_to_diagtype(l.get_item("DIAG_SOURCE"));

// Make sure the source type does not change
// Make sure DIAG_SOURCE does not change
DiagType diag_source = string_to_diagtype(l.get_item("DIAG_SOURCE"));
if(ADeck.diag_source() != DiagType_None &&
ADeck.diag_source() != t) {
ADeck.diag_source() != diag_source) {
mlog << Error << "\nTrackPairInfo::add_tcdiag_line() -> "
<< "the diagnostic source type has changed ("
<< diagtype_to_string(ADeck.diag_source()) << " != "
<< diagtype_to_string(t) << ")!\n\n";
<< diagtype_to_string(diag_source) << ")!\n\n";
exit(1);
}

// Make sure TRACK_SOURCE does not change
ConcatString track_source = l.get_item("TRACK_SOURCE");
if(ADeck.track_source().length() > 0 &&
ADeck.track_source() != track_source) {
mlog << Error << "\nTrackPairInfo::add_tcdiag_line() -> "
<< "the diagnostic track source has changed ("
<< ADeck.track_source() << " != "
<< track_source << ")!\n\n";
exit(1);
}

// Make sure FIELD_SOURCE does not change
ConcatString field_source = l.get_item("FIELD_SOURCE");
if(ADeck.field_source().length() > 0 &&
ADeck.field_source() != field_source) {
mlog << Error << "\nTrackPairInfo::add_tcdiag_line() -> "
<< "the diagnostic field source has changed ("
<< ADeck.field_source() << " != "
<< field_source << ")!\n\n";
exit(1);
}

// Store the source type
ADeck.set_diag_source(t);
// Store the diagnostic metadata
ADeck.set_diag_source(diag_source);
ADeck.set_track_source(track_source.c_str());
ADeck.set_field_source(field_source.c_str());

// Number of diagnostics
n_diag = atoi(l.get_item("N_DIAG"));
Expand Down

0 comments on commit e817729

Please sign in to comment.