Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 1768 edeck #1769

Merged
merged 3 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions met/src/libcode/vx_tc_util/atcf_line_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,13 @@ ATCFLineType string_to_atcflinetype(const char *s) {
else if(strlen(s) == 0) t = ATCFLineType_Track; // BDECK
else if(strcasecmp(s, "TR") == 0) t = ATCFLineType_ProbTR;
else if(strcasecmp(s, "IN") == 0) t = ATCFLineType_ProbIN;
else if(strcasecmp(s, "RI") == 0) t = ATCFLineType_ProbRIRW;
else if(strcasecmp(s, "WD") == 0) t = ATCFLineType_ProbWD;
else if(strcasecmp(s, "RI") == 0) t = ATCFLineType_ProbRI;
else if(strcasecmp(s, "RW") == 0) t = ATCFLineType_ProbRW;
else if(strcasecmp(s, "WR") == 0) t = ATCFLineType_ProbWR;
else if(strcasecmp(s, "PR") == 0) t = ATCFLineType_ProbPR;
else if(strcasecmp(s, "GN") == 0) t = ATCFLineType_ProbGN;
else if(strcasecmp(s, "GS") == 0) t = ATCFLineType_ProbGS;
else if(strcasecmp(s, "ER") == 0) t = ATCFLineType_ProbER;
else t = NoATCFLineType;

return(t);
Expand All @@ -502,11 +504,13 @@ ConcatString atcflinetype_to_string(const ATCFLineType t) {
case ATCFLineType_GenTrack: s = "GenTrack"; break;
case ATCFLineType_ProbTR: s = "ProbTR"; break;
case ATCFLineType_ProbIN: s = "ProbIN"; break;
case ATCFLineType_ProbRIRW: s = "ProbRIRW"; break;
case ATCFLineType_ProbWD: s = "ProbWD"; break;
case ATCFLineType_ProbRI: s = "ProbRI"; break;
case ATCFLineType_ProbRW: s = "ProbRW"; break;
case ATCFLineType_ProbWR: s = "ProbWR"; break;
case ATCFLineType_ProbPR: s = "ProbPR"; break;
case ATCFLineType_ProbGN: s = "ProbGN"; break;
case ATCFLineType_ProbGS: s = "ProbGS"; break;
case ATCFLineType_ProbER: s = "ProbER"; break;
case NoATCFLineType: s = na_str; break;
default: s = na_str; break;
}
Expand Down
11 changes: 8 additions & 3 deletions met/src/libcode/vx_tc_util/atcf_line_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

////////////////////////////////////////////////////////////////////////
//
// Based on Best Track file format information at:
// Best Track file format information:
// http://www.nrlmry.navy.mil/atcf_web/docs/database/new/abrdeck.html
//
// EDeck file format information:
// https://www.nrlmry.navy.mil/atcf_web/docs/database/new/edeck.txt
//
////////////////////////////////////////////////////////////////////////

#include <iostream>
Expand All @@ -31,11 +34,13 @@ enum ATCFLineType {
ATCFLineType_GenTrack, // Genesis Track and intensity line type (numeric)
ATCFLineType_ProbTR, // Track probability (TR)
ATCFLineType_ProbIN, // Intensity probability (IN)
ATCFLineType_ProbRIRW, // Rapid intensification probability (RI)
ATCFLineType_ProbWD, // Wind radii probability (WD)
ATCFLineType_ProbRI, // Rapid intensification probability (RI)
ATCFLineType_ProbRW, // Rapid weakening probability (RW)
ATCFLineType_ProbWR, // Wind radii probability (WR)
ATCFLineType_ProbPR, // Pressure probability (PR)
ATCFLineType_ProbGN, // TC genesis probability (GN)
ATCFLineType_ProbGS, // TC genesis shape probability (GS)
ATCFLineType_ProbER, // Eyewall replacement probability (ER)

NoATCFLineType
};
Expand Down
57 changes: 31 additions & 26 deletions met/src/libcode/vx_tc_util/atcf_prob_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void ATCFProbLine::dump(ostream &out, int indent_depth) const {
////////////////////////////////////////////////////////////////////////

void ATCFProbLine::clear() {

ATCFLineBase::clear();

return;
Expand All @@ -106,40 +107,44 @@ void ATCFProbLine::clear() {
////////////////////////////////////////////////////////////////////////

int ATCFProbLine::read_line(LineDataFile * ldf) {
int status;
int status = 0;
int n_expect;

clear();
// Read lines until good status is found
while(status == 0) {

clear();

status = ATCFLineBase::read_line(ldf);
// Return bad status from the base class
if(!(status = ATCFLineBase::read_line(ldf))) return(0);

// Check for bad return status or blank line
if(!status) return(0);
// Check the line type
switch(Type) {
case ATCFLineType_ProbRI:
n_expect = MinATCFProbRIRWElements;
break;

// Check the line type
switch(Type) {
case ATCFLineType_ProbRIRW:
n_expect = MinATCFProbRIRWElements;
break;
default:
mlog << Debug(4)
<< "ATCFProbLine::read_line(LineDataFile * ldf) -> "
<< "skipping ATCF line type ("
<< atcflinetype_to_string(Type) << ")\n";
status = 0;
continue;
}

default:
// Check for the minumum number of elements
if(n_items() < n_expect) {
mlog << Warning
<< "\nint ATCFProbLine::read_line(LineDataFile * ldf) -> "
<< "unexpected ATCF line type ("
<< atcflinetype_to_string(Type) << ")\n\n";
return(0);
}

// Check for the minumum number of elements
if(n_items() < n_expect) {
mlog << Warning
<< "\nint ATCFProbLine::read_line(LineDataFile * ldf) -> "
<< "found fewer than the expected number of elements ("
<< n_items() << "<" << n_expect
<< ") in ATCF " << atcflinetype_to_string(Type) << " line:\n"
<< DataLine::get_line() << "\n\n";
return(0);
}
<< "found fewer than the expected number of elements ("
<< n_items() << "<" << n_expect
<< ") in ATCF " << atcflinetype_to_string(Type) << " line:\n"
<< DataLine::get_line() << "\n\n";
status = 0;
continue;
}
}

return(1);
}
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_tc_util/prob_info_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, bool check_dup) {
// Store based on the input line type
switch(l.type()) {

case(ATCFLineType_ProbRIRW):
case(ATCFLineType_ProbRI):

// Check for no entries or a mismatch with the latest entry
if( ProbRIRW.size() == 0 ||
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_tc_util/prob_info_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void ProbInfoBase::set(const TCStatLine &l) {
switch(l.type()) {

case TCStatLineType_ProbRIRW:
Type = ATCFLineType_ProbRIRW;
Type = ATCFLineType_ProbRI;
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_tc_util/prob_pair_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ ProbPairInfoBase * new_prob_pair(const ATCFLineType t) {
ProbPairInfoBase *new_pair = (ProbPairInfoBase *) 0;

switch(t) {
case ATCFLineType_ProbRIRW:
case ATCFLineType_ProbRI:
new_pair = new ProbRIRWPairInfo;
break;

Expand Down
2 changes: 1 addition & 1 deletion met/src/tools/tc_utils/tc_pairs/tc_pairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ void filter_probs(ProbInfoArray &probs) {
}

// If we've made it here, retain this probability
if(p[i]->type() == ATCFLineType_ProbRIRW) probs.add(p.prob_rirw(i));
if(p[i]->type() == ATCFLineType_ProbRI) probs.add(p.prob_rirw(i));
}

// Print summary filtering info
Expand Down