NEONScience / NEON-utilities

Utilities and scripts for working with NEON data. Currently: an R package with functions to join (stack) the month-by-site files in downloaded NEON data, to convert data to geoCSV format, and to download data from the API.
GNU Affero General Public License v3.0
57 stars 36 forks source link

Select release in zipsByProduct() #110

Closed annakat closed 3 years ago

annakat commented 3 years ago

With the recent NEON data release I was wondering if it would make sense to add the selection of a particular release to zipsByProduct(). Currently zipsByProduct () downloads released and provisional data. stackByTable() could also use this option. Thanks!

taddallas commented 3 years ago

Re-upping this. I see a place where this could occur around line 207 of zipsByProduct(). I guess the use case is to be able to filter by known release, such that an analysis could be reproducible even with continued provisional data release. I could see one approach being to add a flag in the zipsByProduct() function to specify the release. By example, I arbitrarily set the release to "RELEASE-2021" and exclude all the data urls which don't conform to this. Is this a viable option? Open to thoughts and other approaches.

release <- 'RELEASE-2021'
inds <- which(sapply(avail$data$siteCodes$availableReleases, function(x){x[1]==release}))

Then subset the availableDataUrls before the grab to be only that release if the flag is satisfied.

month.urls <- unlist(avail$data$siteCodes$availableDataUrls[inds])
cklunch commented 3 years ago

@annakat @taddallas This is enabled in zipsByProduct() and loadByProduct() on Github, expecting to submit to CRAN next week. Feel free to try it out here!

taddallas commented 3 years ago

Ah nice. Looks like the solution you went with is pretty similar, but at the getZipUrls level (and then referenced in the zipsByProduct etc.. Looks great! Feel free to close issue.

cklunch commented 3 years ago

@annakat @taddallas neonUtilities 2.1.0 is now on CRAN, including download by release.