mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:30:04 +00:00
Optimization and minor fixes to level 3 coordinate calculation
This commit is contained in:
parent
1c84b061dc
commit
a9b425ec42
1 changed files with 48 additions and 37 deletions
|
|
@ -428,50 +428,61 @@ void Level3RadialViewImpl::ComputeCoordinates(
|
||||||
// Calculate azimuth coordinates
|
// Calculate azimuth coordinates
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
const std::uint16_t numRadials = radialData->number_of_radials();
|
const std::uint16_t numRadials = radialData->number_of_radials();
|
||||||
const std::uint16_t numRangeBins = radialData->number_of_range_bins();
|
const std::uint16_t numRangeBins = radialData->number_of_range_bins();
|
||||||
const std::uint32_t numRadialGates = numRadials * numRangeBins;
|
|
||||||
const std::uint32_t maxRadialGates =
|
|
||||||
numRadials * common::MAX_DATA_MOMENT_GATES;
|
|
||||||
|
|
||||||
auto radialGates = boost::irange<uint32_t>(0, maxRadialGates);
|
auto radials = boost::irange<std::uint32_t>(0u, numRadials);
|
||||||
|
auto gates = boost::irange<std::uint32_t>(0u, numRangeBins);
|
||||||
|
|
||||||
std::for_each(
|
std::for_each(std::execution::par_unseq,
|
||||||
std::execution::par_unseq,
|
radials.begin(),
|
||||||
radialGates.begin(),
|
radials.end(),
|
||||||
radialGates.end(),
|
[&](std::uint32_t radial)
|
||||||
[&](std::uint32_t radialGate)
|
{
|
||||||
{
|
float deltaAngle;
|
||||||
const std::uint16_t gate = static_cast<std::uint16_t>(
|
if (radial == 0)
|
||||||
radialGate % common::MAX_DATA_MOMENT_GATES);
|
{
|
||||||
|
// Angles are ordered clockwise, delta should be positive
|
||||||
|
deltaAngle = radialData->start_angle(0) -
|
||||||
|
radialData->start_angle(numRadials - 1);
|
||||||
|
while (deltaAngle < 0.0f)
|
||||||
|
{
|
||||||
|
deltaAngle += 360.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deltaAngle = radialData->delta_angle(radial);
|
||||||
|
}
|
||||||
|
|
||||||
if (gate >= numRadialGates)
|
const float angle =
|
||||||
{
|
radialData->start_angle(radial) - (deltaAngle * 0.5f);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::uint16_t radial = static_cast<std::uint16_t>(
|
std::for_each(std::execution::par_unseq,
|
||||||
radialGate / common::MAX_DATA_MOMENT_GATES);
|
gates.begin(),
|
||||||
|
gates.end(),
|
||||||
|
[&](std::uint32_t gate)
|
||||||
|
{
|
||||||
|
const std::uint32_t radialGate =
|
||||||
|
radial * common::MAX_DATA_MOMENT_GATES +
|
||||||
|
gate;
|
||||||
|
const float range = (gate + 1) * gateSize;
|
||||||
|
const std::size_t offset = radialGate * 2;
|
||||||
|
|
||||||
const float deltaAngle =
|
double latitude;
|
||||||
(radial == 0) ? radialData->start_angle(0) -
|
double longitude;
|
||||||
radialData->start_angle(numRadials - 1) :
|
|
||||||
radialData->delta_angle(radial);
|
|
||||||
|
|
||||||
const float angle =
|
geodesic.Direct(radarLatitude,
|
||||||
radialData->start_angle(radial) - (deltaAngle * 0.5f);
|
radarLongitude,
|
||||||
const float range = (gate + 1) * gateSize;
|
angle,
|
||||||
const std::size_t offset = radialGate * 2;
|
range,
|
||||||
|
latitude,
|
||||||
|
longitude);
|
||||||
|
|
||||||
double latitude;
|
coordinates_[offset] = latitude;
|
||||||
double longitude;
|
coordinates_[offset + 1] = longitude;
|
||||||
|
});
|
||||||
geodesic.Direct(
|
});
|
||||||
radarLatitude, radarLongitude, angle, range, latitude, longitude);
|
|
||||||
|
|
||||||
coordinates_[offset] = latitude;
|
|
||||||
coordinates_[offset + 1] = longitude;
|
|
||||||
});
|
|
||||||
timer.stop();
|
timer.stop();
|
||||||
logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws"));
|
logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue