Adding impact based warnings to ibw namespace

This commit is contained in:
Dan Paulat 2024-09-16 21:13:45 -05:00
parent 38a2831779
commit 7101cdf183
6 changed files with 29 additions and 23 deletions

View file

@ -9,6 +9,8 @@ namespace scwx
{
namespace awips
{
namespace ibw
{
enum class ThreatCategory : int
{
@ -32,5 +34,6 @@ const ImpactBasedWarningInfo& GetImpactBasedWarningInfo(Phenomenon phenomenon);
ThreatCategory GetThreatCategory(const std::string& name);
const std::string& GetThreatCategoryName(ThreatCategory threatCategory);
} // namespace ibw
} // namespace awips
} // namespace scwx

View file

@ -64,9 +64,9 @@ struct Segment
std::optional<CodedLocation> codedLocation_ {};
std::optional<CodedTimeMotionLocation> codedMotion_ {};
bool observed_ {false};
ThreatCategory threatCategory_ {ThreatCategory::Base};
bool tornadoPossible_ {false};
bool observed_ {false};
ibw::ThreatCategory threatCategory_ {ibw::ThreatCategory::Base};
bool tornadoPossible_ {false};
Segment() = default;

View file

@ -10,8 +10,10 @@ namespace scwx
{
namespace awips
{
namespace ibw
{
static const std::string logPrefix_ = "scwx::awips::impact_based_warnings";
static const std::string logPrefix_ = "scwx::awips::ibw::impact_based_warnings";
static const boost::unordered_flat_map<Phenomenon, ImpactBasedWarningInfo>
impactBasedWarningInfo_ {
@ -62,5 +64,6 @@ const std::string& GetThreatCategoryName(ThreatCategory threatCategory)
return threatCategoryName_.at(threatCategory);
}
} // namespace ibw
} // namespace awips
} // namespace scwx

View file

@ -378,7 +378,7 @@ void ParseCodedInformation(std::shared_ptr<Segment> segment,
segment->tornadoPossible_ = true;
}
else if (segment->threatCategory_ == ThreatCategory::Base &&
else if (segment->threatCategory_ == ibw::ThreatCategory::Base &&
(threatTagIt = std::find_if(kThreatCategoryTags.cbegin(),
kThreatCategoryTags.cend(),
[&it](const std::string& tag) {
@ -389,18 +389,19 @@ void ParseCodedInformation(std::shared_ptr<Segment> segment,
const std::string threatCategoryName =
it->substr(threatTagIt->length());
ThreatCategory threatCategory = GetThreatCategory(threatCategoryName);
ibw::ThreatCategory threatCategory =
ibw::GetThreatCategory(threatCategoryName);
switch (threatCategory)
{
case ThreatCategory::Significant:
case ibw::ThreatCategory::Significant:
// "Significant" is no longer an official tag, and has largely been
// replaced with "Considerable".
threatCategory = ThreatCategory::Considerable;
threatCategory = ibw::ThreatCategory::Considerable;
break;
case ThreatCategory::Unknown:
threatCategory = ThreatCategory::Base;
case ibw::ThreatCategory::Unknown:
threatCategory = ibw::ThreatCategory::Base;
break;
default: