Created
January 9, 2019 21:52
-
-
Save kimberlyh66/85dd71f23847a38520d60f781e1f60ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install and load in the traits package | |
install.packages("traits") | |
library(traits) | |
#set default options | |
#find your api key at terraref.ncsa.illinois.edu/bety/users and save it to a file in your current directory named '.betykey' | |
options(betydb_key = readLines('.betykey', warn = FALSE), | |
betydb_url = "https://terraref.ncsa.illinois.edu/bety/", | |
betydb_api_version = 'v1') | |
#example query | |
#extract season 5 canopy height data for January 27, 2018 | |
canopy_height <- betydb_query(table = 'search', | |
trait = "canopy_height", | |
method = "~Laser 3d", | |
sitename = "~Season 5", | |
date = "2018 Jan 27", | |
limit = 'none') | |
######################################################## | |
#data is only available for specific dates | |
#to determine which dates data is available: | |
#1.) extract all canopy height data for season 5 | |
canopy_height_all <- betydb_query(table = 'search', | |
trait = "canopy_height", | |
method = "~Laser 3d", | |
sitename = "~Season 5", | |
limit = 'none') | |
#2.) get dates available using the unique function | |
canopy_height_dates <- unique(canopy_height_all$date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment