mikejohnson51 / climateR

An R 📦 for getting point and gridded climate data by AOI
https://mikejohnson51.github.io/climateR/
MIT License
165 stars 40 forks source link

devtools::check() error found in test-netrc.R #74

Closed anguswg-ucsb closed 11 months ago

anguswg-ucsb commented 12 months ago

When trying to run devtools::document() followed by devtools::check() on climateR version 0.3.1.2: I run into this error

The error occurs from the writeDodsrc(netrc, dodsrc) testthat function call here

-- Failure (Line 21): netrc ----------------------------------------------------
`writeDodsrc(netrc, dodsrc)` did not throw the expected error.

Error in reporter$stop_if_needed() : Test failed

And here is the original test failure error that came when I called devtools::check():

══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-climateR.R:275:3'): NLDAS ──────────────────────────────────────
Error in `getNLDAS(AOI = aoi_get("Fort Collins"), varname = "ugrd10m", 
    startDate = "2020-01-01")`: netrc file not found. Please run writeNetrc() with earth data credentials.
Backtrace:
    ▆
 1. └─climateR::getNLDAS(...) at test-climateR.R:275:2
── Error ('test-climateR.R:294:3'): GLDAS ──────────────────────────────────────
Error in `getGLDAS(AOI = AOI::aoi_get("Fort Collins"), varname = "snowt_tavg", 
    startDate = "2020-01-01")`: netrc file not found. Please run writeNetrc() with earth data credentials.
Backtrace:
    ▆
 1. └─climateR::getGLDAS(...) at test-climateR.R:294:2
── Error ('test-climateR.R:319:3'): MODIS ──────────────────────────────────────
Error in `getMODIS(AOI = aoi_get(state = "FL"), asset = "MOD16A2.006", 
    varname = "PET_500m", startDate = "2020-10-29", dryrun = TRUE)`: netrc file not found. Please run writeNetrc() with earth data credentials.
Backtrace:
    ▆
 1. └─climateR::getMODIS(...) at test-climateR.R:319:2
── Error ('test-climateR.R:542:3'): dap_xyzv ───────────────────────────────────
Error in `var.get.nc(nc, T_var_info$name, unpack = TRUE)`: NetCDF: Access failure
Backtrace:
    ▆
 1. └─climateR:::.resource_time(nc = RNetCDF::open.nc(URL)) at test-climateR.R:542:2
 2.   ├─RNetCDF::utcal.nc(...)
 3.   │ └─base::stopifnot(is.numeric(value))
 4.   └─RNetCDF::var.get.nc(nc, T_var_info$name, unpack = TRUE)
── Failure ('test-climateR.R:573:3'): BCCA ─────────────────────────────────────
length(xx) == 6 is not TRUE

`actual`:   FALSE
`expected`: TRUE 
── Failure ('test-netrc.R:21:3'): netrc ────────────────────────────────────────
`writeDodsrc(netrc, dodsrc)` did not throw the expected error.

[ FAIL 6 | WARN 0 | SKIP 0 | PASS 171 ]
Error: Test failures
Execution halted
mikejohnson51 commented 11 months ago

Closed by removing this test. It was no longer needed with the recent dodrc changes. Thanks!