mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 13:30:06 +00:00
Selectable elevation cuts
This commit is contained in:
parent
19f1207384
commit
e76ac3bc36
15 changed files with 230 additions and 51 deletions
14
wxdata/include/scwx/common/characters.hpp
Normal file
14
wxdata/include/scwx/common/characters.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
namespace Characters
|
||||
{
|
||||
|
||||
constexpr char DEGREE = static_cast<char>(0xb0);
|
||||
|
||||
} // namespace Characters
|
||||
} // namespace common
|
||||
} // namespace scwx
|
||||
|
|
@ -40,7 +40,7 @@ public:
|
|||
std::map<uint16_t, std::shared_ptr<rda::ElevationScan>> radar_data() const;
|
||||
std::shared_ptr<const rda::VolumeCoveragePatternData> vcp_data() const;
|
||||
|
||||
std::pair<float, std::shared_ptr<rda::ElevationScan>>
|
||||
std::tuple<std::shared_ptr<rda::ElevationScan>, float, std::vector<float>>
|
||||
GetElevationScan(rda::DataBlockType dataBlockType,
|
||||
float elevation,
|
||||
std::chrono::system_clock::time_point time) const;
|
||||
|
|
|
|||
|
|
@ -106,15 +106,19 @@ std::shared_ptr<const rda::VolumeCoveragePatternData> Ar2vFile::vcp_data() const
|
|||
return p->vcpData_;
|
||||
}
|
||||
|
||||
std::pair<float, std::shared_ptr<rda::ElevationScan>>
|
||||
std::tuple<std::shared_ptr<rda::ElevationScan>, float, std::vector<float>>
|
||||
Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
||||
float elevation,
|
||||
std::chrono::system_clock::time_point time) const
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< logPrefix_ << "GetElevationScan: " << elevation << " degrees";
|
||||
|
||||
constexpr float scaleFactor = 8.0f / 0.043945f;
|
||||
|
||||
float elevationFound = 0.0f;
|
||||
std::shared_ptr<rda::ElevationScan> elevationScan = nullptr;
|
||||
std::shared_ptr<rda::ElevationScan> elevationScan = nullptr;
|
||||
float elevationCut = 0.0f;
|
||||
std::vector<float> elevationCuts;
|
||||
|
||||
uint16_t codedElevation =
|
||||
static_cast<uint16_t>(std::lroundf(elevation * scaleFactor));
|
||||
|
|
@ -128,14 +132,16 @@ Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
|||
|
||||
for (auto scan : scans)
|
||||
{
|
||||
if (scan.first > lowerBound && scan.first < codedElevation)
|
||||
if (scan.first > lowerBound && scan.first <= codedElevation)
|
||||
{
|
||||
lowerBound = scan.first;
|
||||
}
|
||||
if (scan.first < upperBound && scan.first > codedElevation)
|
||||
if (scan.first < upperBound && scan.first >= codedElevation)
|
||||
{
|
||||
upperBound = scan.first;
|
||||
}
|
||||
|
||||
elevationCuts.push_back(scan.first / scaleFactor);
|
||||
}
|
||||
|
||||
uint16_t lowerDelta = std::abs(static_cast<int32_t>(codedElevation) -
|
||||
|
|
@ -145,17 +151,17 @@ Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
|||
|
||||
if (lowerDelta < upperDelta)
|
||||
{
|
||||
elevationFound = lowerBound / scaleFactor;
|
||||
elevationScan = scans.at(lowerBound);
|
||||
elevationScan = scans.at(lowerBound);
|
||||
elevationCut = lowerBound / scaleFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
elevationFound = upperBound / scaleFactor;
|
||||
elevationScan = scans.at(upperBound);
|
||||
elevationScan = scans.at(upperBound);
|
||||
elevationCut = upperBound / scaleFactor;
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair(elevationFound, elevationScan);
|
||||
return std::tie(elevationScan, elevationCut, elevationCuts);
|
||||
}
|
||||
|
||||
bool Ar2vFile::LoadFile(const std::string& filename)
|
||||
|
|
@ -373,10 +379,8 @@ void Ar2vFileImpl::IndexFile()
|
|||
rda::MomentDataBlockTypeIterator())
|
||||
{
|
||||
if (dataBlockType == rda::DataBlockType::MomentRef &&
|
||||
(waveformType ==
|
||||
rda::WaveformType::ContiguousDopplerWithAmbiguityResolution ||
|
||||
waveformType == rda::WaveformType::
|
||||
ContiguousDopplerWithoutAmbiguityResolution))
|
||||
waveformType ==
|
||||
rda::WaveformType::ContiguousDopplerWithAmbiguityResolution)
|
||||
{
|
||||
// Reflectivity data is contained within both surveillance and
|
||||
// doppler modes. Surveillance mode produces a better image.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ project(scwx-data)
|
|||
|
||||
find_package(Boost)
|
||||
|
||||
set(HDR_COMMON include/scwx/common/color_table.hpp
|
||||
set(HDR_COMMON include/scwx/common/characters.hpp
|
||||
include/scwx/common/color_table.hpp
|
||||
include/scwx/common/constants.hpp
|
||||
include/scwx/common/products.hpp
|
||||
include/scwx/common/types.hpp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue