Skip to content

Commit

Permalink
Merge pull request #124 from dpaulat/feature/hydrometeor-classification
Browse files Browse the repository at this point in the history
Hydrometeor Classification
  • Loading branch information
dpaulat authored Jan 12, 2024
2 parents 447f3ee + e4aa0c7 commit 316c0a3
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 12 deletions.
17 changes: 17 additions & 0 deletions scwx-qt/res/palettes/wct/HC.pal
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; WCT Palette for Hydrometeor Classification adapted for Supercell Wx

SolidColor: 10 156 156 156 ; BI = Biological
SolidColor: 20 118 118 118 ; GC = Anomalous Propagation/Ground Clutter
SolidColor: 30 255 176 176 ; IC = Ice Crystals
SolidColor: 40 0 255 255 ; DS = Dry Snow
SolidColor: 50 0 144 255 ; WS = Wet Snow
SolidColor: 60 0 251 144 ; RA = Light and/or Moderate Rain
SolidColor: 70 0 187 0 ; HR = Heavy Rain
SolidColor: 80 208 208 96 ; BD = Big Drops
SolidColor: 90 210 132 132 ; GR = Graupel
SolidColor: 100 255 0 0 ; HA = Small Hail
SolidColor: 110 160 20 20 ; LH = Large Hail
SolidColor: 120 255 255 0 ; GH = Giant Hail
SolidColor: 130 0 0 0 ; TBD
SolidColor: 140 231 0 255 ; UK = Unknown Classification
SolidColor: 150 119 0 125 ; RF = Range Folded
1 change: 1 addition & 0 deletions scwx-qt/scwx-qt.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<file>res/palettes/wct/DR.pal</file>
<file>res/palettes/wct/DV.pal</file>
<file>res/palettes/wct/ET.pal</file>
<file>res/palettes/wct/HC.pal</file>
<file>res/palettes/wct/KDP.pal</file>
<file>res/palettes/wct/KDP2.pal</file>
<file>res/palettes/wct/OHP.pal</file>
Expand Down
4 changes: 3 additions & 1 deletion scwx-qt/source/scwx/qt/settings/palette_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace settings

static const std::string logPrefix_ = "scwx::qt::settings::palette_settings";

static const std::array<std::string, 17> kPaletteKeys_ {
static const std::array<std::string, 18> kPaletteKeys_ {
// Level 2 / Common Products
"BR",
"BV",
Expand All @@ -27,6 +27,7 @@ static const std::array<std::string, 17> kPaletteKeys_ {
"DOD",
"DSD",
"ET",
"HC",
"STP",
"OHP",
"STPIN",
Expand All @@ -48,6 +49,7 @@ static const std::unordered_map<std::string, std::string> kDefaultPalettes_ {
{"DOD", ":/res/palettes/wct/DOD_DSD.pal"},
{"DSD", ":/res/palettes/wct/DOD_DSD.pal"},
{"ET", ":/res/palettes/wct/ET.pal"},
{"HC", ":/res/palettes/wct/HC.pal"},
{"OHP", ":/res/palettes/wct/OHP.pal"},
{"OHPIN", ""},
{"PHI3", ":/res/palettes/wct/KDP.pal"},
Expand Down
4 changes: 3 additions & 1 deletion scwx-qt/source/scwx/qt/ui/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct ColorTableConversions
float scale {1.0f};
};

static const std::array<std::pair<std::string, std::string>, 15>
static const std::array<std::pair<std::string, std::string>, 16>
kColorTableTypes_ {std::pair {"BR", "BR"},
std::pair {"BV", "BV"},
std::pair {"SW", "SW"},
Expand All @@ -64,6 +64,7 @@ static const std::array<std::pair<std::string, std::string>, 15>
std::pair {"DOD", "DOD"},
std::pair {"DSD", "DSD"},
std::pair {"ET", "ET"},
std::pair {"HC", "HC"},
std::pair {"OHP", "OHP"},
std::pair {"PHI3", "KDP"},
std::pair {"SRV", "SRV"},
Expand All @@ -84,6 +85,7 @@ static const std::unordered_map<std::string, ColorTableConversions>
{"DOD", {0u, 255u, 128.0f, 1.5f}},
{"DSD", {0u, 255u, 128.0f, 1.5f}},
{"ET", {0u, 255u, 2.0f, 1.0f}},
{"HC", {10u, 160u, 0.0f, 1.0f}},
{"OHP", {0u, 255u, 0.0f, 2.5f}},
{"PHI3", {0u, 255u, 43.0f, 20.0f}},
{"SRV", {0u, 255u, 128.0f, 2.0f}},
Expand Down
8 changes: 4 additions & 4 deletions wxdata/include/scwx/common/products.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ enum class Level3ProductCategory
DifferentialReflectivity,
SpecificDifferentialPhase,
CorrelationCoefficient,
HydrometeorClassification,
Unknown
};
typedef util::Iterator<Level3ProductCategory,
Level3ProductCategory::Reflectivity,
Level3ProductCategory::CorrelationCoefficient>
Level3ProductCategory::HydrometeorClassification>
Level3ProductCategoryIterator;

typedef std::unordered_map<
Expand All @@ -74,9 +75,8 @@ GetLevel3CategoryDefaultProduct(Level3ProductCategory category);
Level3ProductCategory GetLevel3Category(const std::string& categoryName);
Level3ProductCategory
GetLevel3CategoryByProduct(const std::string& productName);
Level3ProductCategory
GetLevel3CategoryByAwipsId(const std::string& awipsId);
const std::string& GetLevel3Palette(int16_t productCode);
Level3ProductCategory GetLevel3CategoryByAwipsId(const std::string& awipsId);
const std::string& GetLevel3Palette(int16_t productCode);

std::string GetLevel3ProductByAwipsId(const std::string& awipsId);
const std::string& GetLevel3ProductDescription(const std::string& productName);
Expand Down
20 changes: 14 additions & 6 deletions wxdata/source/scwx/common/products.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ static const std::unordered_map<int, std::string> level3ProductCodeMap_ {
{159, "DZD"},
{161, "DCC"},
{163, "DKD"},
{165, "DHD"},
{165, "DHC"},
{166, "ML"},
{177, "HHC"},
{180, "TDR"},
{182, "TDV"}};

Expand All @@ -67,7 +68,8 @@ static const std::unordered_map<std::string, std::string>
{"DZD", "Digital Differential Reflectivity"},
{"DCC", "Digital Correlation Coefficient"},
{"DKD", "Digital Specific Differential Phase"},
{"DHD", "Digital Hydrometeor Classification"},
{"DHC", "Digital Hydrometeor Classification"},
{"HHC", "Hybrid Hydrometeor Classification"},
{"ML", "Melting Layer"},
{"SW", "Spectrum Width"},
{"TDR", "Digital Reflectivity"},
Expand Down Expand Up @@ -102,8 +104,9 @@ static const std::unordered_map<std::string, std::vector<std::string>>
// Specific Differential Phase
{"DKD", {"NXK", "NYK", "NZK", "N0K", "NAK", "N1K", "NBK", "N2K", "N3K"}},

// Digital Hydrometeor Classification
// Hydrometeor Classification
{"DHC", {"NXH", "NYH", "NZH", "N0H", "NAH", "N1H", "NBH", "N2H", "N3H"}},
{"HHC", {"HHC"}},

// Melting Layer
{"ML", {"NXM", "NYM", "NZM", "N0M", "NAM", "N1M", "NBM", "N2M", "N3M"}},
Expand All @@ -120,6 +123,7 @@ static const std::unordered_map<Level3ProductCategory, std::string>
{Level3ProductCategory::DifferentialReflectivity, "ZDR"},
{Level3ProductCategory::SpecificDifferentialPhase, "KDP"},
{Level3ProductCategory::CorrelationCoefficient, "CC"},
{Level3ProductCategory::HydrometeorClassification, "HC"},
{Level3ProductCategory::Unknown, "?"}};

static const std::unordered_map<Level3ProductCategory, std::string>
Expand All @@ -134,6 +138,8 @@ static const std::unordered_map<Level3ProductCategory, std::string>
"Specific Differential Phase"},
{Level3ProductCategory::CorrelationCoefficient,
"Correlation Coefficient"},
{Level3ProductCategory::HydrometeorClassification,
"Hydrometeor Classification"},
{Level3ProductCategory::Unknown, "?"}};

static const std::unordered_map<Level3ProductCategory, std::vector<std::string>>
Expand All @@ -145,6 +151,7 @@ static const std::unordered_map<Level3ProductCategory, std::vector<std::string>>
{Level3ProductCategory::DifferentialReflectivity, {"DZD"}},
{Level3ProductCategory::SpecificDifferentialPhase, {"DKD"}},
{Level3ProductCategory::CorrelationCoefficient, {"DCC"}},
{Level3ProductCategory::HydrometeorClassification, {"DHC", "HHC"}},
{Level3ProductCategory::Unknown, {}}};

static const std::unordered_map<Level3ProductCategory, std::string>
Expand All @@ -155,7 +162,8 @@ static const std::unordered_map<Level3ProductCategory, std::string>
{Level3ProductCategory::SpectrumWidth, "NSW"},
{Level3ProductCategory::DifferentialReflectivity, "N0X"},
{Level3ProductCategory::SpecificDifferentialPhase, "N0K"},
{Level3ProductCategory::CorrelationCoefficient, "N0C"}};
{Level3ProductCategory::CorrelationCoefficient, "N0C"},
{Level3ProductCategory::HydrometeorClassification, "N0H"}};

static const std::unordered_map<int, std::string> level3Palette_ {
{19, "BR"}, {20, "BR"}, {27, "BV"}, {30, "SW"},
Expand All @@ -169,10 +177,10 @@ static const std::unordered_map<int, std::string> level3Palette_ {
{137, "BR"}, {138, "STPIN"}, {144, "OHPIN"}, {145, "OHPIN"},
{146, "STPIN"}, {150, "STPIN"}, {151, "STPIN"}, {153, "BR"},
{154, "BV"}, {155, "SW"}, {159, "ZDR"}, {161, "CC"},
{163, "PHI3"}, {165, "???"}, {167, "CC"}, {168, "PHI3"},
{163, "PHI3"}, {165, "HC"}, {167, "CC"}, {168, "PHI3"},
{169, "OHPIN"}, {170, "STP"}, {171, "STPIN"}, {172, "STP"},
{173, "STP"}, {174, "DOD"}, {175, "DSD"}, {176, "???"},
{177, "???"}, {178, "???"}, {179, "???"}, {180, "BR"},
{177, "HC"}, {178, "???"}, {179, "???"}, {180, "BR"},
{181, "BR"}, {182, "BV"}, {184, "SW"}, {186, "BR"},
{193, "BR"}, {195, "BR"}, {-1, "???"}};

Expand Down
10 changes: 10 additions & 0 deletions wxdata/source/scwx/wsr88d/rpg/product_description_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ uint16_t ProductDescriptionBlock::threshold() const
case 176:
threshold = p->halfword(37);
break;

case 165:
case 177:
threshold = 10;
break;
}

return threshold;
Expand Down Expand Up @@ -572,6 +577,11 @@ uint16_t ProductDescriptionBlock::number_of_levels() const
numberOfLevels = p->halfword(36);
break;

case 165:
case 177:
numberOfLevels = 160;
break;

case 178:
case 179:
numberOfLevels = 71;
Expand Down

0 comments on commit 316c0a3

Please sign in to comment.