Running ‘testthat.R’ [4s/7s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(satellite)
  Loading required package: raster
  Loading required package: sp
  > 
  > 
  > ### functions to create test data sets -----
  > 
  > ### Utility functions to quickly create test data sets for various sensors
  > ### Florian Detsch, last modified on 2017-07-24
  > 
  > tst_obj <- function(type = c("LC08", "LC8", "LE07", "LE7", "LT05")) {
  +   if (type[1] == "LC08")
  +     tst_obj_lc08()
  +   else if (type[1] == "LC8")
  +     tst_obj_lc8()
  +   else if (type[1] == "LE07")
  +     tst_obj_le07()
  +   else if (type[1] == "LE7")
  +     tst_obj_le7()
  +   else if (type[1] == "LT05")
  +     tst_obj_lt05()
  +   else 
  +     stop("Sensor test data not available, yet.\n")
  + }
  > 
  > 
  > ### collection 1 level-1 -----
  > 
  > ## landsat 8
  > tst_obj_lc08 <- function() {
  +   path <- system.file("extdata", package = "satellite")
  +   files <- list.files(path, pattern = glob2rx("LC08*.TIF"), full.names = TRUE)
  +   satellite(files)
  + }
  > 
  > ## landsat 7
  > tst_obj_le07 <- function() {
  +   path <- system.file("extdata", package = "satellite")
  +   files <- list.files(path, pattern = glob2rx("LE07*.TIF"), full.names = TRUE)
  +   satellite(files)
  + }
  > 
  > ## landsat 5
  > tst_obj_lt05 <- function() {
  +   path <- system.file("testdata/LT05", package = "satellite")
  +   files <- list.files(path, pattern = glob2rx("LT05*.TIF"), full.names = TRUE)
  +   satellite(files)
  + }
  > 
  > 
  > ### precollection level-1 -----
  > 
  > ## landsat 8
  > tst_obj_lc8 <- function() {
  +   path <- system.file("testdata/LC8", package = "satellite")
  +   files <- list.files(path, pattern = glob2rx("LC8*.TIF"), full.names = TRUE)
  +   satellite(files)
  + }
  > 
  > ## landsat 7
  > tst_obj_le7 <- function() {
  +   path <- system.file("testdata/LE7", package = "satellite")
  +   files <- list.files(path, pattern = glob2rx("LE7*.TIF"), full.names = TRUE)
  +   satellite(files)
  + }
  > 
  > 
  > ### perform tests -----
  > 
  > test_check("satellite")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  satellite
   --- call from context --- 
  lutInfoSIDfromFilename(file)
   --- call from argument --- 
  if (class(test) == "matrix") {
      return(colnames(test)[test[1, ]])
  } else {
      return(names(test)[test])
  }
   --- R stacktrace ---
  where 1: lutInfoSIDfromFilename(file)
  where 2: lutInfoSGRPfromFilename(x)
  where 3: .local(x, ...)
  where 4: satellite(files)
  where 5 at testthat/test-calcAtmosCorr.R#8: satellite(files)
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-calcAtmosCorr.R#5: test_that("calcAtmosCorr for RasterLayers works as expected", 
      {
          path <- system.file("testdata/LC8", package = "satellite")
          files <- list.files(path, pattern = glob2rx("LC8*.TIF"), 
              full.names = TRUE)
          sat <- satellite(files)
          sat <- calcTOAIrradRadRef(sat)
          bcde <- "B002n"
          path_rad <- calcPathRadDOS(x = min(getValues(getSatDataLayer(sat, 
              bcde))), bnbr = getSatLNBR(sat, bcde), band_wls = data.frame(LMIN = getSatLMIN(sat, 
              getSatBCDESolar(sat)), LMAX = getSatLMAX(sat, getSatBCDESolar(sat))), 
              radm = getSatRADM(sat, getSatBCDESolar(sat)), rada = getSatRADA(sat, 
                  getSatBCDESolar(sat)), szen = getSatSZEN(sat, 
                  getSatBCDESolar(sat)), esun = getSatESUN(sat, 
                  getSatBCDESolar(sat)), model = "DOS2")
          sensor_rad <- convSC2Rad(x = getSatDataLayer(sat, bcde), 
              mult = getSatRADM(sat, bcde), add = getSatRADA(sat, 
                  bcde))
          ref_atmos <- calcAtmosCorr(x = sensor_rad, path_rad = path_rad[names(path_rad) == 
              bcde], esun = getSatESUN(sat, bcde), szen = getSatSZEN(sat, 
              bcde), model = "DOS2")
          expect_equal(round(raster::getValues(ref_atmos)[50], 
              4), round(0.0455, 4))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 44: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 45: test_check("satellite")
  
   --- value of length: 2 type: logical ---
  [1]  TRUE FALSE
   --- function from context --- 
  function (files) 
  {
      test <- sapply(lut$SENSOR_ID_PATTERN$PATTERN, function(x) {
          grepl(x, basename(files))
      })
      if (!any(test)) {
          test <- sapply(lut$SENSOR_ID_PATTERN$PATTERN2, function(x) {
              grepl(x, basename(files))
          })
      }
      if (class(test) == "matrix") {
          return(colnames(test)[test[1, ]])
      }
      else {
          return(names(test)[test])
      }
  }
  <bytecode: 0x55f1dce10680>
  <environment: namespace:satellite>
   --- function search by body ---
  Function lutInfoSIDfromFilename in namespace satellite has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1