mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:10:05 +00:00
Use parallel std::find_if to find radial at azimuth
This commit is contained in:
parent
20191dce07
commit
b67f546774
1 changed files with 30 additions and 25 deletions
|
|
@ -556,19 +556,23 @@ Level3RadialView::GetBinLevel(const common::Coordinate& coordinate) const
|
|||
|
||||
// Find Radial
|
||||
const std::uint16_t numRadials = radialData->number_of_radials();
|
||||
std::uint16_t radial = numRadials;
|
||||
double nextAngle = radialData->start_angle(0);
|
||||
for (std::uint16_t i = 0; i < numRadials; ++i)
|
||||
auto radials = boost::irange<std::uint32_t>(0u, numRadials);
|
||||
|
||||
auto radial = std::find_if( //
|
||||
std::execution::par_unseq,
|
||||
radials.begin(),
|
||||
radials.end(),
|
||||
[&](std::uint32_t i)
|
||||
{
|
||||
double startAngle = nextAngle;
|
||||
nextAngle = radialData->start_angle((i + 1) % numRadials);
|
||||
bool found = false;
|
||||
double startAngle = radialData->start_angle(i);
|
||||
double nextAngle = radialData->start_angle((i + 1) % numRadials);
|
||||
|
||||
if (startAngle < nextAngle)
|
||||
{
|
||||
if (startAngle <= azi1 && azi1 < nextAngle)
|
||||
{
|
||||
radial = i;
|
||||
break;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -576,13 +580,14 @@ Level3RadialView::GetBinLevel(const common::Coordinate& coordinate) const
|
|||
// If the bin crosses 0/360 degrees, special handling is needed
|
||||
if (startAngle <= azi1 || azi1 < nextAngle)
|
||||
{
|
||||
radial = i;
|
||||
break;
|
||||
}
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (radial == numRadials)
|
||||
return found;
|
||||
});
|
||||
|
||||
if (radial == radials.end())
|
||||
{
|
||||
// No radial was found (not likely to happen without a gap in data)
|
||||
return std::nullopt;
|
||||
|
|
@ -590,7 +595,7 @@ Level3RadialView::GetBinLevel(const common::Coordinate& coordinate) const
|
|||
|
||||
// Compute threshold at which to display an individual bin
|
||||
const std::uint16_t snrThreshold = descriptionBlock->threshold();
|
||||
const std::uint8_t level = radialData->level(radial).at(gate);
|
||||
const std::uint8_t level = radialData->level(*radial).at(gate);
|
||||
|
||||
if (level < snrThreshold && level != RANGE_FOLDED)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue