Working with NEON API


#1

Let’s start a general discussion about those creating/using methods to access NEON’s data by API (programmatically).

Tutorial at NEON data skills http://neondataskills.org/R/neon-api/

NNEO package for R https://cran.r-project.org/web/packages/nneo/index.html

An example using nneo for downloading multiple months of met data from multiple packages and stitch into a single NetCDF CF-compliant file

What else have people found? Other ways to access data from code?


#2

We have two R packages (so far!) we’ve been developing internally for API access:

The neonDataStackR package https://github.com/NEONScience/NEON-utilities/tree/master/neonDataStackR
It has two functions: the primary function is for stacking monthly files into continuous times series (works whether you got those files from the portal or from the API), and the second function downloads monthly files from the API and stores them so they can be fed into the first function.

The geoNEON package: https://github.com/NEONScience/NEON-geolocation/tree/master/geoNEON
This one is specifically for accessing spatial/geolocation data from the API. There’s a short introduction to it in the API tutorial mentioned above. It’s still in development, we’ve been rolling out new functionality along with new data releases but we’re not entirely caught up.


#3

Not sure if this is the appropriate place for troubleshooting the use of the neonUtilities package, but I am getting an error that I can’t figure out - package loaded and working, but here’s what I get:

This works fine. I get all the Megapit fine root biomass data:

zipsByProduct(dpID = "DP1.10066.001", site  = "all", package = "basic", 
check.size = T, savepath = "Data")

However, when I run this:

stackByTable(paste0(getwd(), "Data/filesToStack10066"), savepath = "Data/Stacked", 
folder = T, saveUnzippedFiles = F)

I get an error:
Error in if (package == “anded”) { :
missing value where TRUE/FALSE needed

Also, any preferences for formatting things if you do want these discussions here?

Thanks!


#4

Oh, and I see now that we can use BBcode…okie doke.


#5

Hi @jbwest. Glad to see you are experimenting with the neonUtilities functions. I think the issue might be in how you’re calling ‘savepath.’ You can either fill in complete file paths, or use setwd() to set the paths where you want the zips and stacked files to go. Maybe try it this way?

setwd("~/Your/path/to/files")
zipsByProduct(dpID = “DP1.10066.001”, site = “all”, package = “basic”, check.size = T)
stackByTable(filepath = paste0(getwd(), “/filesToStack10066”), folder = T, saveUnzippedFiles = F)

Let me know if that works, cheers.


#6

Thanks for the feedback here and over email Samantha. I’m glad we could work that out (once everyone had the updated version of the package!). I did have a “silly” error in the filepath (missing “/”) and don’t really need the savepath argument here. This does indeed work:

zipsByProduct(dpID = "DP1.10066.001", site  = "all", package = "basic", 
check.size = F)
stackByTable(filepath = paste0(getwd(), "/filesToStack10066"), folder = T, 
saveUnzippedFiles = F)