Get level2 chunks and archive working together, reduce logging of level2 chunks

This commit is contained in:
AdenKoperczak 2025-04-07 18:23:29 -04:00
parent 094d286b41
commit 63585af26d
No known key found for this signature in database
GPG key ID: 9843017036F62EE7
4 changed files with 43 additions and 25 deletions

View file

@ -618,10 +618,13 @@ AwsLevel2ChunksDataProvider::LoadObjectByTime(
std::chrono::system_clock::time_point time)
{
std::unique_lock lock(p->scansMutex_);
static const std::chrono::system_clock::time_point epoch {};
if (p->currentScan_.valid_ && time >= p->currentScan_.time_)
if (p->currentScan_.valid_ &&
(time == epoch || time >= p->currentScan_.time_))
{
return p->currentScan_.nexradFile_;
return std::make_shared<wsr88d::Ar2vFile>(p->currentScan_.nexradFile_,
p->lastScan_.nexradFile_);
}
else if (p->lastScan_.valid_ && time >= p->lastScan_.time_)
{
@ -629,7 +632,6 @@ AwsLevel2ChunksDataProvider::LoadObjectByTime(
}
else
{
logger_->warn("Could not find scan with time");
return nullptr;
}
}
@ -637,6 +639,7 @@ AwsLevel2ChunksDataProvider::LoadObjectByTime(
std::shared_ptr<wsr88d::NexradFile>
AwsLevel2ChunksDataProvider::LoadLatestObject()
{
std::unique_lock lock(p->scansMutex_);
return std::make_shared<wsr88d::Ar2vFile>(p->currentScan_.nexradFile_,
p->lastScan_.nexradFile_);
//return p->currentScan_.nexradFile_;

View file

@ -138,7 +138,7 @@ Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
float elevation,
std::chrono::system_clock::time_point time) const
{
logger_->debug("GetElevationScan: {} degrees", elevation);
//logger_->debug("GetElevationScan: {} degrees", elevation);
std::shared_ptr<rda::ElevationScan> elevationScan = nullptr;
float elevationCut = 0.0f;
@ -273,7 +273,7 @@ bool Ar2vFile::LoadData(std::istream& is)
std::size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is)
{
logger_->debug("Decompressing LDM Records");
//logger_->debug("Decompressing LDM Records");
std::size_t numRecords = 0;
@ -321,22 +321,22 @@ std::size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is)
++numRecords;
}
logger_->debug("Decompressed {} LDM Records", numRecords);
//logger_->debug("Decompressed {} LDM Records", numRecords);
return numRecords;
}
void Ar2vFileImpl::ParseLDMRecords()
{
logger_->debug("Parsing LDM Records");
//logger_->debug("Parsing LDM Records");
std::size_t count = 0;
//std::size_t count = 0;
for (auto it = rawRecords_.begin(); it != rawRecords_.end(); it++)
{
std::stringstream& ss = *it;
logger_->trace("Record {}", count++);
//logger_->trace("Record {}", count++);
ParseLDMRecord(ss);
}
@ -445,7 +445,7 @@ void Ar2vFileImpl::ProcessRadarData(
void Ar2vFileImpl::IndexFile()
{
logger_->debug("Indexing file");
//logger_->debug("Indexing file");
constexpr float scaleFactor = 8.0f / 0.043945f;