mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 01:40:05 +00:00
Remove some unneded methods added in level_2_chunks
This commit is contained in:
parent
759a9e4379
commit
2daf4d8ba4
5 changed files with 12 additions and 53 deletions
|
|
@ -53,9 +53,7 @@ public:
|
|||
LoadObjectByKey(const std::string& key) override;
|
||||
std::shared_ptr<wsr88d::NexradFile>
|
||||
LoadObjectByTime(std::chrono::system_clock::time_point time) override;
|
||||
std::shared_ptr<wsr88d::NexradFile> LoadLatestObject() override;
|
||||
std::shared_ptr<wsr88d::NexradFile> LoadSecondLatestObject() override;
|
||||
std::pair<size_t, size_t> Refresh() override;
|
||||
std::pair<size_t, size_t> Refresh() override;
|
||||
|
||||
void RequestAvailableProducts() override;
|
||||
std::vector<std::string> GetAvailableProducts() override;
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ public:
|
|||
LoadObjectByKey(const std::string& key) override;
|
||||
std::shared_ptr<wsr88d::NexradFile>
|
||||
LoadObjectByTime(std::chrono::system_clock::time_point time) override;
|
||||
std::shared_ptr<wsr88d::NexradFile> LoadLatestObject() override;
|
||||
std::shared_ptr<wsr88d::NexradFile> LoadSecondLatestObject() override;
|
||||
std::pair<size_t, size_t> Refresh() override;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -98,20 +98,6 @@ public:
|
|||
virtual std::shared_ptr<wsr88d::NexradFile>
|
||||
LoadObjectByTime(std::chrono::system_clock::time_point time) = 0;
|
||||
|
||||
/**
|
||||
* Loads the latest NEXRAD file object
|
||||
*
|
||||
* @return NEXRAD data
|
||||
*/
|
||||
virtual std::shared_ptr<wsr88d::NexradFile> LoadLatestObject() = 0;
|
||||
|
||||
/**
|
||||
* Loads the second NEXRAD file object
|
||||
*
|
||||
* @return NEXRAD data
|
||||
*/
|
||||
virtual std::shared_ptr<wsr88d::NexradFile> LoadSecondLatestObject() = 0;
|
||||
|
||||
/**
|
||||
* Lists NEXRAD objects for the current date, and adds them to the cache. If
|
||||
* no objects have been added to the cache for the current date, the previous
|
||||
|
|
|
|||
|
|
@ -205,16 +205,20 @@ size_t AwsLevel2ChunksDataProvider::cache_size() const
|
|||
std::chrono::system_clock::time_point
|
||||
AwsLevel2ChunksDataProvider::last_modified() const
|
||||
{
|
||||
// There is a slight delay between the "modified time" and when it is
|
||||
// actually available. Radar product manager uses this as available time
|
||||
static const auto extra = std::chrono::seconds(2);
|
||||
|
||||
const std::shared_lock lock(p->scansMutex_);
|
||||
if (p->currentScan_.valid_ && p->currentScan_.lastModified_ !=
|
||||
std::chrono::system_clock::time_point {})
|
||||
{
|
||||
return p->currentScan_.lastModified_;
|
||||
return p->currentScan_.lastModified_ + extra;
|
||||
}
|
||||
else if (p->lastScan_.valid_ && p->lastScan_.lastModified_ !=
|
||||
std::chrono::system_clock::time_point {})
|
||||
{
|
||||
return p->lastScan_.lastModified_;
|
||||
return p->lastScan_.lastModified_ + extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -224,20 +228,18 @@ AwsLevel2ChunksDataProvider::last_modified() const
|
|||
std::chrono::seconds AwsLevel2ChunksDataProvider::update_period() const
|
||||
{
|
||||
const std::shared_lock lock(p->scansMutex_);
|
||||
// Add an extra second of delay
|
||||
static const auto extra = std::chrono::seconds(2);
|
||||
// get update period from time between chunks
|
||||
if (p->currentScan_.valid_ && p->currentScan_.nextFile_ > 2)
|
||||
{
|
||||
auto delta =
|
||||
p->currentScan_.lastModified_ - p->currentScan_.secondLastModified_;
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(delta) + extra;
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(delta);
|
||||
}
|
||||
else if (p->lastScan_.valid_ && p->lastScan_.nextFile_ > 2)
|
||||
{
|
||||
auto delta =
|
||||
p->lastScan_.lastModified_ - p->lastScan_.secondLastModified_;
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(delta) + extra;
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(delta);
|
||||
}
|
||||
|
||||
// default to a set update period
|
||||
|
|
@ -645,20 +647,6 @@ AwsLevel2ChunksDataProvider::LoadObjectByTime(
|
|||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<wsr88d::NexradFile>
|
||||
AwsLevel2ChunksDataProvider::LoadLatestObject()
|
||||
{
|
||||
const std::unique_lock lock(p->scansMutex_);
|
||||
return std::make_shared<wsr88d::Ar2vFile>(p->currentScan_.nexradFile_,
|
||||
p->lastScan_.nexradFile_);
|
||||
}
|
||||
|
||||
std::shared_ptr<wsr88d::NexradFile>
|
||||
AwsLevel2ChunksDataProvider::LoadSecondLatestObject()
|
||||
{
|
||||
return p->lastScan_.nexradFile_;
|
||||
}
|
||||
|
||||
int AwsLevel2ChunksDataProvider::Impl::GetScanNumber(const std::string& prefix)
|
||||
{
|
||||
// KIND/585/20250324-134727-001-S
|
||||
|
|
@ -728,7 +716,7 @@ std::pair<size_t, size_t> AwsLevel2ChunksDataProvider::Refresh()
|
|||
});
|
||||
}
|
||||
|
||||
threadPool.wait();
|
||||
threadPool.join();
|
||||
if (newCurrent)
|
||||
{
|
||||
newObjects += 1;
|
||||
|
|
@ -759,7 +747,7 @@ std::optional<float> AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
|||
{
|
||||
if (!p->currentScan_.valid_ || p->currentScan_.nexradFile_ == nullptr)
|
||||
{
|
||||
// Does not have any scan elevation. -90 is beyond what is possible
|
||||
// Does not have any scan elevation.
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -767,7 +755,7 @@ std::optional<float> AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
|||
auto radarData = p->currentScan_.nexradFile_->radar_data();
|
||||
if (radarData.size() == 0)
|
||||
{
|
||||
// Does not have any scan elevation. -90 is beyond what is possible
|
||||
// Does not have any scan elevation.
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -346,17 +346,6 @@ std::shared_ptr<wsr88d::NexradFile> AwsNexradDataProvider::LoadObjectByTime(
|
|||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<wsr88d::NexradFile> AwsNexradDataProvider::LoadLatestObject()
|
||||
{
|
||||
return LoadObjectByKey(FindLatestKey());
|
||||
}
|
||||
|
||||
std::shared_ptr<wsr88d::NexradFile>
|
||||
AwsNexradDataProvider::LoadSecondLatestObject()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::pair<size_t, size_t> AwsNexradDataProvider::Refresh()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue