Support ARCHIVE2

This commit is contained in:
Dan Paulat 2024-01-27 01:18:25 -06:00
parent 243a7c870c
commit 636f444c40
2 changed files with 13 additions and 9 deletions

View file

@ -231,7 +231,8 @@ public:
LoadNexradFile(CreateNexradFileFunction load, LoadNexradFile(CreateNexradFileFunction load,
std::shared_ptr<request::NexradFileRequest> request, std::shared_ptr<request::NexradFileRequest> request,
std::mutex& mutex, std::mutex& mutex,
std::chrono::system_clock::time_point time = {}); std::chrono::system_clock::time_point time = {},
const std::string& radarId = {});
const std::string radarId_; const std::string radarId_;
bool initialized_; bool initialized_;
@ -957,14 +958,15 @@ void RadarProductManagerImpl::LoadNexradFileAsync(
{ {
boost::asio::post(threadPool_, boost::asio::post(threadPool_,
[=, &mutex]() [=, &mutex]()
{ LoadNexradFile(load, request, mutex, time); }); { LoadNexradFile(load, request, mutex, time, radarId_); });
} }
void RadarProductManagerImpl::LoadNexradFile( void RadarProductManagerImpl::LoadNexradFile(
CreateNexradFileFunction load, CreateNexradFileFunction load,
std::shared_ptr<request::NexradFileRequest> request, std::shared_ptr<request::NexradFileRequest> request,
std::mutex& mutex, std::mutex& mutex,
std::chrono::system_clock::time_point time) std::chrono::system_clock::time_point time,
const std::string& radarId)
{ {
std::unique_lock lock {mutex}; std::unique_lock lock {mutex};
@ -987,8 +989,14 @@ void RadarProductManagerImpl::LoadNexradFile(
record->set_time(time); record->set_time(time);
} }
std::string recordRadarId = (record->radar_id());
if (recordRadarId.empty())
{
recordRadarId = radarId;
}
std::shared_ptr<RadarProductManager> manager = std::shared_ptr<RadarProductManager> manager =
RadarProductManager::Instance(record->radar_id()); RadarProductManager::Instance(recordRadarId);
manager->Initialize(); manager->Initialize();
record = manager->p->StoreRadarProductRecord(record); record = manager->p->StoreRadarProductRecord(record);

View file

@ -114,14 +114,10 @@ std::shared_ptr<NexradFile> NexradFileFactory::Create(std::istream& is)
if (dataValid) if (dataValid)
{ {
if (buffer.starts_with("AR2V")) if (buffer.starts_with("AR2V") || buffer.starts_with("ARCHIVE2"))
{ {
message = std::make_shared<Ar2vFile>(); message = std::make_shared<Ar2vFile>();
} }
else if (buffer.starts_with("ARCHIVE2"))
{
logger_->warn("ARCHIVE2 format not supported");
}
else else
{ {
message = std::make_shared<Level3File>(); message = std::make_shared<Level3File>();