NEONScience/NEON-utilities

loadByProduct bug introduced between 1.3.2 and 1.3.0.

rfiorella opened this issue · 4 comments

Function
loadByProduct

Describe the bug
Requesting data with loadByProduct fails in neonUtilities 1.3.2, but not 1.3.0.

To Reproduce
calling loadByProduct("DP1.00098.001",site="HARV",startdate="2017-01",avg=30,check.size=F) fails in 1.3.2 with an Error in file(file,"rt"): invalid 'description' argument after upgrading to neonUtilities 1.3.2.

The error disappears after downgrading to neonUtilities 1.3.0 using devtools::install_version("neonUtilities", version = "1.3.0", repos = "http://cran.us.r-project.org")

Traceback information from R:

 Error in file(file, "rt") : invalid 'description' argument 
8.
file(file, "rt") 
7.
read.table(file = file, header = header, sep = sep, quote = quote, 
    dec = dec, fill = fill, comment.char = comment.char, ...) 
6.
utils::read.csv(varFile, header = T, stringsAsFactors = F) 
5.
getVariables(varpath) 
4.
stackDataFilesParallel(savepath, nCores) 
3.
stackByTable(filepath = paste(temppath, "/filesToStack", substr(dpID, 
    5, 9), sep = ""), savepath = "envt", folder = TRUE, nCores, 
    forceParallel) 
2.
loadByProduct("DP1.00098.001", site = neon.site, startdate = "2017-01", 
    avg = 30, check.size = F)

Expected behavior
For this specific call, I would expect a data frame of RH data from the HARV site from January 2017 to end of record.

System (please complete the following information):

  • OS: Mac OSX
  • OS Version: Catalina (10.15.1).
  • R Version: 3.6.0.

@rfiorella Thanks for alerting us to this!

I was able to replicate the problem on my machine, it's an error in handling the avg= argument with the new code that retains the readme files when stacking data. I should be able to fix it without too much trouble. In the meantime, either using v1.3.1 or downloading all averaging intervals with v1.3.2 should be fine.

I'll comment again when I have a fix. Thanks, and sorry for the bug!

Thanks @cklunch! Let me know if there's anything I can do to help - I've kept the downgraded version for now.

@rfiorella @daijiang
This is now fixed on GitHub! I'm planning to send a new version to CRAN in early January, but for now you can install v1.3.3 from here and it should work fine with avg=. I'll leave this issue open until the fix is on CRAN.
Let us know if you run into any other problems!

@rfiorella @daijiang
neonUtilities v1.3.3 is now on CRAN and this problem should be resolved. Let me know if you run into any problems with it!