Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix combineRhi() #128

Merged
merged 5 commits into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 10 additions & 38 deletions codebase/libs/Radx/src/Radx/RadxVol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2664,54 +2664,26 @@ void RadxVol::combineRhi()
cerr << "Error: attempting to combine RHI scans on non-RHI data" << endl;
return;
}

/// ensure we are in RHI mode
// this may not be necessary ??
int nRhi = 0;
for (size_t isweep = 0; isweep < _sweeps.size(); isweep++) {
const RadxSweep *sweep = _sweeps[isweep];
if ((sweep->getSweepMode() == Radx::SWEEP_MODE_RHI) ||
(sweep->getSweepMode() == Radx::SWEEP_MODE_MANUAL_RHI) ||
(sweep->getSweepMode() == Radx::SWEEP_MODE_SUNSCAN_RHI)) {
nRhi++;
}
}
if (nRhi < ((int) _sweeps.size() / 2)) {
// not predominantly RHI
return;
}


// loop through rays, looking for a 180 degree change in azimuth
// we consider the transition from one ray to the next
// logic from Jacquie Witte ...
float tolerance = 5;
// const RadxSweep *sweep = _sweeps[0];
//vector<RadxRay *> &rays = sweep->getRays();

vector<RadxRay *>::iterator it;
float az0 = _rays[0]->getAzimuthDeg();
for (it = _rays.begin(); it != _rays.end(); ++it) {

RadxRay *ray = *it;
float az1 = ray->getAzimuthDeg();
float res = az0 - az1;

// reset the azimuth if it is almost 180 degrees from starting azimuth
if (fabs(res) > tolerance) {
// Angle cases
if ((res >= -92) && (res < 0)) {
ray->setAzimuthDeg(az1 - 90.0);
}
if ((res >= -180) && (res < -175)) {
ray->setAzimuthDeg(abs(az1 - 180.0));
}
if (res >= 180.0) {
ray->setAzimuthDeg(360.0 - az1);
}
if ((res >= 90.0) && (res < 100.0)) {
ray->setAzimuthDeg(270.0 - az1);
}
float elevation = ray->getElevationDeg();
float delta = 180.0 - elevation;
ray->setElevationDeg(delta);
if ((res > (180 - tolerance)) && (res < (180 + tolerance))){
ray->setAzimuthDeg(az1 + 180);
ray->setElevationDeg(180 - ray->getElevationDeg());
}
else if ((res > (-180 - tolerance) && (res < (-180 + tolerance)))){
ray->setAzimuthDeg(az1 - 180);
ray->setElevationDeg(180 - ray->getElevationDeg());
}

} // rays
Expand Down