Running ‘testthat.R’ [4s/165s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(nasapower)
  > 
  > test_check("nasapower")
  Loading required namespace: jsonlite
  ── 1. Error: create_icasa() creates a txt file with proper values (@test-create_
  The Daily POWER Data Access Service is currently unavailable. Please check back at a later time. If you have any questions please contact us at power-project@lists.nasa.gov. Please reference our API Documentation at https://power.larc.nasa.gov for more information.
  1: vcr::use_cassette("create_icasa_file", {
         create_icasa(lonlat = c(151.81, -27.48), dates = c("1983-01-01"), file_out = "icasa", 
             dsn = tempdir())
         icasa <- readLines(file.path(tempdir(), "icasa.txt"))
         expect_true(any(grepl("icasa.txt", list.files(tempdir()))))
         expect_equal(length(icasa), 16)
         expect_equal(nchar(icasa)[[1]], 47)
         expect_equal(nchar(icasa)[[16]], 73)
     }) at testthat/test-create_icasa.R:5
  2: cassette$call_block(...)
  3: lazyeval::lazy_eval(tmp)
  4: lapply(x, lazy_eval, data = data)
  5: FUN(X[[i]], ...)
  6: eval(x$expr, x$env, emptyenv())
  7: eval(x$expr, x$env, emptyenv())
  8: create_icasa(lonlat = c(151.81, -27.48), dates = c("1983-01-01"), file_out = "icasa", 
         dsn = tempdir()) at testthat/test-create_icasa.R:6
  9: .power_query(community = "AG", lonlat_identifier, pars, dates = dates, outputList = "ICASA")
  10: stop(call. = FALSE, unlist(txt$messages))
  
  ── 2. Error: create_met() creates a .met file for APSIM use (@test-create_met.R#
  The Daily POWER Data Access Service is currently unavailable. Please check back at a later time. If you have any questions please contact us at power-project@lists.nasa.gov Please reference our API Documentation at https://power.larc.nasa.gov for more information.
  1: vcr::use_cassette("create_met", {
         power_query <- create_met(lonlat = c(151.81, -27.48), dates = c("1985-01-01", 
             "1985-12-31"), dsn = tempdir(), file_out = "APSIM")
         met <- readLines(file.path(tempdir(), "APSIM.met"))
         expect_true(any(grepl("APSIM.met", list.files(tempdir()))))
         expect_equal(length(met), 377)
         expect_equal(nchar(met)[[1]], 21)
         expect_equal(nchar(met)[[14]], 28)
         expect_equal(nchar(met)[[311]], 31)
     }) at testthat/test-create_met.R:6
  2: cassette$call_block(...)
  3: lazyeval::lazy_eval(tmp)
  4: lapply(x, lazy_eval, data = data)
  5: FUN(X[[i]], ...)
  6: eval(x$expr, x$env, emptyenv())
  7: eval(x$expr, x$env, emptyenv())
  8: create_met(lonlat = c(151.81, -27.48), dates = c("1985-01-01", "1985-12-31"), dsn = tempdir(), 
         file_out = "APSIM") at testthat/test-create_met.R:7
  9: as.data.frame(get_power(pars = c("T2M_MAX", "T2M_MIN", "ALLSKY_SFC_SW_DWN", "PRECTOT"), 
         dates = dates, lonlat = lonlat, temporal_average = "DAILY", community = "AG"))
  10: get_power(pars = c("T2M_MAX", "T2M_MIN", "ALLSKY_SFC_SW_DWN", "PRECTOT"), dates = dates, 
         lonlat = lonlat, temporal_average = "DAILY", community = "AG")
  11: .power_query(community, lonlat_identifier, pars, dates, outputList = "CSV")
  12: stop(call. = FALSE, unlist(txt$messages))
  
  ── 3. Error: get_power returns daily point AG data (@test-get_power.R#6)  ──────
  
  Something went wrong with the query. Please try again.
  1: vcr::use_cassette("SinglePoint_AG", {
         power_query <- get_power(community = "AG", lonlat = c(-179.5, -89.5), pars = c("T2M", 
             "T2M_MIN", "T2M_MAX", "RH2M", "WS10M"), dates = c("1983-01-01"), temporal_average = "Daily")
         expect_is(power_query, "data.frame")
         expect_equal(power_query$LAT, -89.5, tolerance = 0.001)
         expect_equal(power_query$LON, -179.5, tolerance = 0.001)
         expect_equal(power_query$YEAR, 1983)
         expect_equal(power_query$MM, 1)
         expect_equal(power_query$DD, 1)
         expect_equal(power_query$DOY, 1)
         expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01"))
         expect_equal(power_query$T2M, -25.24)
         expect_equal(power_query$T2M_MIN, -25.55)
         expect_equal(power_query$T2M_MAX, -24.9)
         expect_equal(power_query$RH2M, 73.92)
         expect_equal(power_query$WS10M, 2.14)
         rm(power_query)
     }) at testthat/test-get_power.R:6
  2: cassette$call_block(...)
  3: lazyeval::lazy_eval(tmp)
  4: lapply(x, lazy_eval, data = data)
  5: FUN(X[[i]], ...)
  6: eval(x$expr, x$env, emptyenv())
  7: eval(x$expr, x$env, emptyenv())
  8: get_power(community = "AG", lonlat = c(-179.5, -89.5), pars = c("T2M", "T2M_MIN", 
         "T2M_MAX", "RH2M", "WS10M"), dates = c("1983-01-01"), temporal_average = "Daily") at testthat/test-get_power.R:7
  9: .power_query(community, lonlat_identifier, pars, dates, outputList = "CSV")
  10: tryCatch({
         response <- client$get(query = query_list, retry = 6)
         txt <- jsonlite::fromJSON(response$parse("UTF-8"))
         raw_power_data <- file.path(tempdir(), "power_data_file")
     }, error = function(e) {
         e$message <- paste("\nSomething went wrong with the query. Please try again.\n")
         e$call <- NULL
         stop(e)
     })
  11: tryCatchList(expr, classes, parentenv, handlers)
  12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  13: value[[3L]](cond)
  
  ── 4. Error: get_power returns daily regional AG data (@test-get_power.R#39)  ──
  The Daily POWER Data Access Service is currently unavailable. Please check back at a later time. If you have any questions please contact us at power-project@lists.nasa.gov Please reference our API Documentation at https://power.larc.nasa.gov for more information.
  1: vcr::use_cassette("Regional_AG", {
         power_query <- get_power(community = "AG", lonlat = c(112.5, -55.5, 115.5, -50.5), 
             pars = "T2M", dates = c("1983-01-01"), temporal_average = "Daily")
         expect_equal(nrow(power_query), 77)
         expect_equal(unique(power_query$LAT), c(-55.25, -54.75, -54.25, -53.75, -53.25, 
             -52.75, -52.25, -51.75, -51.25, -50.75, -50.25))
         expect_equal(unique(power_query$LON), c(112.75, 113.25, 113.75, 114.25, 114.75, 
             115.25, 115.75))
         expect_equal(power_query$YEAR[1], 1983)
         expect_equal(power_query$MM[1], 1)
         expect_equal(power_query$DD[1], 1)
         expect_equal(power_query$DOY[1], 1)
         expect_equal(power_query$YYYYMMDD[1], as.Date("1983-01-01"))
         expect_equal(power_query$DOY[1], 1)
         expect_equal(power_query$T2M[1], 3.28)
         rm(power_query)
     }) at testthat/test-get_power.R:39
  2: cassette$call_block(...)
  3: lazyeval::lazy_eval(tmp)
  4: lapply(x, lazy_eval, data = data)
  5: FUN(X[[i]], ...)
  6: eval(x$expr, x$env, emptyenv())
  7: eval(x$expr, x$env, emptyenv())
  8: get_power(community = "AG", lonlat = c(112.5, -55.5, 115.5, -50.5), pars = "T2M", 
         dates = c("1983-01-01"), temporal_average = "Daily") at testthat/test-get_power.R:40
  9: .power_query(community, lonlat_identifier, pars, dates, outputList = "CSV")
  10: stop(call. = FALSE, unlist(txt$messages))
  
  ── 5. Error: get_power returns global AG data for climatology (@test-get_power.R
  The Climatology POWER Data Access Service is currently unavailable. Please check back at a later time. If you have any questions please contact us at power-project@lists.nasa.gov. Please reference our API Documentation at https://power.larc.nasa.gov for more information.
  1: vcr::use_cassette("Global_AG", {
         power_query <- get_power(community = "AG", pars = "T2M", temporal_average = "CLIMATOLOGY")
         expect_equal(nrow(power_query), 259200)
         expect_equal(power_query$PARAMETER[1], "T2M")
         expect_equal(power_query$LAT[259200], 89.75)
         expect_equal(power_query$LAT[1], -89.75)
         expect_equal(power_query$LON[259200], 179.75)
         expect_equal(power_query$LON[1], -179.75)
         expect_named(power_query, c("LON", "LAT", "PARAMETER", "JAN", "FEB", "MAR", "APR", 
             "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", "ANN"))
         rm(power_query)
     }) at testthat/test-get_power.R:81
  2: cassette$call_block(...)
  3: lazyeval::lazy_eval(tmp)
  4: lapply(x, lazy_eval, data = data)
  5: FUN(X[[i]], ...)
  6: eval(x$expr, x$env, emptyenv())
  7: eval(x$expr, x$env, emptyenv())
  8: get_power(community = "AG", pars = "T2M", temporal_average = "CLIMATOLOGY") at testthat/test-get_power.R:82
  9: .power_query(community, lonlat_identifier, pars, dates, outputList = "CSV")
  10: stop(call. = FALSE, unlist(txt$messages))
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 59 SKIPPED: 0 FAILED: 5
  1. Error: create_icasa() creates a txt file with proper values (@test-create_icasa.R#5) 
  2. Error: create_met() creates a .met file for APSIM use (@test-create_met.R#6) 
  3. Error: get_power returns daily point AG data (@test-get_power.R#6) 
  4. Error: get_power returns daily regional AG data (@test-get_power.R#39) 
  5. Error: get_power returns global AG data for climatology (@test-get_power.R#81) 
  
  Error: testthat unit tests failed
  Execution halted