From 524de364f2395cd93e7f7df0755da2c143fdc12e Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 25 Feb 2024 22:54:16 -0600 Subject: [PATCH] Add precipitation accumulation products Closes #149 (cherry picked from commit 14afeb33db929e51fa094845bc0b79e266c0f80e) --- .../scwx/qt/map/radar_product_layer.cpp | 3 +- .../scwx/qt/view/level3_product_view.cpp | 11 ++ .../scwx/qt/view/level3_product_view.hpp | 1 + .../scwx/qt/view/radar_product_view.cpp | 5 + .../scwx/qt/view/radar_product_view.hpp | 1 + wxdata/include/scwx/common/products.hpp | 3 +- wxdata/source/scwx/common/products.cpp | 100 +++++++++++------- 7 files changed, 83 insertions(+), 41 deletions(-) diff --git a/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp b/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp index 964ddf00..c4b9e45d 100644 --- a/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp @@ -406,7 +406,8 @@ bool RadarProductLayer::RunMousePicking( if (units.empty() || // units.starts_with("?") || // 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 // displayed diff --git a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp index a749ec18..12f9816c 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -398,6 +399,16 @@ std::optional Level3ProductView::GetDataValue(std::uint16_t level) const return descriptionBlock->data_value(static_cast(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 kIgnoreUnitsProducts_ { + "DAA", "DTA", "DU3", "DU6"}; + + return (kIgnoreUnitsProducts_.contains(p->product_)); +} + } // namespace view } // namespace qt } // namespace scwx diff --git a/scwx-qt/source/scwx/qt/view/level3_product_view.hpp b/scwx-qt/source/scwx/qt/view/level3_product_view.hpp index 12313a80..ce4af875 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.hpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.hpp @@ -39,6 +39,7 @@ public: std::optional GetDataLevelCode(std::uint16_t level) const override; std::optional GetDataValue(std::uint16_t level) const override; + bool IgnoreUnits() const override; void SelectProduct(const std::string& productName) override; diff --git a/scwx-qt/source/scwx/qt/view/radar_product_view.cpp b/scwx-qt/source/scwx/qt/view/radar_product_view.cpp index 27754821..3b5a03d6 100644 --- a/scwx-qt/source/scwx/qt/view/radar_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/radar_product_view.cpp @@ -144,6 +144,11 @@ RadarProductView::GetCfpMomentData() const return std::tie(data, dataSize, componentSize); } +bool RadarProductView::IgnoreUnits() const +{ + return false; +} + std::vector> RadarProductView::GetDescriptionFields() const { diff --git a/scwx-qt/source/scwx/qt/view/radar_product_view.hpp b/scwx-qt/source/scwx/qt/view/radar_product_view.hpp index 5a2f82cd..5122c26a 100644 --- a/scwx-qt/source/scwx/qt/view/radar_product_view.hpp +++ b/scwx-qt/source/scwx/qt/view/radar_product_view.hpp @@ -75,6 +75,7 @@ public: virtual std::optional GetDataLevelCode(std::uint16_t level) const = 0; virtual std::optional GetDataValue(std::uint16_t level) const = 0; + virtual bool IgnoreUnits() const; virtual std::vector> GetDescriptionFields() const; diff --git a/wxdata/include/scwx/common/products.hpp b/wxdata/include/scwx/common/products.hpp index b4e57a36..a3e0d04c 100644 --- a/wxdata/include/scwx/common/products.hpp +++ b/wxdata/include/scwx/common/products.hpp @@ -49,11 +49,12 @@ enum class Level3ProductCategory CorrelationCoefficient, VerticallyIntegratedLiquid, HydrometeorClassification, + PrecipitationAccumulation, Unknown }; typedef util::Iterator + Level3ProductCategory::PrecipitationAccumulation> Level3ProductCategoryIterator; typedef std::unordered_map< diff --git a/wxdata/source/scwx/common/products.cpp b/wxdata/source/scwx/common/products.cpp index cd472e4d..102d92dd 100644 --- a/wxdata/source/scwx/common/products.cpp +++ b/wxdata/source/scwx/common/products.cpp @@ -43,42 +43,45 @@ static const std::unordered_map level2Palette_ { {Level2Product::Unknown, "???"}}; static const std::unordered_map level3ProductCodeMap_ { - {37, "NCR"}, - {56, "SRM"}, - {57, "NVL"}, - {94, "DR"}, - {99, "DV"}, - {134, "DVL"}, - {153, "SDR"}, - {154, "SDV"}, - {159, "DZD"}, - {161, "DCC"}, - {163, "DKD"}, - {165, "DHC"}, - {166, "ML"}, - {177, "HHC"}, - {180, "TDR"}, - {182, "TDV"}}; + {30, "SW"}, {37, "NCR"}, {56, "SRM"}, {57, "NVL"}, {78, "N1P"}, + {79, "N3P"}, {80, "NTP"}, {81, "DPA"}, {82, "SPD"}, {94, "DR"}, + {99, "DV"}, {134, "DVL"}, {138, "DSP"}, {153, "SDR"}, {154, "SDV"}, + {159, "DZD"}, {161, "DCC"}, {163, "DKD"}, {165, "DHC"}, {166, "ML"}, + {169, "OHA"}, {170, "DAA"}, {172, "DTA"}, {173, "DUA"}, {174, "DOD"}, + {175, "DSD"}, {177, "HHC"}, {180, "TDR"}, {182, "TDV"}}; static const std::unordered_map - level3ProductDescription_ {{"SRM", "Storm Relative Mean Radial Velocity"}, - {"DR", "Digital Reflectivity"}, - {"DV", "Digital Velocity"}, - {"SDR", "Super-Resolution Reflectivity"}, - {"SDV", "Super-Resolution Velocity"}, - {"NCR", "Composite Reflectivity"}, - {"DZD", "Digital Differential Reflectivity"}, - {"DCC", "Digital Correlation Coefficient"}, - {"DKD", "Digital Specific Differential Phase"}, - {"DVL", "Digital Vertically Integrated Liquid"}, - {"DHC", "Digital Hydrometeor Classification"}, - {"HHC", "Hybrid Hydrometeor Classification"}, - {"ML", "Melting Layer"}, - {"SW", "Spectrum Width"}, - {"TDR", "Digital Reflectivity"}, - {"TDV", "Digital Velocity"}, - {"VIL", "Vertically Integrated Liquid"}, - {"?", "Unknown"}}; + 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"}, + {"DV", "Digital Velocity"}, + {"DVL", "Digital Vertically Integrated Liquid"}, + {"DSP", "Digital Storm Total Precipitation"}, + {"SDR", "Super-Resolution Reflectivity"}, + {"SDV", "Super-Resolution Velocity"}, + {"DZD", "Digital Differential Reflectivity"}, + {"DCC", "Digital Correlation Coefficient"}, + {"DKD", "Digital Specific Differential Phase"}, + {"DHC", "Digital Hydrometeor Classification"}, + {"ML", "Melting Layer"}, + {"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"}, + {"TDV", "Digital Velocity"}, + {"?", "Unknown"}}; static const std::unordered_map> level3AwipsProducts_ { @@ -110,12 +113,26 @@ static const std::unordered_map> // Vertically Integrated Liquid {"DVL", {"DVL"}}, - {"VIL", {"NVL"}}, + {"NVL", {"NVL"}}, // Hydrometeor Classification {"DHC", {"NXH", "NYH", "NZH", "N0H", "NAH", "N1H", "NBH", "N2H", "N3H"}}, {"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 {"ML", {"NXM", "NYM", "NZM", "N0M", "NAM", "N1M", "NBM", "N2M", "N3M"}}, @@ -133,6 +150,7 @@ static const std::unordered_map {Level3ProductCategory::CorrelationCoefficient, "CC"}, {Level3ProductCategory::VerticallyIntegratedLiquid, "VIL"}, {Level3ProductCategory::HydrometeorClassification, "HC"}, + {Level3ProductCategory::PrecipitationAccumulation, "ACC"}, {Level3ProductCategory::Unknown, "?"}}; static const std::unordered_map @@ -151,6 +169,8 @@ static const std::unordered_map "Vertically Integrated Liquid"}, {Level3ProductCategory::HydrometeorClassification, "Hydrometeor Classification"}, + {Level3ProductCategory::PrecipitationAccumulation, + "Precipitation Accumulation"}, {Level3ProductCategory::Unknown, "?"}}; static const std::unordered_map> @@ -162,8 +182,9 @@ static const std::unordered_map> {Level3ProductCategory::DifferentialReflectivity, {"DZD"}}, {Level3ProductCategory::SpecificDifferentialPhase, {"DKD"}}, {Level3ProductCategory::CorrelationCoefficient, {"DCC"}}, - {Level3ProductCategory::VerticallyIntegratedLiquid, {"DVL", "VIL"}}, + {Level3ProductCategory::VerticallyIntegratedLiquid, {"DVL", "NVL"}}, {Level3ProductCategory::HydrometeorClassification, {"DHC", "HHC"}}, + {Level3ProductCategory::PrecipitationAccumulation, {"DAA", "DTA", "DUA"}}, {Level3ProductCategory::Unknown, {}}}; static const std::unordered_map @@ -176,14 +197,15 @@ static const std::unordered_map {Level3ProductCategory::SpecificDifferentialPhase, "N0K"}, {Level3ProductCategory::CorrelationCoefficient, "N0C"}, {Level3ProductCategory::VerticallyIntegratedLiquid, "DVL"}, - {Level3ProductCategory::HydrometeorClassification, "N0H"}}; + {Level3ProductCategory::HydrometeorClassification, "N0H"}, + {Level3ProductCategory::PrecipitationAccumulation, "DAA"}}; static const std::unordered_map level3Palette_ { {19, "BR"}, {20, "BR"}, {27, "BV"}, {30, "SW"}, {31, "STPIN"}, {32, "BR"}, {37, "BR"}, {38, "BR"}, {41, "ET"}, {50, "BR"}, {51, "BV"}, {56, "SRV"}, {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"}, {97, "BR"}, {98, "BR"}, {99, "BV"}, {113, "???"}, {132, "???"}, {133, "???"}, {134, "VIL"}, {135, "ET"}, @@ -191,7 +213,7 @@ static const std::unordered_map level3Palette_ { {146, "STPIN"}, {150, "STPIN"}, {151, "STPIN"}, {153, "BR"}, {154, "BV"}, {155, "SW"}, {159, "ZDR"}, {161, "CC"}, {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, "???"}, {177, "HC"}, {178, "???"}, {179, "???"}, {180, "BR"}, {181, "BR"}, {182, "BV"}, {184, "SW"}, {186, "BR"},