mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Initial indexing capability
This commit is contained in:
parent
ab616b0c62
commit
3e92847901
6 changed files with 153 additions and 54 deletions
|
|
@ -182,15 +182,15 @@ void RadarProductManager::LoadLevel2Data(const std::string& filename)
|
||||||
|
|
||||||
std::shared_ptr<wsr88d::rda::ElevationScan>
|
std::shared_ptr<wsr88d::rda::ElevationScan>
|
||||||
RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
||||||
uint8_t elevationIndex,
|
uint16_t elevation,
|
||||||
std::chrono::system_clock::time_point time)
|
std::chrono::system_clock::time_point time)
|
||||||
{
|
{
|
||||||
std::shared_ptr<wsr88d::rda::ElevationScan> radarData = nullptr;
|
std::shared_ptr<wsr88d::rda::ElevationScan> radarData = nullptr;
|
||||||
|
|
||||||
if (p->level2VolumeScans_.size() > 0)
|
if (p->level2VolumeScans_.size() > 0)
|
||||||
{
|
{
|
||||||
radarData =
|
radarData = p->level2VolumeScans_.crbegin()->second->GetElevationScan(
|
||||||
p->level2VolumeScans_.crbegin()->second->radar_data()[elevationIndex];
|
dataBlockType, elevation, time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
std::shared_ptr<wsr88d::rda::ElevationScan>
|
std::shared_ptr<wsr88d::rda::ElevationScan>
|
||||||
GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
||||||
uint8_t elevationIndex,
|
uint16_t elevation,
|
||||||
std::chrono::system_clock::time_point time = {});
|
std::chrono::system_clock::time_point time = {});
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@ public:
|
||||||
std::map<uint16_t, std::shared_ptr<rda::ElevationScan>> radar_data() const;
|
std::map<uint16_t, std::shared_ptr<rda::ElevationScan>> radar_data() const;
|
||||||
std::shared_ptr<const rda::VolumeCoveragePatternData> vcp_data() const;
|
std::shared_ptr<const rda::VolumeCoveragePatternData> vcp_data() const;
|
||||||
|
|
||||||
|
std::shared_ptr<rda::ElevationScan>
|
||||||
|
GetElevationScan(rda::DataBlockType dataBlockType,
|
||||||
|
uint16_t elevation,
|
||||||
|
std::chrono::system_clock::time_point time) const;
|
||||||
|
|
||||||
bool LoadFile(const std::string& filename);
|
bool LoadFile(const std::string& filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,16 @@ namespace wsr88d
|
||||||
namespace rda
|
namespace rda
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum class WaveformType
|
||||||
|
{
|
||||||
|
ContiguousSurveillance,
|
||||||
|
ContiguousDopplerWithAmbiguityResolution,
|
||||||
|
ContiguousDopplerWithoutAmbiguityResolution,
|
||||||
|
Batch,
|
||||||
|
StaggeredPulsePair,
|
||||||
|
Unknown
|
||||||
|
};
|
||||||
|
|
||||||
class VolumeCoveragePatternDataImpl;
|
class VolumeCoveragePatternDataImpl;
|
||||||
|
|
||||||
class VolumeCoveragePatternData : public Message
|
class VolumeCoveragePatternData : public Message
|
||||||
|
|
@ -26,54 +36,56 @@ public:
|
||||||
VolumeCoveragePatternData(VolumeCoveragePatternData&&) noexcept;
|
VolumeCoveragePatternData(VolumeCoveragePatternData&&) noexcept;
|
||||||
VolumeCoveragePatternData& operator=(VolumeCoveragePatternData&&) noexcept;
|
VolumeCoveragePatternData& operator=(VolumeCoveragePatternData&&) noexcept;
|
||||||
|
|
||||||
uint16_t pattern_type() const;
|
uint16_t pattern_type() const;
|
||||||
uint16_t pattern_number() const;
|
uint16_t pattern_number() const;
|
||||||
uint16_t number_of_elevation_cuts() const;
|
uint16_t number_of_elevation_cuts() const;
|
||||||
uint8_t version() const;
|
uint8_t version() const;
|
||||||
uint8_t clutter_map_group_number() const;
|
uint8_t clutter_map_group_number() const;
|
||||||
float doppler_velocity_resolution() const;
|
float doppler_velocity_resolution() const;
|
||||||
uint8_t pulse_width() const;
|
uint8_t pulse_width() const;
|
||||||
uint16_t vcp_sequencing() const;
|
uint16_t vcp_sequencing() const;
|
||||||
uint16_t number_of_elevations() const;
|
uint16_t number_of_elevations() const;
|
||||||
uint16_t maximum_sails_cuts() const;
|
uint16_t maximum_sails_cuts() const;
|
||||||
bool sequence_active() const;
|
bool sequence_active() const;
|
||||||
bool truncated_vcp() const;
|
bool truncated_vcp() const;
|
||||||
uint16_t vcp_supplemental_data() const;
|
uint16_t vcp_supplemental_data() const;
|
||||||
bool sails_vcp() const;
|
bool sails_vcp() const;
|
||||||
uint16_t number_of_sails_cuts() const;
|
uint16_t number_of_sails_cuts() const;
|
||||||
bool mrle_vcp() const;
|
bool mrle_vcp() const;
|
||||||
uint16_t number_of_mrle_cuts() const;
|
uint16_t number_of_mrle_cuts() const;
|
||||||
bool mpda_vcp() const;
|
bool mpda_vcp() const;
|
||||||
bool base_tilt_vcp() const;
|
bool base_tilt_vcp() const;
|
||||||
uint16_t number_of_base_tilts() const;
|
uint16_t number_of_base_tilts() const;
|
||||||
double elevation_angle(uint16_t e) const;
|
double elevation_angle(uint16_t e) const;
|
||||||
uint8_t channel_configuration(uint16_t e) const;
|
uint16_t elevation_angle_raw(uint16_t e) const;
|
||||||
uint8_t waveform_type(uint16_t e) const;
|
uint8_t channel_configuration(uint16_t e) const;
|
||||||
uint8_t super_resolution_control(uint16_t e) const;
|
WaveformType waveform_type(uint16_t e) const;
|
||||||
bool half_degree_azimuth(uint16_t e) const;
|
uint8_t waveform_type_raw(uint16_t e) const;
|
||||||
bool quarter_km_reflectivity(uint16_t e) const;
|
uint8_t super_resolution_control(uint16_t e) const;
|
||||||
bool doppler_to_300km(uint16_t e) const;
|
bool half_degree_azimuth(uint16_t e) const;
|
||||||
bool dual_polarization_to_300km(uint16_t e) const;
|
bool quarter_km_reflectivity(uint16_t e) const;
|
||||||
uint8_t surveillance_prf_number(uint16_t e) const;
|
bool doppler_to_300km(uint16_t e) const;
|
||||||
uint16_t surveillance_prf_pulse_count_radial(uint16_t e) const;
|
bool dual_polarization_to_300km(uint16_t e) const;
|
||||||
double azimuth_rate(uint16_t e) const;
|
uint8_t surveillance_prf_number(uint16_t e) const;
|
||||||
float reflectivity_threshold(uint16_t e) const;
|
uint16_t surveillance_prf_pulse_count_radial(uint16_t e) const;
|
||||||
float velocity_threshold(uint16_t e) const;
|
double azimuth_rate(uint16_t e) const;
|
||||||
float spectrum_width_threshold(uint16_t e) const;
|
float reflectivity_threshold(uint16_t e) const;
|
||||||
float differential_reflectivity_threshold(uint16_t e) const;
|
float velocity_threshold(uint16_t e) const;
|
||||||
float differential_phase_threshold(uint16_t e) const;
|
float spectrum_width_threshold(uint16_t e) const;
|
||||||
float correlation_coefficient_threshold(uint16_t e) const;
|
float differential_reflectivity_threshold(uint16_t e) const;
|
||||||
uint16_t supplemental_data(uint16_t e) const;
|
float differential_phase_threshold(uint16_t e) const;
|
||||||
bool sails_cut(uint16_t e) const;
|
float correlation_coefficient_threshold(uint16_t e) const;
|
||||||
uint16_t sails_sequence_number(uint16_t e) const;
|
uint16_t supplemental_data(uint16_t e) const;
|
||||||
bool mrle_cut(uint16_t e) const;
|
bool sails_cut(uint16_t e) const;
|
||||||
uint16_t mrle_sequence_number(uint16_t e) const;
|
uint16_t sails_sequence_number(uint16_t e) const;
|
||||||
bool mpda_cut(uint16_t e) const;
|
bool mrle_cut(uint16_t e) const;
|
||||||
bool base_tilt_cut(uint16_t e) const;
|
uint16_t mrle_sequence_number(uint16_t e) const;
|
||||||
double ebc_angle(uint16_t e) const;
|
bool mpda_cut(uint16_t e) const;
|
||||||
double edge_angle(uint16_t e, uint16_t s) const;
|
bool base_tilt_cut(uint16_t e) const;
|
||||||
uint16_t doppler_prf_number(uint16_t e, uint16_t s) const;
|
double ebc_angle(uint16_t e) const;
|
||||||
uint16_t doppler_prf_pulse_count_radial(uint16_t e, uint16_t s) const;
|
double edge_angle(uint16_t e, uint16_t s) const;
|
||||||
|
uint16_t doppler_prf_number(uint16_t e, uint16_t s) const;
|
||||||
|
uint16_t doppler_prf_pulse_count_radial(uint16_t e, uint16_t s) const;
|
||||||
|
|
||||||
bool Parse(std::istream& is);
|
bool Parse(std::istream& is);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,12 @@ public:
|
||||||
numRecords_ {0},
|
numRecords_ {0},
|
||||||
rawRecords_(),
|
rawRecords_(),
|
||||||
vcpData_ {nullptr},
|
vcpData_ {nullptr},
|
||||||
radarData_ {} {};
|
radarData_ {},
|
||||||
|
index_ {} {};
|
||||||
~Ar2vFileImpl() = default;
|
~Ar2vFileImpl() = default;
|
||||||
|
|
||||||
void HandleMessage(std::shared_ptr<rda::Message>& message);
|
void HandleMessage(std::shared_ptr<rda::Message>& message);
|
||||||
|
void IndexFile();
|
||||||
void LoadLDMRecords(std::ifstream& f);
|
void LoadLDMRecords(std::ifstream& f);
|
||||||
void ParseLDMRecords();
|
void ParseLDMRecords();
|
||||||
void ProcessRadarData(std::shared_ptr<rda::DigitalRadarData> message);
|
void ProcessRadarData(std::shared_ptr<rda::DigitalRadarData> message);
|
||||||
|
|
@ -50,6 +52,10 @@ public:
|
||||||
std::shared_ptr<rda::VolumeCoveragePatternData> vcpData_;
|
std::shared_ptr<rda::VolumeCoveragePatternData> vcpData_;
|
||||||
std::map<uint16_t, std::shared_ptr<rda::ElevationScan>> radarData_;
|
std::map<uint16_t, std::shared_ptr<rda::ElevationScan>> radarData_;
|
||||||
|
|
||||||
|
std::map<rda::DataBlockType,
|
||||||
|
std::map<uint16_t, std::shared_ptr<rda::ElevationScan>>>
|
||||||
|
index_;
|
||||||
|
|
||||||
std::list<std::stringstream> rawRecords_;
|
std::list<std::stringstream> rawRecords_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -100,6 +106,23 @@ std::shared_ptr<const rda::VolumeCoveragePatternData> Ar2vFile::vcp_data() const
|
||||||
return p->vcpData_;
|
return p->vcpData_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<rda::ElevationScan>
|
||||||
|
Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
||||||
|
uint16_t elevation,
|
||||||
|
std::chrono::system_clock::time_point time) const
|
||||||
|
{
|
||||||
|
std::shared_ptr<rda::ElevationScan> elevationScan = nullptr;
|
||||||
|
|
||||||
|
// TODO: 88 = 0.5 degrees - this should be parameterized and searched
|
||||||
|
if (p->index_.contains(dataBlockType) &&
|
||||||
|
p->index_.at(dataBlockType).contains(88))
|
||||||
|
{
|
||||||
|
return p->index_.at(dataBlockType).at(88);
|
||||||
|
}
|
||||||
|
|
||||||
|
return elevationScan;
|
||||||
|
}
|
||||||
|
|
||||||
bool Ar2vFile::LoadFile(const std::string& filename)
|
bool Ar2vFile::LoadFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")";
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")";
|
||||||
|
|
@ -151,6 +174,8 @@ bool Ar2vFile::LoadFile(const std::string& filename)
|
||||||
p->LoadLDMRecords(f);
|
p->LoadLDMRecords(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->IndexFile();
|
||||||
|
|
||||||
return fileValid;
|
return fileValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -295,5 +320,44 @@ void Ar2vFileImpl::ProcessRadarData(
|
||||||
(*radarData_[elevationIndex])[azimuthIndex] = message;
|
(*radarData_[elevationIndex])[azimuthIndex] = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ar2vFileImpl::IndexFile()
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Indexing file";
|
||||||
|
|
||||||
|
for (auto elevationCut : radarData_)
|
||||||
|
{
|
||||||
|
uint16_t elevationAngle =
|
||||||
|
vcpData_->elevation_angle_raw(elevationCut.first);
|
||||||
|
rda::WaveformType waveformType =
|
||||||
|
vcpData_->waveform_type(elevationCut.first);
|
||||||
|
|
||||||
|
std::shared_ptr<rda::DigitalRadarData> radial0 =
|
||||||
|
(*elevationCut.second)[0];
|
||||||
|
|
||||||
|
for (rda::DataBlockType dataBlockType :
|
||||||
|
rda::MomentDataBlockTypeIterator())
|
||||||
|
{
|
||||||
|
if (dataBlockType == rda::DataBlockType::MomentRef &&
|
||||||
|
(waveformType ==
|
||||||
|
rda::WaveformType::ContiguousDopplerWithAmbiguityResolution ||
|
||||||
|
waveformType == rda::WaveformType::
|
||||||
|
ContiguousDopplerWithoutAmbiguityResolution))
|
||||||
|
{
|
||||||
|
// Reflectivity data is contained within both surveillance and
|
||||||
|
// doppler modes. Surveillance mode produces a better image.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto momentData = radial0->moment_data_block(dataBlockType);
|
||||||
|
|
||||||
|
if (momentData != nullptr)
|
||||||
|
{
|
||||||
|
// TODO: Handle multiple elevation scans
|
||||||
|
index_[dataBlockType][elevationAngle] = elevationCut.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace wsr88d
|
} // namespace wsr88d
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -219,12 +219,30 @@ double VolumeCoveragePatternData::elevation_angle(uint16_t e) const
|
||||||
return p->elevationCuts_[e].elevationAngle_ * ANGLE_DATA_SCALE;
|
return p->elevationCuts_[e].elevationAngle_ * ANGLE_DATA_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t VolumeCoveragePatternData::elevation_angle_raw(uint16_t e) const
|
||||||
|
{
|
||||||
|
return p->elevationCuts_[e].elevationAngle_;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t VolumeCoveragePatternData::channel_configuration(uint16_t e) const
|
uint8_t VolumeCoveragePatternData::channel_configuration(uint16_t e) const
|
||||||
{
|
{
|
||||||
return p->elevationCuts_[e].channelConfiguration_;
|
return p->elevationCuts_[e].channelConfiguration_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeCoveragePatternData::waveform_type(uint16_t e) const
|
WaveformType VolumeCoveragePatternData::waveform_type(uint16_t e) const
|
||||||
|
{
|
||||||
|
switch (p->elevationCuts_[e].waveformType_)
|
||||||
|
{
|
||||||
|
case 1: return WaveformType::ContiguousSurveillance;
|
||||||
|
case 2: return WaveformType::ContiguousDopplerWithAmbiguityResolution;
|
||||||
|
case 3: return WaveformType::ContiguousDopplerWithoutAmbiguityResolution;
|
||||||
|
case 4: return WaveformType::Batch;
|
||||||
|
case 5: return WaveformType::StaggeredPulsePair;
|
||||||
|
default: return WaveformType::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t VolumeCoveragePatternData::waveform_type_raw(uint16_t e) const
|
||||||
{
|
{
|
||||||
return p->elevationCuts_[e].waveformType_;
|
return p->elevationCuts_[e].waveformType_;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue