mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:10:05 +00:00
use non-standard coordinates for tdwr and optimize there generation
This commit is contained in:
parent
8dfb2fe69c
commit
f0ba7296d5
3 changed files with 49 additions and 17 deletions
|
|
@ -428,9 +428,16 @@ const scwx::util::time_zone* RadarProductManager::default_time_zone() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RadarProductManager::is_tdwr() const
|
||||||
|
{
|
||||||
|
return p->radarSite_->type() == "tdwr";
|
||||||
|
}
|
||||||
|
|
||||||
float RadarProductManager::gate_size() const
|
float RadarProductManager::gate_size() const
|
||||||
{
|
{
|
||||||
return (p->radarSite_->type() == "tdwr") ? 150.0f : 250.0f;
|
// tdwr is 150 meter per gate, wsr88d is 250 meter per gate
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
return (is_tdwr()) ? 150.0f : 250.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RadarProductManager::radar_id() const
|
std::string RadarProductManager::radar_id() const
|
||||||
|
|
@ -454,6 +461,12 @@ void RadarProductManager::Initialize()
|
||||||
|
|
||||||
logger_->debug("Initialize()");
|
logger_->debug("Initialize()");
|
||||||
|
|
||||||
|
if (is_tdwr())
|
||||||
|
{
|
||||||
|
p->initialized_ = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boost::timer::cpu_timer timer;
|
boost::timer::cpu_timer timer;
|
||||||
|
|
||||||
// Calculate half degree azimuth coordinates
|
// Calculate half degree azimuth coordinates
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ public:
|
||||||
[[nodiscard]] const std::vector<float>&
|
[[nodiscard]] const std::vector<float>&
|
||||||
coordinates(common::RadialSize radialSize, bool smoothingEnabled) const;
|
coordinates(common::RadialSize radialSize, bool smoothingEnabled) const;
|
||||||
[[nodiscard]] const scwx::util::time_zone* default_time_zone() const;
|
[[nodiscard]] const scwx::util::time_zone* default_time_zone() const;
|
||||||
|
[[nodiscard]] bool is_tdwr() const;
|
||||||
[[nodiscard]] float gate_size() const;
|
[[nodiscard]] float gate_size() const;
|
||||||
[[nodiscard]] std::string radar_id() const;
|
[[nodiscard]] std::string radar_id() const;
|
||||||
[[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const;
|
[[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ public:
|
||||||
|
|
||||||
void ComputeCoordinates(
|
void ComputeCoordinates(
|
||||||
const std::shared_ptr<wsr88d::rpg::GenericRadialDataPacket>& radialData,
|
const std::shared_ptr<wsr88d::rpg::GenericRadialDataPacket>& radialData,
|
||||||
bool smoothingEnabled);
|
bool smoothingEnabled,
|
||||||
|
float gateSize);
|
||||||
|
|
||||||
[[nodiscard]] inline std::uint8_t
|
[[nodiscard]] inline std::uint8_t
|
||||||
RemapDataMoment(std::uint8_t dataMoment) const;
|
RemapDataMoment(std::uint8_t dataMoment) const;
|
||||||
|
|
@ -269,17 +270,24 @@ void Level3RadialView::ComputeSweep()
|
||||||
}
|
}
|
||||||
|
|
||||||
common::RadialSize radialSize;
|
common::RadialSize radialSize;
|
||||||
if (radials == common::MAX_0_5_DEGREE_RADIALS)
|
if (radarProductManager->is_tdwr())
|
||||||
{
|
{
|
||||||
radialSize = common::RadialSize::_0_5Degree;
|
radialSize = common::RadialSize::NonStandard;
|
||||||
}
|
|
||||||
else if (radials == common::MAX_1_DEGREE_RADIALS)
|
|
||||||
{
|
|
||||||
radialSize = common::RadialSize::_1Degree;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
radialSize = common::RadialSize::NonStandard;
|
if (radials == common::MAX_0_5_DEGREE_RADIALS)
|
||||||
|
{
|
||||||
|
radialSize = common::RadialSize::_0_5Degree;
|
||||||
|
}
|
||||||
|
else if (radials == common::MAX_1_DEGREE_RADIALS)
|
||||||
|
{
|
||||||
|
radialSize = common::RadialSize::_1Degree;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
radialSize = common::RadialSize::NonStandard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<float>& coordinates =
|
const std::vector<float>& coordinates =
|
||||||
|
|
@ -323,11 +331,21 @@ void Level3RadialView::ComputeSweep()
|
||||||
// Compute threshold at which to display an individual bin
|
// Compute threshold at which to display an individual bin
|
||||||
const uint16_t snrThreshold = descriptionBlock->threshold();
|
const uint16_t snrThreshold = descriptionBlock->threshold();
|
||||||
|
|
||||||
|
// Compute gate interval
|
||||||
|
const std::uint16_t dataMomentInterval =
|
||||||
|
descriptionBlock->x_resolution_raw();
|
||||||
|
|
||||||
|
// Get the gate length in meters. Use dataMomentInterval for NonStandard to
|
||||||
|
// avoid generating >1 base gates per bin.
|
||||||
|
const float gateLength = radialSize == common::RadialSize::NonStandard ?
|
||||||
|
static_cast<float>(dataMomentInterval) :
|
||||||
|
radarProductManager->gate_size();
|
||||||
|
|
||||||
// Determine which radial to start at
|
// Determine which radial to start at
|
||||||
std::uint16_t startRadial;
|
std::uint16_t startRadial;
|
||||||
if (radialSize == common::RadialSize::NonStandard)
|
if (radialSize == common::RadialSize::NonStandard)
|
||||||
{
|
{
|
||||||
p->ComputeCoordinates(radialData, smoothingEnabled);
|
p->ComputeCoordinates(radialData, smoothingEnabled, gateLength);
|
||||||
startRadial = 0;
|
startRadial = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -337,15 +355,11 @@ void Level3RadialView::ComputeSweep()
|
||||||
startRadial = std::lroundf(startAngle * radialMultiplier);
|
startRadial = std::lroundf(startAngle * radialMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute gate interval
|
|
||||||
const std::uint16_t dataMomentInterval =
|
|
||||||
descriptionBlock->x_resolution_raw();
|
|
||||||
|
|
||||||
// Compute gate size (number of base gates per bin)
|
// Compute gate size (number of base gates per bin)
|
||||||
const std::uint16_t gateSize = std::max<std::uint16_t>(
|
const std::uint16_t gateSize = std::max<std::uint16_t>(
|
||||||
1,
|
1,
|
||||||
dataMomentInterval /
|
dataMomentInterval /
|
||||||
static_cast<std::uint16_t>(radarProductManager->gate_size()));
|
static_cast<std::uint16_t>(gateLength));
|
||||||
|
|
||||||
// Compute gate range [startGate, endGate)
|
// Compute gate range [startGate, endGate)
|
||||||
std::uint16_t startGate = 0;
|
std::uint16_t startGate = 0;
|
||||||
|
|
@ -526,7 +540,8 @@ Level3RadialView::Impl::RemapDataMoment(std::uint8_t dataMoment) const
|
||||||
|
|
||||||
void Level3RadialView::Impl::ComputeCoordinates(
|
void Level3RadialView::Impl::ComputeCoordinates(
|
||||||
const std::shared_ptr<wsr88d::rpg::GenericRadialDataPacket>& radialData,
|
const std::shared_ptr<wsr88d::rpg::GenericRadialDataPacket>& radialData,
|
||||||
bool smoothingEnabled)
|
bool smoothingEnabled,
|
||||||
|
float gateSize)
|
||||||
{
|
{
|
||||||
logger_->debug("ComputeCoordinates()");
|
logger_->debug("ComputeCoordinates()");
|
||||||
|
|
||||||
|
|
@ -537,7 +552,6 @@ void Level3RadialView::Impl::ComputeCoordinates(
|
||||||
|
|
||||||
auto radarProductManager = self_->radar_product_manager();
|
auto radarProductManager = self_->radar_product_manager();
|
||||||
auto radarSite = radarProductManager->radar_site();
|
auto radarSite = radarProductManager->radar_site();
|
||||||
const float gateSize = radarProductManager->gate_size();
|
|
||||||
const double radarLatitude = radarSite->latitude();
|
const double radarLatitude = radarSite->latitude();
|
||||||
const double radarLongitude = radarSite->longitude();
|
const double radarLongitude = radarSite->longitude();
|
||||||
|
|
||||||
|
|
@ -583,6 +597,10 @@ void Level3RadialView::Impl::ComputeCoordinates(
|
||||||
const float range =
|
const float range =
|
||||||
(static_cast<float>(gate) + gateRangeOffset) * gateSize;
|
(static_cast<float>(gate) + gateRangeOffset) * gateSize;
|
||||||
const std::size_t offset = static_cast<size_t>(radialGate) * 2;
|
const std::size_t offset = static_cast<size_t>(radialGate) * 2;
|
||||||
|
if (offset + 1 >= coordinates_.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double latitude = 0.0;
|
double latitude = 0.0;
|
||||||
double longitude = 0.0;
|
double longitude = 0.0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue