mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 01:30:05 +00:00
Move elevation conversion code into VCP and DRD code
This commit is contained in:
parent
63585af26d
commit
6ca76b9eca
3 changed files with 30 additions and 19 deletions
|
|
@ -447,11 +447,9 @@ void Ar2vFileImpl::IndexFile()
|
|||
{
|
||||
//logger_->debug("Indexing file");
|
||||
|
||||
constexpr float scaleFactor = 8.0f / 0.043945f;
|
||||
|
||||
for (auto& elevationCut : radarData_)
|
||||
{
|
||||
std::uint16_t elevationAngle {};
|
||||
float elevationAngle {};
|
||||
rda::WaveformType waveformType = rda::WaveformType::Unknown;
|
||||
|
||||
std::shared_ptr<rda::GenericRadarData>& radial0 =
|
||||
|
|
@ -467,14 +465,14 @@ void Ar2vFileImpl::IndexFile()
|
|||
|
||||
if (vcpData_ != nullptr)
|
||||
{
|
||||
elevationAngle = vcpData_->elevation_angle_raw(elevationCut.first);
|
||||
elevationAngle = vcpData_->elevation_angle(elevationCut.first);
|
||||
waveformType = vcpData_->waveform_type(elevationCut.first);
|
||||
}
|
||||
else if ((digitalRadarData0 =
|
||||
std::dynamic_pointer_cast<rda::DigitalRadarData>(radial0)) !=
|
||||
nullptr)
|
||||
{
|
||||
elevationAngle = digitalRadarData0->elevation_angle_raw();
|
||||
elevationAngle = digitalRadarData0->elevation_angle().value();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -502,18 +500,7 @@ void Ar2vFileImpl::IndexFile()
|
|||
auto time = util::TimePoint(radial0->modified_julian_date(),
|
||||
radial0->collection_time());
|
||||
|
||||
// NOLINTNEXTLINE This conversion is accurate
|
||||
float elevationAngleConverted = elevationAngle / scaleFactor;
|
||||
// Any elevation above 90 degrees should be interpreted as a
|
||||
// negative angle
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
if (elevationAngleConverted > 90)
|
||||
{
|
||||
elevationAngleConverted -= 360;
|
||||
}
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
index_[dataBlockType][elevationAngleConverted][time] =
|
||||
index_[dataBlockType][elevationAngle][time] =
|
||||
elevationCut.second;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,18 @@ std::uint16_t DigitalRadarData::elevation_angle_raw() const
|
|||
|
||||
units::degrees<float> DigitalRadarData::elevation_angle() const
|
||||
{
|
||||
return units::degrees<float> {p->elevationAngle_ * kAngleDataScale};
|
||||
// NOLINTNEXTLINE This conversion is accurate
|
||||
float elevationAngleConverted = p->elevationAngle_ * kAngleDataScale;
|
||||
// Any elevation above 90 degrees should be interpreted as a
|
||||
// negative angle
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
if (elevationAngleConverted > 90)
|
||||
{
|
||||
elevationAngleConverted -= 360;
|
||||
}
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
return units::degrees<float> {elevationAngleConverted};
|
||||
}
|
||||
|
||||
std::uint16_t DigitalRadarData::elevation_number() const
|
||||
|
|
|
|||
|
|
@ -220,7 +220,20 @@ uint16_t VolumeCoveragePatternData::number_of_base_tilts() const
|
|||
|
||||
double VolumeCoveragePatternData::elevation_angle(uint16_t e) const
|
||||
{
|
||||
return p->elevationCuts_[e].elevationAngle_ * ANGLE_DATA_SCALE;
|
||||
|
||||
// NOLINTNEXTLINE This conversion is accurate
|
||||
float elevationAngleConverted =
|
||||
p->elevationCuts_[e].elevationAngle_ * ANGLE_DATA_SCALE;
|
||||
// Any elevation above 90 degrees should be interpreted as a
|
||||
// negative angle
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
if (elevationAngleConverted > 90)
|
||||
{
|
||||
elevationAngleConverted -= 360;
|
||||
}
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
return elevationAngleConverted;
|
||||
}
|
||||
|
||||
uint16_t VolumeCoveragePatternData::elevation_angle_raw(uint16_t e) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue