diff --git a/scwx-qt/res/palettes/wct/ET.pal b/scwx-qt/res/palettes/wct/ET.pal index 11170e15..06fe2605 100644 --- a/scwx-qt/res/palettes/wct/ET.pal +++ b/scwx-qt/res/palettes/wct/ET.pal @@ -1,6 +1,7 @@ ; NEXRAD Level-3 palette for product code 135 - EET - Enhanced Echo Tops Units: KFT +Scale: 3.281 ; convert internal units (KM) to KFT Color: 75 231 0 255 Color: 70 255 255 255 Color: 65 255 0 0 diff --git a/scwx-qt/res/palettes/wct/OHP.pal b/scwx-qt/res/palettes/wct/OHP.pal index 2fe5c6cf..1f8d5dde 100644 --- a/scwx-qt/res/palettes/wct/OHP.pal +++ b/scwx-qt/res/palettes/wct/OHP.pal @@ -1,6 +1,6 @@ ; NEXRAD Level-3 palette for product code 169, OHA, One Hour Precip, 16 Levels -Units IN +Units: IN Scale: 0.03937 ; convert internal units (MM) to INCHES Color: 4.0 255 255 255 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 5acde3ac..812fffbb 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp @@ -406,12 +406,7 @@ std::optional Level3ProductView::GetDataValue(std::uint16_t level) const 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_)); + return false; } } // namespace view diff --git a/wxdata/include/scwx/wsr88d/rpg/product_description_block.hpp b/wxdata/include/scwx/wsr88d/rpg/product_description_block.hpp index 81a05583..1182828a 100644 --- a/wxdata/include/scwx/wsr88d/rpg/product_description_block.hpp +++ b/wxdata/include/scwx/wsr88d/rpg/product_description_block.hpp @@ -70,6 +70,8 @@ public: float log_offset() const; float log_scale() const; + float gr_scale() const; + std::uint8_t data_mask() const; std::uint8_t topped_mask() const; diff --git a/wxdata/source/scwx/wsr88d/rpg/product_description_block.cpp b/wxdata/source/scwx/wsr88d/rpg/product_description_block.cpp index 0fb7a9fa..1a0effaa 100644 --- a/wxdata/source/scwx/wsr88d/rpg/product_description_block.cpp +++ b/wxdata/source/scwx/wsr88d/rpg/product_description_block.cpp @@ -7,6 +7,8 @@ #include #include +#include + namespace scwx { namespace wsr88d @@ -86,6 +88,23 @@ static const std::unordered_map yResolutionMap_ {{37, 1000}, {98, 4000}, {166, 250}}; +// GR uses different internal units than defined units in level 3 products +static const std::unordered_map grScale_ { + {78, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {79, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {80, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {81, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {82, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {41, ((units::feet {1} * 1000.0f) / units::kilometers {1})}, + {135, ((units::feet {1} * 1000.0f) / units::kilometers {1})}, + {169, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {170, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {171, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {172, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {173, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {174, ((units::inches {1} * 0.01f) / units::millimeters {1})}, + {175, ((units::inches {1} * 0.01f) / units::millimeters {1})}}; + class ProductDescriptionBlockImpl { public: @@ -654,6 +673,19 @@ float ProductDescriptionBlock::log_scale() const return logScale; } +float ProductDescriptionBlock::gr_scale() const +{ + float grScale = 1.0f; + + auto it = grScale_.find(p->productCode_); + if (it != grScale_.cend()) + { + grScale = it->second; + } + + return grScale; +} + std::uint8_t ProductDescriptionBlock::data_mask() const { std::uint8_t dataMask = 0xff; @@ -1138,6 +1170,12 @@ ProductDescriptionBlock::data_value(std::uint8_t level) const } } + // Scale for GR compatibility + if (f.has_value()) + { + f = f.value() * gr_scale(); + } + return f; }