flightpathr

Tools to analyze aircraft and flight path data.
git clone https://git.eamoncaddigan.net/flightpathr.git
Log | Files | Refs | README | LICENSE

commit aefcef6a6a424bc893a967faeee9d463137ec3be
parent c31b90dd23c7e3e7f8e5852285df0548736045d3
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date:   Mon, 16 May 2016 10:11:18 -0400

Fixed thresholding

Diffstat:
MR/identifyManeuvers.R | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/R/identifyManeuvers.R b/R/identifyManeuvers.R @@ -15,9 +15,15 @@ identifyBearingChanges <- function(trajectory, hiThresh) { bearings <- coordsToBearing(trajectory) bearings[length(bearings)] <- bearings[length(bearings)-1] - bearingChanges <- c(diff(bearings), 0) + bearingChanges <- c(diff(bearings), NA) - isBearingChange <- abs(bearingChanges) < hiThresh + # Keep bearingChanges in the range [-180, 180] + bearingChanges[!is.na(bearingChanges) & bearingChanges < -180] <- + bearingChanges[!is.na(bearingChanges) & bearingChanges < -180] + 360 + bearingChanges[!is.na(bearingChanges) & bearingChanges > 180] <- + bearingChanges[!is.na(bearingChanges) & bearingChanges > 180] - 360 + + isBearingChange <- abs(bearingChanges) > hiThresh return(isBearingChange) } @@ -39,7 +45,7 @@ identifyAltitudeChanges <- function(trajectory, hiThresh) { trajectoryCoords <- get3dCoords(trajectory) altitudeChanges <- c(diff(trajectoryCoords[, 3]), 0) - isAltitudeChange <- abs(altitudeChanges) < hiThresh + isAltitudeChange <- abs(altitudeChanges) > hiThresh return(isAltitudeChange) }