mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 01:30:05 +00:00
switch level2 incoming elevation to optional
This commit is contained in:
parent
f481d57ed1
commit
e10ebdeb5e
9 changed files with 41 additions and 32 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <scwx/provider/nexrad_data_provider.hpp>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Aws::S3
|
||||
{
|
||||
class S3Client;
|
||||
|
|
@ -16,7 +18,6 @@ namespace scwx::provider
|
|||
class AwsLevel2ChunksDataProvider : public NexradDataProvider
|
||||
{
|
||||
public:
|
||||
constexpr static const float INVALID_ELEVATION = -90.0;
|
||||
explicit AwsLevel2ChunksDataProvider(const std::string& radarSite);
|
||||
explicit AwsLevel2ChunksDataProvider(const std::string& radarSite,
|
||||
const std::string& bucketName,
|
||||
|
|
@ -58,7 +59,7 @@ public:
|
|||
void RequestAvailableProducts() override;
|
||||
std::vector<std::string> GetAvailableProducts() override;
|
||||
|
||||
float GetCurrentElevation();
|
||||
std::optional<float> GetCurrentElevation();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
|
|
|||
|
|
@ -699,12 +699,12 @@ AwsLevel2ChunksDataProvider::AwsLevel2ChunksDataProvider(
|
|||
AwsLevel2ChunksDataProvider& AwsLevel2ChunksDataProvider::operator=(
|
||||
AwsLevel2ChunksDataProvider&&) noexcept = default;
|
||||
|
||||
float AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
||||
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
|
||||
return INVALID_ELEVATION;
|
||||
return {};
|
||||
}
|
||||
|
||||
auto vcpData = p->currentScan_.nexradFile_->vcp_data();
|
||||
|
|
@ -712,7 +712,7 @@ float AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
|||
if (radarData.size() == 0)
|
||||
{
|
||||
// Does not have any scan elevation. -90 is beyond what is possible
|
||||
return INVALID_ELEVATION;
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto& lastElevation = radarData.crbegin();
|
||||
|
|
@ -729,7 +729,7 @@ float AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
|||
return digitalRadarData0->elevation_angle().value();
|
||||
}
|
||||
|
||||
return INVALID_ELEVATION;
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace scwx::provider
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue