mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 05:10:04 +00:00 
			
		
		
		
	Level 3 products widget
This commit is contained in:
		
							parent
							
								
									df60007b07
								
							
						
					
					
						commit
						ca3586420e
					
				
					 8 changed files with 343 additions and 28 deletions
				
			
		|  | @ -42,6 +42,41 @@ static const std::unordered_map<Level2Product, std::string> level2Palette_ { | |||
|    {Level2Product::ClutterFilterPowerRemoved, "???"}, | ||||
|    {Level2Product::Unknown, "???"}}; | ||||
| 
 | ||||
| static const std::unordered_map<Level3ProductCategory, std::string> | ||||
|    level3CategoryName_ { | ||||
|       {Level3ProductCategory::Reflectivity, "REF"}, | ||||
|       {Level3ProductCategory::Velocity, "VEL"}, | ||||
|       {Level3ProductCategory::StormRelativeVelocity, "SRM"}, | ||||
|       {Level3ProductCategory::SpectrumWidth, "SW"}, | ||||
|       {Level3ProductCategory::DifferentialReflectivity, "ZDR"}, | ||||
|       {Level3ProductCategory::SpecificDifferentialPhase, "KDP"}, | ||||
|       {Level3ProductCategory::CorrelationCoefficient, "CC"}, | ||||
|       {Level3ProductCategory::Unknown, "?"}}; | ||||
| 
 | ||||
| static const std::unordered_map<Level3ProductCategory, std::string> | ||||
|    level3CategoryDescription_ { | ||||
|       {Level3ProductCategory::Reflectivity, "Reflectivity"}, | ||||
|       {Level3ProductCategory::Velocity, "Velocity"}, | ||||
|       {Level3ProductCategory::StormRelativeVelocity, "Storm Relative Velocity"}, | ||||
|       {Level3ProductCategory::SpectrumWidth, "Spectrum Width"}, | ||||
|       {Level3ProductCategory::DifferentialReflectivity, | ||||
|        "Differential Reflectivity"}, | ||||
|       {Level3ProductCategory::SpecificDifferentialPhase, | ||||
|        "Specific Differential Phase"}, | ||||
|       {Level3ProductCategory::CorrelationCoefficient, | ||||
|        "Correlation Coefficient"}, | ||||
|       {Level3ProductCategory::Unknown, "?"}}; | ||||
| 
 | ||||
| static const std::unordered_map<Level3ProductCategory, std::string> | ||||
|    level3CategoryDefaultProduct_ { | ||||
|       {Level3ProductCategory::Reflectivity, "N0B"}, | ||||
|       {Level3ProductCategory::Velocity, "N0G"}, | ||||
|       {Level3ProductCategory::StormRelativeVelocity, "N0S"}, | ||||
|       {Level3ProductCategory::SpectrumWidth, "NSW"}, | ||||
|       {Level3ProductCategory::DifferentialReflectivity, "N0X"}, | ||||
|       {Level3ProductCategory::SpecificDifferentialPhase, "N0K"}, | ||||
|       {Level3ProductCategory::CorrelationCoefficient, "N0C"}}; | ||||
| 
 | ||||
| static const std::unordered_map<int16_t, std::string> level3Palette_ { | ||||
|    {19, "BR"},     {20, "BR"},     {27, "BV"},     {30, "SW"}, | ||||
|    {31, "STPIN"},  {32, "BR"},     {37, "BR"},     {38, "BR"}, | ||||
|  | @ -99,19 +134,6 @@ const std::string& GetLevel2Palette(Level2Product product) | |||
|    return level2Palette_.at(product); | ||||
| } | ||||
| 
 | ||||
| const std::string& GetLevel3Palette(int16_t productCode) | ||||
| { | ||||
|    auto it = level3Palette_.find(productCode); | ||||
|    if (it != level3Palette_.cend()) | ||||
|    { | ||||
|       return it->second; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return level3Palette_.at(-1); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| Level2Product GetLevel2Product(const std::string& name) | ||||
| { | ||||
|    auto result = std::find_if( | ||||
|  | @ -130,5 +152,70 @@ Level2Product GetLevel2Product(const std::string& name) | |||
|    } | ||||
| } | ||||
| 
 | ||||
| const std::string& GetLevel3CategoryName(Level3ProductCategory category) | ||||
| { | ||||
|    return level3CategoryName_.at(category); | ||||
| } | ||||
| 
 | ||||
| const std::string& GetLevel3CategoryDescription(Level3ProductCategory category) | ||||
| { | ||||
|    return level3CategoryDescription_.at(category); | ||||
| } | ||||
| 
 | ||||
| const std::string& | ||||
| GetLevel3CategoryDefaultProduct(Level3ProductCategory category) | ||||
| { | ||||
|    return level3CategoryDefaultProduct_.at(category); | ||||
| } | ||||
| 
 | ||||
| Level3ProductCategory GetLevel3Category(const std::string& categoryName) | ||||
| { | ||||
|    auto result = std::find_if( | ||||
|       level3CategoryName_.cbegin(), | ||||
|       level3CategoryName_.cend(), | ||||
|       [&](const std::pair<Level3ProductCategory, std::string>& pair) -> bool | ||||
|       { return pair.second == categoryName; }); | ||||
| 
 | ||||
|    if (result != level3CategoryName_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return Level3ProductCategory::Unknown; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| Level3ProductCategory GetLevel3CategoryByProduct(const std::string& productName) | ||||
| { | ||||
|    auto result = std::find_if( | ||||
|       level3CategoryDefaultProduct_.cbegin(), | ||||
|       level3CategoryDefaultProduct_.cend(), | ||||
|       [&](const std::pair<Level3ProductCategory, std::string>& pair) -> bool | ||||
|       { return pair.second == productName; }); | ||||
| 
 | ||||
|    if (result != level3CategoryDefaultProduct_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return Level3ProductCategory::Unknown; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| const std::string& GetLevel3Palette(int16_t productCode) | ||||
| { | ||||
|    auto it = level3Palette_.find(productCode); | ||||
|    if (it != level3Palette_.cend()) | ||||
|    { | ||||
|       return it->second; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return level3Palette_.at(-1); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| } // namespace common
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat