mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:20:04 +00:00 
			
		
		
		
	Merge pull request #344 from dpaulat/hotfix/live-level2-data-not-latest
Ensure live level 2 data displays correct scans
This commit is contained in:
		
						commit
						42314a64b2
					
				
					 3 changed files with 23 additions and 8 deletions
				
			
		|  | @ -1507,10 +1507,10 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType, | ||||||
| 
 | 
 | ||||||
|          if (recordRadarData != nullptr) |          if (recordRadarData != nullptr) | ||||||
|          { |          { | ||||||
|             auto& radarData0 = (*recordRadarData)[0]; |             auto& radarData0     = (*recordRadarData)[0]; | ||||||
|             auto  collectionTime = |             auto  collectionTime = std::chrono::floor<std::chrono::seconds>( | ||||||
|                scwx::util::TimePoint(radarData0->modified_julian_date(), |                scwx::util::TimePoint(radarData0->modified_julian_date(), | ||||||
|                                      radarData0->collection_time()); |                                      radarData0->collection_time())); | ||||||
| 
 | 
 | ||||||
|             // Find the newest radar data, not newer than the selected time
 |             // Find the newest radar data, not newer than the selected time
 | ||||||
|             if (radarData == nullptr || |             if (radarData == nullptr || | ||||||
|  |  | ||||||
|  | @ -1801,7 +1801,16 @@ void MapWidgetImpl::RadarProductManagerConnect() | ||||||
|                             (group == common::RadarProductGroup::Level2 || |                             (group == common::RadarProductGroup::Level2 || | ||||||
|                              context_->radar_product() == product)) |                              context_->radar_product() == product)) | ||||||
|                         { |                         { | ||||||
|                            widget_->SelectRadarProduct(record); |                            if (group == common::RadarProductGroup::Level2) | ||||||
|  |                            { | ||||||
|  |                               // Level 2 products may have multiple time points,
 | ||||||
|  |                               // ensure the latest is selected
 | ||||||
|  |                               widget_->SelectRadarProduct(group, product); | ||||||
|  |                            } | ||||||
|  |                            else | ||||||
|  |                            { | ||||||
|  |                               widget_->SelectRadarProduct(record); | ||||||
|  |                            } | ||||||
|                         } |                         } | ||||||
|                      }); |                      }); | ||||||
|                } |                } | ||||||
|  |  | ||||||
|  | @ -23,6 +23,7 @@ | ||||||
| #include <boost/iostreams/copy.hpp> | #include <boost/iostreams/copy.hpp> | ||||||
| #include <boost/iostreams/filtering_streambuf.hpp> | #include <boost/iostreams/filtering_streambuf.hpp> | ||||||
| #include <boost/iostreams/filter/bzip2.hpp> | #include <boost/iostreams/filter/bzip2.hpp> | ||||||
|  | #include <fmt/chrono.h> | ||||||
| 
 | 
 | ||||||
| #if defined(__GNUC__) | #if defined(__GNUC__) | ||||||
| #   pragma GCC diagnostic pop | #   pragma GCC diagnostic pop | ||||||
|  | @ -187,10 +188,12 @@ Ar2vFile::GetElevationScan(rda::DataBlockType                    dataBlockType, | ||||||
| 
 | 
 | ||||||
|       for (auto& scan : elevationScans) |       for (auto& scan : elevationScans) | ||||||
|       { |       { | ||||||
|          auto& scanTime = scan.first; |          auto scanTime = std::chrono::floor<std::chrono::seconds>(scan.first); | ||||||
| 
 | 
 | ||||||
|          if (elevationScan == nullptr || |          if (elevationScan == nullptr || | ||||||
|              (scanTime <= time && scanTime > foundTime)) |              ((scanTime <= time || | ||||||
|  |                time == std::chrono::system_clock::time_point {}) && | ||||||
|  |               scanTime > foundTime)) | ||||||
|          { |          { | ||||||
|             elevationScan = scan.second; |             elevationScan = scan.second; | ||||||
|             foundTime     = scanTime; |             foundTime     = scanTime; | ||||||
|  | @ -253,10 +256,13 @@ bool Ar2vFile::LoadData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (dataValid) |    if (dataValid) | ||||||
|    { |    { | ||||||
|  |       auto timePoint = util::TimePoint(p->julianDate_, p->milliseconds_); | ||||||
|  | 
 | ||||||
|       logger_->debug("Filename:  {}", p->tapeFilename_); |       logger_->debug("Filename:  {}", p->tapeFilename_); | ||||||
|       logger_->debug("Extension: {}", p->extensionNumber_); |       logger_->debug("Extension: {}", p->extensionNumber_); | ||||||
|       logger_->debug("Date:      {}", p->julianDate_); |       logger_->debug("Date:      {} ({:%Y-%m-%d})", p->julianDate_, timePoint); | ||||||
|       logger_->debug("Time:      {}", p->milliseconds_); |       logger_->debug( | ||||||
|  |          "Time:      {} ({:%H:%M:%S})", p->milliseconds_, timePoint); | ||||||
|       logger_->debug("ICAO:      {}", p->icao_); |       logger_->debug("ICAO:      {}", p->icao_); | ||||||
| 
 | 
 | ||||||
|       size_t decompressedRecords = p->DecompressLDMRecords(is); |       size_t decompressedRecords = p->DecompressLDMRecords(is); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat