flightpathr

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

commit 984b2be3466125af005397ca086f75e9c5eb2d40
parent 88a44af77331ffef32372e35ec8215485f1ce95a
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date:   Thu, 22 Sep 2016 08:40:59 -0400

Altitude deviations are passing tests

Diffstat:
Mtests/testthat/test_distanceFromPath.R | 41+++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/tests/testthat/test_distanceFromPath.R b/tests/testthat/test_distanceFromPath.R @@ -62,26 +62,27 @@ test_that("small deviations look OK", { tolerance = 1) }) -# test_that("simple altitude deviation is handled", { -# flownPath1 <- cbind(path, alt = 3500) -# flownPath2 <- cbind(path, alt = c(3500, 4500, 3500)) -# flownPath3 <- cbind(path, alt = c(3500, 5500, 3500)) -# flownPath4 <- cbind(path, alt = c(3500, 5500, 5500)) -# flownTrajectory <- cbind(fakeTrajectory(path), -# alt = c(seq(3500, 5500, length.out = numPoints+2), -# seq(5500, 3500, -# length.out = nrow(trajectory)-(numPoints+2)))) -# -# expect_lt(abs(maxDistanceFromPath(flownTrajectory, flownPath1)["vertical"] - 2000), -# distancePrecision) -# expect_lt(abs(maxDistanceFromPath(flownTrajectory, flownPath2)["vertical"] - 1000), -# distancePrecision) -# expect_lt(abs(maxDistanceFromPath(flownTrajectory, flownPath3)["vertical"] - 0000), -# distancePrecision) -# expect_lt(abs(maxDistanceFromPath(flownTrajectory, flownPath4)["vertical"] - -2000), -# distancePrecision) -# }) -# +test_that("simple altitude deviation is handled", { + flownPath1 <- createPath(pathMat[, "lon"], pathMat[, "lat"], 3500) + flownPath2 <- createPath(pathMat[, "lon"], pathMat[, "lat"], c(3500, 4500, 3500)) + flownPath3 <- createPath(pathMat[, "lon"], pathMat[, "lat"], c(3500, 5500, 3500)) + flownPath4 <- createPath(pathMat[, "lon"], pathMat[, "lat"], c(3500, 5500, 5500)) + flownTrajectory <- createTrajectory(trajectory$longitude, trajectory$latitude, + c(seq(3500, 5500, + length.out = numPoints+2), + seq(5500, 3500, + length.out = length(trajectory$longitude)-(numPoints+2)))) + + expect_equal(maxDistanceFromPath(flownTrajectory, flownPath1)["vertical"], + c("vertical" = 2000), tolerance = 1) + expect_equal(maxDistanceFromPath(flownTrajectory, flownPath2)["vertical"], + c("vertical" = 1000), tolerance = 1) + expect_equal(maxDistanceFromPath(flownTrajectory, flownPath3)["vertical"], + c("vertical" = 0000), tolerance = 1) + expect_equal(maxDistanceFromPath(flownTrajectory, flownPath4)["vertical"], + c("vertical" = -2000), tolerance = 1) +}) + test_that("reproducing geosphere vignette example", { LA <- c(-118.40, 33.95) NY <- c(-73.78, 40.63)