flightpathr

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

commit 5bec21e8c874aab58f1737424f6888861ae77279
parent da7705cec5650b6a09891608121f9fb8f9c2ce01
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date:   Wed, 27 Apr 2016 12:02:44 -0400

Untested code...

Diffstat:
AR/identifyManeuvers.R | 45+++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+), 0 deletions(-)

diff --git a/R/identifyManeuvers.R b/R/identifyManeuvers.R @@ -0,0 +1,45 @@ +#' Identify the timepoints in a trajectory that correspond to a change in +#' commanded heading. +#' +#' @param trajectory A matrix or SpatialPoints object indicating the trajectory +#' of an aircraft. +#' @param hiThresh A heading change (in degrees); any time point associated with +#' a change in heading greater than this value will definitely be labeled a +#' turn. +#' +#' @return A logical vector indicating whether each timepoint can be considered +#' a turn. +#' +#' @export +identifyHeadingChanges <- function(trajectory, hiThresh) { + bearings <- coordsToBearing(trajectory) + + bearings[length(bearings)] <- bearings[length(bearings)-1] + bearingChanges <- c(diff(bearings), 0) + + isBearingChange <- abs(bearingChanges) < hiThresh + + return(isBearingChange) +} + +#' Identify the timepoints in a trajectory that correspond to a change in +#' altitude. +#' +#' @param trajectory A matrix or SpatialPoints object indicating the trajectory +#' of an aircraft. +#' @param hiThresh An altitude change (in feet); any time point associated with +#' a change in altitude greater than this value will definitely be labeled a +#' climb or descent. +#' +#' @return A logical vector indicating whether each timepoint can be considered +#' a climb or descent. +#' +#' @export +identifyAltitudeChanges <- function(trajectory, hiThresh) { + trajectoryCoords <- get3dCoords(trajectory) + altitudeChanges <- c(diff(trajectoryCoords[, 3]), 0) + + isAltitudeChange <- abs(altitudeChanges) < hiThresh + + return(isAltitudeChange) +}