mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 13:50:06 +00:00 
			
		
		
		
	If the time in the filename and file data differ, the filename should take precedence
This is required for properly indexing the file. If the file data is used, the data is stored under the file data index. Before the file is loaded, the data retrieval is attempted using the filename as the time.
This commit is contained in:
		
							parent
							
								
									4e5a28fcab
								
							
						
					
					
						commit
						96db63d5f3
					
				
					 3 changed files with 23 additions and 4 deletions
				
			
		|  | @ -210,7 +210,8 @@ public: | |||
|    static void | ||||
|    LoadNexradFile(CreateNexradFileFunction                    load, | ||||
|                   std::shared_ptr<request::NexradFileRequest> request, | ||||
|                   std::mutex&                                 mutex); | ||||
|                   std::mutex&                                 mutex, | ||||
|                   std::chrono::system_clock::time_point       time = {}); | ||||
| 
 | ||||
|    const std::string radarId_; | ||||
|    bool              initialized_; | ||||
|  | @ -801,7 +802,8 @@ void RadarProductManagerImpl::LoadProviderData( | |||
|          return nexradFile; | ||||
|       }, | ||||
|       request, | ||||
|       loadDataMutex); | ||||
|       loadDataMutex, | ||||
|       time); | ||||
| } | ||||
| 
 | ||||
| void RadarProductManager::LoadLevel2Data( | ||||
|  | @ -912,7 +914,8 @@ void RadarProductManager::LoadFile( | |||
| void RadarProductManagerImpl::LoadNexradFile( | ||||
|    CreateNexradFileFunction                    load, | ||||
|    std::shared_ptr<request::NexradFileRequest> request, | ||||
|    std::mutex&                                 mutex) | ||||
|    std::mutex&                                 mutex, | ||||
|    std::chrono::system_clock::time_point       time) | ||||
| { | ||||
|    scwx::util::async( | ||||
|       [=, &mutex]() | ||||
|  | @ -929,6 +932,15 @@ void RadarProductManagerImpl::LoadNexradFile( | |||
|          { | ||||
|             record = types::RadarProductRecord::Create(nexradFile); | ||||
| 
 | ||||
|             // If the time is already determined, override the time in the file.
 | ||||
|             // Sometimes, level 2 data has been seen to be a few seconds off
 | ||||
|             // between filename and file data. Overriding this can help prevent
 | ||||
|             // issues with locating and storing the correct records.
 | ||||
|             if (time != std::chrono::system_clock::time_point {}) | ||||
|             { | ||||
|                record->set_time(time); | ||||
|             } | ||||
| 
 | ||||
|             std::shared_ptr<RadarProductManager> manager = | ||||
|                RadarProductManager::Instance(record->radar_id()); | ||||
| 
 | ||||
|  |  | |||
|  | @ -133,6 +133,11 @@ std::chrono::system_clock::time_point RadarProductRecord::time() const | |||
|    return p->time_; | ||||
| } | ||||
| 
 | ||||
| void RadarProductRecord::set_time(std::chrono::system_clock::time_point time) | ||||
| { | ||||
|    p->time_ = time; | ||||
| } | ||||
| 
 | ||||
| std::shared_ptr<RadarProductRecord> | ||||
| RadarProductRecord::Create(std::shared_ptr<wsr88d::NexradFile> nexradFile) | ||||
| { | ||||
|  |  | |||
|  | @ -38,6 +38,8 @@ public: | |||
|    std::string                           site_id() const; | ||||
|    std::chrono::system_clock::time_point time() const; | ||||
| 
 | ||||
|    void set_time(std::chrono::system_clock::time_point time); | ||||
| 
 | ||||
|    static std::shared_ptr<RadarProductRecord> | ||||
|    Create(std::shared_ptr<wsr88d::NexradFile> nexradFile); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat