mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:50:06 +00:00
Use strong-typed units for angles and ranges in Digital Radar Data Generic Format
This commit is contained in:
parent
a9e1998632
commit
807d98d7ef
3 changed files with 54 additions and 48 deletions
|
|
@ -98,12 +98,12 @@ public:
|
||||||
std::vector<uint16_t> dataMoments16_ {};
|
std::vector<uint16_t> dataMoments16_ {};
|
||||||
std::vector<uint8_t> cfpMoments_ {};
|
std::vector<uint8_t> cfpMoments_ {};
|
||||||
|
|
||||||
float latitude_;
|
float latitude_;
|
||||||
float longitude_;
|
float longitude_;
|
||||||
float elevationCut_;
|
float elevationCut_;
|
||||||
std::vector<float> elevationCuts_;
|
std::vector<float> elevationCuts_;
|
||||||
float range_;
|
units::kilometers<float> range_;
|
||||||
uint16_t vcp_;
|
uint16_t vcp_;
|
||||||
|
|
||||||
std::chrono::system_clock::time_point sweepTime_;
|
std::chrono::system_clock::time_point sweepTime_;
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ float Level2ProductView::elevation() const
|
||||||
|
|
||||||
float Level2ProductView::range() const
|
float Level2ProductView::range() const
|
||||||
{
|
{
|
||||||
return p->range_;
|
return p->range_.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::system_clock::time_point Level2ProductView::sweep_time() const
|
std::chrono::system_clock::time_point Level2ProductView::sweep_time() const
|
||||||
|
|
@ -747,7 +747,8 @@ void Level2ProductViewImpl::ComputeCoordinates(
|
||||||
radials.end(),
|
radials.end(),
|
||||||
[&](std::uint32_t radial)
|
[&](std::uint32_t radial)
|
||||||
{
|
{
|
||||||
const float angle = (*radarData)[radial]->azimuth_angle();
|
const units::degrees<float> angle =
|
||||||
|
(*radarData)[radial]->azimuth_angle();
|
||||||
|
|
||||||
std::for_each(std::execution::par_unseq,
|
std::for_each(std::execution::par_unseq,
|
||||||
gates.begin(),
|
gates.begin(),
|
||||||
|
|
@ -765,7 +766,7 @@ void Level2ProductViewImpl::ComputeCoordinates(
|
||||||
|
|
||||||
geodesic.Direct(radarLatitude,
|
geodesic.Direct(radarLatitude,
|
||||||
radarLongitude,
|
radarLongitude,
|
||||||
angle,
|
angle.value(),
|
||||||
range,
|
range,
|
||||||
latitude,
|
latitude,
|
||||||
longitude);
|
longitude);
|
||||||
|
|
@ -830,14 +831,15 @@ Level2ProductView::GetBinLevel(const common::Coordinate& coordinate) const
|
||||||
radials.end(),
|
radials.end(),
|
||||||
[&](std::uint32_t i)
|
[&](std::uint32_t i)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
const float startAngle = (*radarData)[i]->azimuth_angle();
|
const units::degrees<float> startAngle =
|
||||||
const float nextAngle =
|
(*radarData)[i]->azimuth_angle();
|
||||||
|
const units::degrees<float> nextAngle =
|
||||||
(*radarData)[(i + 1) % numRadials]->azimuth_angle();
|
(*radarData)[(i + 1) % numRadials]->azimuth_angle();
|
||||||
|
|
||||||
if (startAngle < nextAngle)
|
if (startAngle < nextAngle)
|
||||||
{
|
{
|
||||||
if (startAngle <= azi1 && azi1 < nextAngle)
|
if (startAngle.value() <= azi1 && azi1 < nextAngle.value())
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
@ -845,7 +847,7 @@ Level2ProductView::GetBinLevel(const common::Coordinate& coordinate) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the bin crosses 0/360 degrees, special handling is needed
|
// If the bin crosses 0/360 degrees, special handling is needed
|
||||||
if (startAngle <= azi1 || azi1 < nextAngle)
|
if (startAngle.value() <= azi1 || azi1 < nextAngle.value())
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
#include <scwx/util/iterator.hpp>
|
#include <scwx/util/iterator.hpp>
|
||||||
#include <scwx/wsr88d/rda/level2_message.hpp>
|
#include <scwx/wsr88d/rda/level2_message.hpp>
|
||||||
|
|
||||||
|
#include <units/angle.h>
|
||||||
|
#include <units/length.h>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
namespace wsr88d
|
namespace wsr88d
|
||||||
|
|
@ -94,17 +97,17 @@ public:
|
||||||
MomentDataBlock(MomentDataBlock&&) noexcept;
|
MomentDataBlock(MomentDataBlock&&) noexcept;
|
||||||
MomentDataBlock& operator=(MomentDataBlock&&) noexcept;
|
MomentDataBlock& operator=(MomentDataBlock&&) noexcept;
|
||||||
|
|
||||||
uint16_t number_of_data_moment_gates() const;
|
uint16_t number_of_data_moment_gates() const;
|
||||||
float data_moment_range() const;
|
units::kilometers<float> data_moment_range() const;
|
||||||
uint16_t data_moment_range_raw() const;
|
uint16_t data_moment_range_raw() const;
|
||||||
float data_moment_range_sample_interval() const;
|
units::kilometers<float> data_moment_range_sample_interval() const;
|
||||||
uint16_t data_moment_range_sample_interval_raw() const;
|
uint16_t data_moment_range_sample_interval_raw() const;
|
||||||
float snr_threshold() const;
|
float snr_threshold() const;
|
||||||
int16_t snr_threshold_raw() const;
|
int16_t snr_threshold_raw() const;
|
||||||
uint8_t data_word_size() const;
|
uint8_t data_word_size() const;
|
||||||
float scale() const;
|
float scale() const;
|
||||||
float offset() const;
|
float offset() const;
|
||||||
const void* data_moments() const;
|
const void* data_moments() const;
|
||||||
|
|
||||||
static std::shared_ptr<MomentDataBlock>
|
static std::shared_ptr<MomentDataBlock>
|
||||||
Create(const std::string& dataBlockType,
|
Create(const std::string& dataBlockType,
|
||||||
|
|
@ -183,21 +186,21 @@ public:
|
||||||
DigitalRadarDataGeneric(DigitalRadarDataGeneric&&) noexcept;
|
DigitalRadarDataGeneric(DigitalRadarDataGeneric&&) noexcept;
|
||||||
DigitalRadarDataGeneric& operator=(DigitalRadarDataGeneric&&) noexcept;
|
DigitalRadarDataGeneric& operator=(DigitalRadarDataGeneric&&) noexcept;
|
||||||
|
|
||||||
std::string radar_identifier() const;
|
std::string radar_identifier() const;
|
||||||
uint32_t collection_time() const;
|
uint32_t collection_time() const;
|
||||||
uint16_t modified_julian_date() const;
|
uint16_t modified_julian_date() const;
|
||||||
uint16_t azimuth_number() const;
|
uint16_t azimuth_number() const;
|
||||||
float azimuth_angle() const;
|
units::degrees<float> azimuth_angle() const;
|
||||||
uint8_t compression_indicator() const;
|
uint8_t compression_indicator() const;
|
||||||
uint16_t radial_length() const;
|
uint16_t radial_length() const;
|
||||||
uint8_t azimuth_resolution_spacing() const;
|
uint8_t azimuth_resolution_spacing() const;
|
||||||
uint8_t radial_status() const;
|
uint8_t radial_status() const;
|
||||||
uint8_t elevation_number() const;
|
uint8_t elevation_number() const;
|
||||||
uint8_t cut_sector_number() const;
|
uint8_t cut_sector_number() const;
|
||||||
float elevation_angle() const;
|
units::degrees<float> elevation_angle() const;
|
||||||
uint8_t radial_spot_blanking_status() const;
|
uint8_t radial_spot_blanking_status() const;
|
||||||
uint8_t azimuth_indexing_mode() const;
|
uint8_t azimuth_indexing_mode() const;
|
||||||
uint16_t data_block_count() const;
|
uint16_t data_block_count() const;
|
||||||
|
|
||||||
std::shared_ptr<ElevationDataBlock> elevation_data_block() const;
|
std::shared_ptr<ElevationDataBlock> elevation_data_block() const;
|
||||||
std::shared_ptr<RadialDataBlock> radial_data_block() const;
|
std::shared_ptr<RadialDataBlock> radial_data_block() const;
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,9 @@ uint16_t MomentDataBlock::number_of_data_moment_gates() const
|
||||||
return p->numberOfDataMomentGates_;
|
return p->numberOfDataMomentGates_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float MomentDataBlock::data_moment_range() const
|
units::kilometers<float> MomentDataBlock::data_moment_range() const
|
||||||
{
|
{
|
||||||
return p->dataMomentRange_ * 0.001f;
|
return units::kilometers<float> {p->dataMomentRange_ * 0.001f};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t MomentDataBlock::data_moment_range_raw() const
|
uint16_t MomentDataBlock::data_moment_range_raw() const
|
||||||
|
|
@ -104,9 +104,10 @@ uint16_t MomentDataBlock::data_moment_range_raw() const
|
||||||
return p->dataMomentRange_;
|
return p->dataMomentRange_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float MomentDataBlock::data_moment_range_sample_interval() const
|
units::kilometers<float>
|
||||||
|
MomentDataBlock::data_moment_range_sample_interval() const
|
||||||
{
|
{
|
||||||
return p->dataMomentRangeSampleInterval_ * 0.001f;
|
return units::kilometers<float> {p->dataMomentRangeSampleInterval_ * 0.001f};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t MomentDataBlock::data_moment_range_sample_interval_raw() const
|
uint16_t MomentDataBlock::data_moment_range_sample_interval_raw() const
|
||||||
|
|
@ -575,9 +576,9 @@ uint16_t DigitalRadarDataGeneric::azimuth_number() const
|
||||||
return p->azimuthNumber_;
|
return p->azimuthNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float DigitalRadarDataGeneric::azimuth_angle() const
|
units::degrees<float> DigitalRadarDataGeneric::azimuth_angle() const
|
||||||
{
|
{
|
||||||
return p->azimuthAngle_;
|
return units::degrees<float> {p->azimuthAngle_};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t DigitalRadarDataGeneric::compression_indicator() const
|
uint8_t DigitalRadarDataGeneric::compression_indicator() const
|
||||||
|
|
@ -610,9 +611,9 @@ uint8_t DigitalRadarDataGeneric::cut_sector_number() const
|
||||||
return p->cutSectorNumber_;
|
return p->cutSectorNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float DigitalRadarDataGeneric::elevation_angle() const
|
units::degrees<float> DigitalRadarDataGeneric::elevation_angle() const
|
||||||
{
|
{
|
||||||
return p->elevationAngle_;
|
return units::degrees<float> {p->elevationAngle_};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t DigitalRadarDataGeneric::radial_spot_blanking_status() const
|
uint8_t DigitalRadarDataGeneric::radial_spot_blanking_status() const
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue