Add precipitation accumulation products

Closes #149

(cherry picked from commit 14afeb33db929e51fa094845bc0b79e266c0f80e)
This commit is contained in:
Dan Paulat 2024-02-25 22:54:16 -06:00
parent f3b7dcddbd
commit 524de364f2
7 changed files with 83 additions and 41 deletions

View file

@ -406,7 +406,8 @@ bool RadarProductLayer::RunMousePicking(
if (units.empty() || // if (units.empty() || //
units.starts_with("?") || // units.starts_with("?") || //
boost::iequals(units, "NONE") || boost::iequals(units, "NONE") ||
boost::iequals(units, "UNITLESS")) boost::iequals(units, "UNITLESS") ||
radarProductView->IgnoreUnits())
{ {
// Don't display a units value that wasn't intended to be // Don't display a units value that wasn't intended to be
// displayed // displayed

View file

@ -8,6 +8,7 @@
#include <scwx/wsr88d/rpg/radial_data_packet.hpp> #include <scwx/wsr88d/rpg/radial_data_packet.hpp>
#include <limits> #include <limits>
#include <unordered_set>
#include <boost/range/irange.hpp> #include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp> #include <boost/timer/timer.hpp>
@ -398,6 +399,16 @@ std::optional<float> Level3ProductView::GetDataValue(std::uint16_t level) const
return descriptionBlock->data_value(static_cast<std::uint8_t>(level)); return descriptionBlock->data_value(static_cast<std::uint8_t>(level));
} }
bool Level3ProductView::IgnoreUnits() const
{
// Don't display units on these products. The current method of displaying
// units is not accurate for these.
static const std::unordered_set<std::string> kIgnoreUnitsProducts_ {
"DAA", "DTA", "DU3", "DU6"};
return (kIgnoreUnitsProducts_.contains(p->product_));
}
} // namespace view } // namespace view
} // namespace qt } // namespace qt
} // namespace scwx } // namespace scwx

View file

@ -39,6 +39,7 @@ public:
std::optional<wsr88d::DataLevelCode> std::optional<wsr88d::DataLevelCode>
GetDataLevelCode(std::uint16_t level) const override; GetDataLevelCode(std::uint16_t level) const override;
std::optional<float> GetDataValue(std::uint16_t level) const override; std::optional<float> GetDataValue(std::uint16_t level) const override;
bool IgnoreUnits() const override;
void SelectProduct(const std::string& productName) override; void SelectProduct(const std::string& productName) override;

View file

@ -144,6 +144,11 @@ RadarProductView::GetCfpMomentData() const
return std::tie(data, dataSize, componentSize); return std::tie(data, dataSize, componentSize);
} }
bool RadarProductView::IgnoreUnits() const
{
return false;
}
std::vector<std::pair<std::string, std::string>> std::vector<std::pair<std::string, std::string>>
RadarProductView::GetDescriptionFields() const RadarProductView::GetDescriptionFields() const
{ {

View file

@ -75,6 +75,7 @@ public:
virtual std::optional<wsr88d::DataLevelCode> virtual std::optional<wsr88d::DataLevelCode>
GetDataLevelCode(std::uint16_t level) const = 0; GetDataLevelCode(std::uint16_t level) const = 0;
virtual std::optional<float> GetDataValue(std::uint16_t level) const = 0; virtual std::optional<float> GetDataValue(std::uint16_t level) const = 0;
virtual bool IgnoreUnits() const;
virtual std::vector<std::pair<std::string, std::string>> virtual std::vector<std::pair<std::string, std::string>>
GetDescriptionFields() const; GetDescriptionFields() const;

View file

@ -49,11 +49,12 @@ enum class Level3ProductCategory
CorrelationCoefficient, CorrelationCoefficient,
VerticallyIntegratedLiquid, VerticallyIntegratedLiquid,
HydrometeorClassification, HydrometeorClassification,
PrecipitationAccumulation,
Unknown Unknown
}; };
typedef util::Iterator<Level3ProductCategory, typedef util::Iterator<Level3ProductCategory,
Level3ProductCategory::Reflectivity, Level3ProductCategory::Reflectivity,
Level3ProductCategory::HydrometeorClassification> Level3ProductCategory::PrecipitationAccumulation>
Level3ProductCategoryIterator; Level3ProductCategoryIterator;
typedef std::unordered_map< typedef std::unordered_map<

View file

@ -43,41 +43,44 @@ static const std::unordered_map<Level2Product, std::string> level2Palette_ {
{Level2Product::Unknown, "???"}}; {Level2Product::Unknown, "???"}};
static const std::unordered_map<int, std::string> level3ProductCodeMap_ { static const std::unordered_map<int, std::string> level3ProductCodeMap_ {
{37, "NCR"}, {30, "SW"}, {37, "NCR"}, {56, "SRM"}, {57, "NVL"}, {78, "N1P"},
{56, "SRM"}, {79, "N3P"}, {80, "NTP"}, {81, "DPA"}, {82, "SPD"}, {94, "DR"},
{57, "NVL"}, {99, "DV"}, {134, "DVL"}, {138, "DSP"}, {153, "SDR"}, {154, "SDV"},
{94, "DR"}, {159, "DZD"}, {161, "DCC"}, {163, "DKD"}, {165, "DHC"}, {166, "ML"},
{99, "DV"}, {169, "OHA"}, {170, "DAA"}, {172, "DTA"}, {173, "DUA"}, {174, "DOD"},
{134, "DVL"}, {175, "DSD"}, {177, "HHC"}, {180, "TDR"}, {182, "TDV"}};
{153, "SDR"},
{154, "SDV"},
{159, "DZD"},
{161, "DCC"},
{163, "DKD"},
{165, "DHC"},
{166, "ML"},
{177, "HHC"},
{180, "TDR"},
{182, "TDV"}};
static const std::unordered_map<std::string, std::string> static const std::unordered_map<std::string, std::string>
level3ProductDescription_ {{"SRM", "Storm Relative Mean Radial Velocity"}, level3ProductDescription_ {
{"SW", "Spectrum Width"},
{"NCR", "Composite Reflectivity"},
{"SRM", "Storm Relative Mean Radial Velocity"},
{"NVL", "Vertically Integrated Liquid"},
{"N1P", "Surface Rainfall Accumulation (1 hr)"},
{"N3P", "Surface Rainfall Accumulation (3 hr)"},
{"NTP", "Storm Total Rainfall Accumulation"},
{"DPA", "Hourly Digital Precipitation Array"},
{"SPD", "Supplemental Precipitation Data"},
{"DR", "Digital Reflectivity"}, {"DR", "Digital Reflectivity"},
{"DV", "Digital Velocity"}, {"DV", "Digital Velocity"},
{"DVL", "Digital Vertically Integrated Liquid"},
{"DSP", "Digital Storm Total Precipitation"},
{"SDR", "Super-Resolution Reflectivity"}, {"SDR", "Super-Resolution Reflectivity"},
{"SDV", "Super-Resolution Velocity"}, {"SDV", "Super-Resolution Velocity"},
{"NCR", "Composite Reflectivity"},
{"DZD", "Digital Differential Reflectivity"}, {"DZD", "Digital Differential Reflectivity"},
{"DCC", "Digital Correlation Coefficient"}, {"DCC", "Digital Correlation Coefficient"},
{"DKD", "Digital Specific Differential Phase"}, {"DKD", "Digital Specific Differential Phase"},
{"DVL", "Digital Vertically Integrated Liquid"},
{"DHC", "Digital Hydrometeor Classification"}, {"DHC", "Digital Hydrometeor Classification"},
{"HHC", "Hybrid Hydrometeor Classification"},
{"ML", "Melting Layer"}, {"ML", "Melting Layer"},
{"SW", "Spectrum Width"}, {"OHA", "One Hour Accumulation"},
{"DAA", "Digital Accumulation Array"},
{"DTA", "Digital Storm Total Accumulation"},
{"DUA", "Digital User-Selectable Accumulation"},
{"DOD", "Digital One-Hour Difference Accumulation"},
{"DSD", "Digital Storm Total Difference Accumulation"},
{"HHC", "Hybrid Hydrometeor Classification"},
{"TDR", "Digital Reflectivity"}, {"TDR", "Digital Reflectivity"},
{"TDV", "Digital Velocity"}, {"TDV", "Digital Velocity"},
{"VIL", "Vertically Integrated Liquid"},
{"?", "Unknown"}}; {"?", "Unknown"}};
static const std::unordered_map<std::string, std::vector<std::string>> static const std::unordered_map<std::string, std::vector<std::string>>
@ -110,12 +113,26 @@ static const std::unordered_map<std::string, std::vector<std::string>>
// Vertically Integrated Liquid // Vertically Integrated Liquid
{"DVL", {"DVL"}}, {"DVL", {"DVL"}},
{"VIL", {"NVL"}}, {"NVL", {"NVL"}},
// Hydrometeor Classification // Hydrometeor Classification
{"DHC", {"NXH", "NYH", "NZH", "N0H", "NAH", "N1H", "NBH", "N2H", "N3H"}}, {"DHC", {"NXH", "NYH", "NZH", "N0H", "NAH", "N1H", "NBH", "N2H", "N3H"}},
{"HHC", {"HHC"}}, {"HHC", {"HHC"}},
// Accumulation
{"N1P", {"N1P"}},
{"N3P", {"N3P"}},
{"NTP", {"NTP"}},
{"DPA", {"DPA"}},
{"SPD", {"SPD"}},
{"DSP", {"DSP"}},
{"OHA", {"OHA"}},
{"DAA", {"DAA"}},
{"DTA", {"DTA"}},
{"DUA", {"DU3", "DU6"}},
{"DOD", {"DOD"}},
{"DSD", {"DSD"}},
// Melting Layer // Melting Layer
{"ML", {"NXM", "NYM", "NZM", "N0M", "NAM", "N1M", "NBM", "N2M", "N3M"}}, {"ML", {"NXM", "NYM", "NZM", "N0M", "NAM", "N1M", "NBM", "N2M", "N3M"}},
@ -133,6 +150,7 @@ static const std::unordered_map<Level3ProductCategory, std::string>
{Level3ProductCategory::CorrelationCoefficient, "CC"}, {Level3ProductCategory::CorrelationCoefficient, "CC"},
{Level3ProductCategory::VerticallyIntegratedLiquid, "VIL"}, {Level3ProductCategory::VerticallyIntegratedLiquid, "VIL"},
{Level3ProductCategory::HydrometeorClassification, "HC"}, {Level3ProductCategory::HydrometeorClassification, "HC"},
{Level3ProductCategory::PrecipitationAccumulation, "ACC"},
{Level3ProductCategory::Unknown, "?"}}; {Level3ProductCategory::Unknown, "?"}};
static const std::unordered_map<Level3ProductCategory, std::string> static const std::unordered_map<Level3ProductCategory, std::string>
@ -151,6 +169,8 @@ static const std::unordered_map<Level3ProductCategory, std::string>
"Vertically Integrated Liquid"}, "Vertically Integrated Liquid"},
{Level3ProductCategory::HydrometeorClassification, {Level3ProductCategory::HydrometeorClassification,
"Hydrometeor Classification"}, "Hydrometeor Classification"},
{Level3ProductCategory::PrecipitationAccumulation,
"Precipitation Accumulation"},
{Level3ProductCategory::Unknown, "?"}}; {Level3ProductCategory::Unknown, "?"}};
static const std::unordered_map<Level3ProductCategory, std::vector<std::string>> static const std::unordered_map<Level3ProductCategory, std::vector<std::string>>
@ -162,8 +182,9 @@ static const std::unordered_map<Level3ProductCategory, std::vector<std::string>>
{Level3ProductCategory::DifferentialReflectivity, {"DZD"}}, {Level3ProductCategory::DifferentialReflectivity, {"DZD"}},
{Level3ProductCategory::SpecificDifferentialPhase, {"DKD"}}, {Level3ProductCategory::SpecificDifferentialPhase, {"DKD"}},
{Level3ProductCategory::CorrelationCoefficient, {"DCC"}}, {Level3ProductCategory::CorrelationCoefficient, {"DCC"}},
{Level3ProductCategory::VerticallyIntegratedLiquid, {"DVL", "VIL"}}, {Level3ProductCategory::VerticallyIntegratedLiquid, {"DVL", "NVL"}},
{Level3ProductCategory::HydrometeorClassification, {"DHC", "HHC"}}, {Level3ProductCategory::HydrometeorClassification, {"DHC", "HHC"}},
{Level3ProductCategory::PrecipitationAccumulation, {"DAA", "DTA", "DUA"}},
{Level3ProductCategory::Unknown, {}}}; {Level3ProductCategory::Unknown, {}}};
static const std::unordered_map<Level3ProductCategory, std::string> static const std::unordered_map<Level3ProductCategory, std::string>
@ -176,14 +197,15 @@ static const std::unordered_map<Level3ProductCategory, std::string>
{Level3ProductCategory::SpecificDifferentialPhase, "N0K"}, {Level3ProductCategory::SpecificDifferentialPhase, "N0K"},
{Level3ProductCategory::CorrelationCoefficient, "N0C"}, {Level3ProductCategory::CorrelationCoefficient, "N0C"},
{Level3ProductCategory::VerticallyIntegratedLiquid, "DVL"}, {Level3ProductCategory::VerticallyIntegratedLiquid, "DVL"},
{Level3ProductCategory::HydrometeorClassification, "N0H"}}; {Level3ProductCategory::HydrometeorClassification, "N0H"},
{Level3ProductCategory::PrecipitationAccumulation, "DAA"}};
static const std::unordered_map<int, std::string> level3Palette_ { static const std::unordered_map<int, std::string> level3Palette_ {
{19, "BR"}, {20, "BR"}, {27, "BV"}, {30, "SW"}, {19, "BR"}, {20, "BR"}, {27, "BV"}, {30, "SW"},
{31, "STPIN"}, {32, "BR"}, {37, "BR"}, {38, "BR"}, {31, "STPIN"}, {32, "BR"}, {37, "BR"}, {38, "BR"},
{41, "ET"}, {50, "BR"}, {51, "BV"}, {56, "SRV"}, {41, "ET"}, {50, "BR"}, {51, "BV"}, {56, "SRV"},
{57, "VIL"}, {65, "BR"}, {66, "BR"}, {67, "BR"}, {57, "VIL"}, {65, "BR"}, {66, "BR"}, {67, "BR"},
{78, "OHPIN"}, {79, "OHPIN"}, {80, "STPIN"}, {81, "???"}, {78, "OHPIN"}, {79, "OHPIN"}, {80, "STPIN"}, {81, "OHP"},
{86, "BV"}, {90, "BR"}, {93, "BV"}, {94, "BR"}, {86, "BV"}, {90, "BR"}, {93, "BV"}, {94, "BR"},
{97, "BR"}, {98, "BR"}, {99, "BV"}, {113, "???"}, {97, "BR"}, {98, "BR"}, {99, "BV"}, {113, "???"},
{132, "???"}, {133, "???"}, {134, "VIL"}, {135, "ET"}, {132, "???"}, {133, "???"}, {134, "VIL"}, {135, "ET"},
@ -191,7 +213,7 @@ static const std::unordered_map<int, std::string> level3Palette_ {
{146, "STPIN"}, {150, "STPIN"}, {151, "STPIN"}, {153, "BR"}, {146, "STPIN"}, {150, "STPIN"}, {151, "STPIN"}, {153, "BR"},
{154, "BV"}, {155, "SW"}, {159, "ZDR"}, {161, "CC"}, {154, "BV"}, {155, "SW"}, {159, "ZDR"}, {161, "CC"},
{163, "PHI3"}, {165, "HC"}, {167, "CC"}, {168, "PHI3"}, {163, "PHI3"}, {165, "HC"}, {167, "CC"}, {168, "PHI3"},
{169, "OHPIN"}, {170, "STP"}, {171, "STPIN"}, {172, "STP"}, {169, "OHP"}, {170, "OHP"}, {171, "STP"}, {172, "STP"},
{173, "STP"}, {174, "DOD"}, {175, "DSD"}, {176, "???"}, {173, "STP"}, {174, "DOD"}, {175, "DSD"}, {176, "???"},
{177, "HC"}, {178, "???"}, {179, "???"}, {180, "BR"}, {177, "HC"}, {178, "???"}, {179, "???"}, {180, "BR"},
{181, "BR"}, {182, "BV"}, {184, "SW"}, {186, "BR"}, {181, "BR"}, {182, "BV"}, {184, "SW"}, {186, "BR"},